[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150810213416.GB31724@mwanda>
Date: Tue, 11 Aug 2015 00:34:17 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: "Theodore Ts'o" <tytso@....edu>
Cc: Andreas Dilger <adilger.kernel@...ger.ca>,
linux-ext4@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: [patch] ext4: simplify some code in read_mmp_block()
My static checker complains because it is not necessary to test
"if (*bh)" when we just tested "if (!*bh)" on the lines before.
We can remove the condition and pull everything in one indent level.
Then we have another "if (unlikely(!*bh))" check and the only way that
can be true is if the "if (!buffer_uptodate(*bh))" condition was true so
we can combine them together.
Signed-off-by: Dan Carpenter <dan.carpenter@...cle.com>
diff --git a/fs/ext4/mmp.c b/fs/ext4/mmp.c
index 8313ca3..736f12e 100644
--- a/fs/ext4/mmp.c
+++ b/fs/ext4/mmp.c
@@ -80,18 +80,15 @@ static int read_mmp_block(struct super_block *sb, struct buffer_head **bh,
*bh = sb_getblk(sb, mmp_block);
if (!*bh)
return -ENOMEM;
- if (*bh) {
- get_bh(*bh);
- lock_buffer(*bh);
- (*bh)->b_end_io = end_buffer_read_sync;
- submit_bh(READ_SYNC | REQ_META | REQ_PRIO, *bh);
- wait_on_buffer(*bh);
- if (!buffer_uptodate(*bh)) {
- brelse(*bh);
- *bh = NULL;
- }
- }
- if (unlikely(!*bh)) {
+
+ get_bh(*bh);
+ lock_buffer(*bh);
+ (*bh)->b_end_io = end_buffer_read_sync;
+ submit_bh(READ_SYNC | REQ_META | REQ_PRIO, *bh);
+ wait_on_buffer(*bh);
+ if (!buffer_uptodate(*bh)) {
+ brelse(*bh);
+ *bh = NULL;
ext4_warning(sb, "Error while reading MMP block %llu",
mmp_block);
return -EIO;
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists