[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210106220526.GH6908@magnolia>
Date: Wed, 6 Jan 2021 14:05:26 -0800
From: "Darrick J. Wong" <darrick.wong@...cle.com>
To: Daejun Park <daejun7.park@...sung.com>
Cc: "tytso@....edu" <tytso@....edu>,
"adilger.kernel@...ger.ca" <adilger.kernel@...ger.ca>,
"harshadshirwadkar@...il.com" <harshadshirwadkar@...il.com>,
"linux-ext4@...r.kernel.org" <linux-ext4@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] ext4: Remove expensive flush on fast commit
On Wed, Jan 06, 2021 at 10:32:42AM +0900, Daejun Park wrote:
> In the fast commit, it adds REQ_FUA and REQ_PREFLUSH on each fast commit
> block when barrier is enabled. However, in recovery phase, ext4 compares
> CRC value in the tail. So it is sufficient adds REQ_FUA and REQ_PREFLUSH
> on the block that has tail.
Just out of curiosity, how does the new fastcommit code handle tests
like generic/475 that simulate sudden disk failure?
--D
> Signed-off-by: Daejun Park <daejun7.park@...sung.com>
> ---
> fs/ext4/fast_commit.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/fs/ext4/fast_commit.c b/fs/ext4/fast_commit.c
> index 4fcc21c25e79..e66507be334c 100644
> --- a/fs/ext4/fast_commit.c
> +++ b/fs/ext4/fast_commit.c
> @@ -604,13 +604,13 @@ void ext4_fc_track_range(handle_t *handle, struct inode *inode, ext4_lblk_t star
> trace_ext4_fc_track_range(inode, start, end, ret);
> }
>
> -static void ext4_fc_submit_bh(struct super_block *sb)
> +static void ext4_fc_submit_bh(struct super_block *sb, bool is_tail)
> {
> int write_flags = REQ_SYNC;
> struct buffer_head *bh = EXT4_SB(sb)->s_fc_bh;
>
> - /* TODO: REQ_FUA | REQ_PREFLUSH is unnecessarily expensive. */
> - if (test_opt(sb, BARRIER))
> + /* Add REQ_FUA | REQ_PREFLUSH only its tail */
> + if (test_opt(sb, BARRIER) && is_tail)
> write_flags |= REQ_FUA | REQ_PREFLUSH;
> lock_buffer(bh);
> set_buffer_dirty(bh);
> @@ -684,7 +684,7 @@ static u8 *ext4_fc_reserve_space(struct super_block *sb, int len, u32 *crc)
> *crc = ext4_chksum(sbi, *crc, tl, sizeof(*tl));
> if (pad_len > 0)
> ext4_fc_memzero(sb, tl + 1, pad_len, crc);
> - ext4_fc_submit_bh(sb);
> + ext4_fc_submit_bh(sb, false);
>
> ret = jbd2_fc_get_buf(EXT4_SB(sb)->s_journal, &bh);
> if (ret)
> @@ -741,7 +741,7 @@ static int ext4_fc_write_tail(struct super_block *sb, u32 crc)
> tail.fc_crc = cpu_to_le32(crc);
> ext4_fc_memcpy(sb, dst, &tail.fc_crc, sizeof(tail.fc_crc), NULL);
>
> - ext4_fc_submit_bh(sb);
> + ext4_fc_submit_bh(sb, true);
>
> return 0;
> }
> --
> 2.25.1
>
Powered by blists - more mailing lists