From: Zhang Yi <yi.zhang@huawei.com>
To: Kemeng Shi <shikemeng@huaweicloud.com>
Cc: <linux-ext4@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<tytso@mit.edu>, <jack@suse.com>
Subject: Re: [PATCH v3 8/8] jbd2: remove unneeded check of ret in jbd2_fc_get_buf
Date: Wed, 31 Jul 2024 20:08:24 +0800 [thread overview]
Message-ID: <5567bcc4-08e4-9fae-df1d-10bda50efef4@huawei.com> (raw)
In-Reply-To: <20240731092910.2383048-9-shikemeng@huaweicloud.com>
On 2024/7/31 17:29, Kemeng Shi wrote:
> Simply return -EINVAL if j_fc_off is invalid to avoid repeated check of
> ret.
>
> Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>
> Reviewed-by: Jan Kara <jack@suse.cz>
Thanks, looks good to me.
Reviewed-by: Zhang Yi <yi.zhang@huawei.com>
> ---
> fs/jbd2/journal.c | 16 +++++-----------
> 1 file changed, 5 insertions(+), 11 deletions(-)
>
> diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
> index e89d777ded34..c5179aa38111 100644
> --- a/fs/jbd2/journal.c
> +++ b/fs/jbd2/journal.c
> @@ -837,17 +837,12 @@ int jbd2_fc_get_buf(journal_t *journal, struct buffer_head **bh_out)
>
> *bh_out = NULL;
>
> - if (journal->j_fc_off + journal->j_fc_first < journal->j_fc_last) {
> - fc_off = journal->j_fc_off;
> - blocknr = journal->j_fc_first + fc_off;
> - journal->j_fc_off++;
> - } else {
> - ret = -EINVAL;
> - }
> -
> - if (ret)
> - return ret;
> + if (journal->j_fc_off + journal->j_fc_first >= journal->j_fc_last)
> + return -EINVAL;
>
> + fc_off = journal->j_fc_off;
> + blocknr = journal->j_fc_first + fc_off;
> + journal->j_fc_off++;
> ret = jbd2_journal_bmap(journal, blocknr, &pblock);
> if (ret)
> return ret;
> @@ -856,7 +851,6 @@ int jbd2_fc_get_buf(journal_t *journal, struct buffer_head **bh_out)
> if (!bh)
> return -ENOMEM;
>
> -
> journal->j_fc_wbuf[fc_off] = bh;
>
> *bh_out = bh;
>
prev parent reply other threads:[~2024-07-31 12:08 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-31 9:29 [PATCH v3 0/8] Fix and cleanups to jbd2 Kemeng Shi
2024-07-31 9:29 ` [PATCH v3 1/8] jbd2: correctly compare tids with tid_geq function in jbd2_fc_begin_commit Kemeng Shi
2024-07-31 9:29 ` [PATCH v3 2/8] jbd2: remove dead check in journal_alloc_journal_head Kemeng Shi
2024-07-31 9:29 ` [PATCH v3 3/8] jbd2: remove unused return value of jbd2_fc_release_bufs Kemeng Shi
2024-07-31 9:29 ` [PATCH v3 4/8] jbd2: remove unneeded kmap for jh_in->b_frozen_data in jbd2_journal_write_metadata_buffer Kemeng Shi
2024-07-31 11:54 ` Zhang Yi
2024-07-31 9:29 ` [PATCH v3 5/8] jbd2: remove unneeded done_copy_out variable " Kemeng Shi
2024-07-31 11:57 ` Zhang Yi
2024-07-31 9:29 ` [PATCH v3 6/8] ext4: move escape handle to futher improve jbd2_journal_write_metadata_buffer Kemeng Shi
2024-07-31 12:07 ` Zhang Yi
2024-07-31 12:17 ` Zhang Yi
2024-08-01 1:24 ` Kemeng Shi
2024-08-07 7:41 ` wangjianjian (C)
2024-08-08 5:30 ` Kemeng Shi
2024-07-31 9:29 ` [PATCH v3 7/8] jbd2: correct comment jbd2_mark_journal_empty Kemeng Shi
2024-07-31 9:29 ` [PATCH v3 8/8] jbd2: remove unneeded check of ret in jbd2_fc_get_buf Kemeng Shi
2024-07-31 12:08 ` Zhang Yi [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5567bcc4-08e4-9fae-df1d-10bda50efef4@huawei.com \
--to=yi.zhang@huawei.com \
--cc=jack@suse.com \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=shikemeng@huaweicloud.com \
--cc=tytso@mit.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®