diff options
author | Kemeng Shi <shikemeng@huaweicloud.com> | 2024-08-01 09:38:15 +0800 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2024-08-26 23:49:15 -0400 |
commit | 6140ceb9b224fd178f405a7805d3fd82d2d02c39 (patch) | |
tree | 9496e67243bbf8e43833140991a6fb43ba0768a9 /fs/jbd2 | |
parent | 1862304b062acb15e05b4e51270dc92de4b7635b (diff) |
jbd2: remove unneeded check of ret in jbd2_fc_get_buf
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>
Reviewed-by: Zhang Yi <yi.zhang@huawei.com>
Link: https://patch.msgid.link/20240801013815.2393869-9-shikemeng@huaweicloud.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'fs/jbd2')
-rw-r--r-- | fs/jbd2/journal.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c index 7b78c0afa09f..97f487c3d8fc 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; |