Thread (7 messages) 7 messages, 3 authors, 2025-01-07
STALE560d

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

From: Christophe JAILLET <hidden>
Date: 2025-01-03 14:00:44
Also in: kernel-janitors, lkml
Subsystem: ext4 file system, filesystems (vfs and infrastructure), the rest · Maintainers: "Theodore Ts'o", Alexander Viro, Christian Brauner, Linus Torvalds

'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 <redacted>
---
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help