[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <44c2226a02f3b4edacc5875c3bbfc2d308664433.1735912719.git.christophe.jaillet@wanadoo.fr>
Date: Fri, 3 Jan 2025 14:59:17 +0100
From: Christophe JAILLET <christophe.jaillet@...adoo.fr>
To: "Theodore Ts'o" <tytso@....edu>,
Andreas Dilger <adilger.kernel@...ger.ca>
Cc: linux-kernel@...r.kernel.org,
kernel-janitors@...r.kernel.org,
Christophe JAILLET <christophe.jaillet@...adoo.fr>,
linux-ext4@...r.kernel.org
Subject: [PATCH 2/3] ext4: Remove some useless assignments in ext4_mb_init_cache()
'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@...adoo.fr>
---
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
Powered by blists - more mailing lists