Skip to contentSkip to conversation

ext4: remove unnecessary duplicate check in ext4_map_blocks()

PATCH In review Dan Carpenter 2 participants 2 messages May 23, 2025 – May 24, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ext4: remove unnecessary duplicate check in ext4_map_blocks()

The previous lines ensure that EXT4_GET_BLOCKS_QUERY_LAST_IN_LEAF is set so remove this duplicate check.

---
 fs/ext4/inode.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
fs/ext4/inode.c +1 -2
index be9a4cba35fd..014021019b22 100644
@@ -757,8 +757,7 @@ int ext4_map_blocks(handle_t *handle, struct inode *inode,
 				orig_mlen == map->m_len)
 			goto found;
 
-		if (flags & EXT4_GET_BLOCKS_QUERY_LAST_IN_LEAF)
-			map->m_len = orig_mlen;
+		map->m_len = orig_mlen;
 	}
 	/*
 	 * In the query cache no-wait mode, nothing we can do more if we
Signature · 1 line
2.47.2
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 3 lines · Dan Carpenter

The previous lines ensure that EXT4_GET_BLOCKS_QUERY_LAST_IN_LEAF is set so remove this duplicate check.

Earlier, I knew it was a redundant check, but I went ahead with it anyway; and later, I might have missed removing it. I agree that we don’t really need this extra check.

So, the patch looks good to me. Thanks for taking care of it!

Please feel free to add:

Quoted 21 lines
---
 fs/ext4/inode.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
fs/ext4/inode.c +1 -2
index be9a4cba35fd..014021019b22 100644
@@ -757,8 +757,7 @@ int ext4_map_blocks(handle_t *handle, struct inode *inode,
 				orig_mlen == map->m_len)
 			goto found;
 
-		if (flags & EXT4_GET_BLOCKS_QUERY_LAST_IN_LEAF)
-			map->m_len = orig_mlen;
+		map->m_len = orig_mlen;
 	}
 	/*
 	 * In the query cache no-wait mode, nothing we can do more if we
Signature · 1 line
2.47.2