Skip to content

Commit 2971148

Browse files
Eric Whitneytytso
authored andcommitted
ext4: remove map_from_cluster from ext4_ext_map_blocks
We can use the variable allocated_clusters rather than map_from_clusters to control reserved block/cluster accounting in ext4_ext_map_blocks. This eliminates a variable and associated code and improves readability a little. Reviewed-by: Ritesh Harjani <[email protected]> Signed-off-by: Eric Whitney <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Theodore Ts'o <[email protected]>
1 parent 3499046 commit 2971148

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

fs/ext4/extents.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4033,7 +4033,6 @@ int ext4_ext_map_blocks(handle_t *handle, struct inode *inode,
40334033
unsigned int allocated_clusters = 0;
40344034
struct ext4_allocation_request ar;
40354035
ext4_lblk_t cluster_offset;
4036-
bool map_from_cluster = false;
40374036

40384037
ext_debug("blocks %u/%u requested for inode %lu\n",
40394038
map->m_lblk, map->m_len, inode->i_ino);
@@ -4148,7 +4147,6 @@ int ext4_ext_map_blocks(handle_t *handle, struct inode *inode,
41484147
get_implied_cluster_alloc(inode->i_sb, map, ex, path)) {
41494148
ar.len = allocated = map->m_len;
41504149
newblock = map->m_pblk;
4151-
map_from_cluster = true;
41524150
goto got_allocated_blocks;
41534151
}
41544152

@@ -4169,7 +4167,6 @@ int ext4_ext_map_blocks(handle_t *handle, struct inode *inode,
41694167
get_implied_cluster_alloc(inode->i_sb, map, ex2, path)) {
41704168
ar.len = allocated = map->m_len;
41714169
newblock = map->m_pblk;
4172-
map_from_cluster = true;
41734170
goto got_allocated_blocks;
41744171
}
41754172

@@ -4274,7 +4271,7 @@ int ext4_ext_map_blocks(handle_t *handle, struct inode *inode,
42744271
* clusters discovered to be delayed allocated. Once allocated, a
42754272
* cluster is not included in the reserved count.
42764273
*/
4277-
if (test_opt(inode->i_sb, DELALLOC) && !map_from_cluster) {
4274+
if (test_opt(inode->i_sb, DELALLOC) && allocated_clusters) {
42784275
if (flags & EXT4_GET_BLOCKS_DELALLOC_RESERVE) {
42794276
/*
42804277
* When allocating delayed allocated clusters, simply

0 commit comments

Comments
 (0)