Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Kemeng Shi and committed by
Theodore Ts'o
6140ceb9 1862304b

+5 -11
+5 -11
fs/jbd2/journal.c
··· 837 837 838 838 *bh_out = NULL; 839 839 840 - if (journal->j_fc_off + journal->j_fc_first < journal->j_fc_last) { 841 - fc_off = journal->j_fc_off; 842 - blocknr = journal->j_fc_first + fc_off; 843 - journal->j_fc_off++; 844 - } else { 845 - ret = -EINVAL; 846 - } 840 + if (journal->j_fc_off + journal->j_fc_first >= journal->j_fc_last) 841 + return -EINVAL; 847 842 848 - if (ret) 849 - return ret; 850 - 843 + fc_off = journal->j_fc_off; 844 + blocknr = journal->j_fc_first + fc_off; 845 + journal->j_fc_off++; 851 846 ret = jbd2_journal_bmap(journal, blocknr, &pblock); 852 847 if (ret) 853 848 return ret; ··· 850 855 bh = __getblk(journal->j_dev, pblock, journal->j_blocksize); 851 856 if (!bh) 852 857 return -ENOMEM; 853 - 854 858 855 859 journal->j_fc_wbuf[fc_off] = bh; 856 860