[PATCH 2/3] ext4: Remove some useless assignments in ext4_mb_init_cache()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



'bh' assigned an address early in the function and is not used before that.
So the initial NULL assignment can be removed.

Also, if folio_test_uptodate() fails, there is no need to set it to NULL.
'bh' being either kzalloc()'ed or assigned &bhs which is already NULL,
bh[i] is known to be already NULL.

This makes the code more consistent with the other tests above that don't
set this value to NULL.

Signed-off-by: Christophe JAILLET <christophe.jaillet@xxxxxxxxxx>
---
Compile tested only.
---
 fs/ext4/mballoc.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index ff9a124f439b..e536c0e35ca8 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -1286,7 +1286,7 @@ static int ext4_mb_init_cache(struct folio *folio, char *incore, gfp_t gfp)
 	int first_block;
 	struct super_block *sb;
 	struct buffer_head *bhs = NULL;
-	struct buffer_head **bh = NULL;
+	struct buffer_head **bh;
 	struct inode *inode;
 	char *data;
 	char *bitmap;
@@ -1330,10 +1330,9 @@ static int ext4_mb_init_cache(struct folio *folio, char *incore, gfp_t gfp)
 		 * which may be currently in use by an allocating task.
 		 */
 		if (folio_test_uptodate(folio) &&
-				!EXT4_MB_GRP_NEED_INIT(grinfo)) {
-			bh[i] = NULL;
+				!EXT4_MB_GRP_NEED_INIT(grinfo))
 			continue;
-		}
+
 		bh[i] = ext4_read_block_bitmap_nowait(sb, group, false);
 		if (IS_ERR(bh[i])) {
 			err = PTR_ERR(bh[i]);
-- 
2.47.1





[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux