summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorEric Whitney <enwlinux@gmail.com>2020-03-11 16:51:25 -0400
committerTheodore Ts'o <tytso@mit.edu>2020-03-14 14:43:14 -0400
commit2971148d0fecedcbd594ff2f2784496bdc7a7ffa (patch)
tree721667f7bf34e42044f5da5411fb007761755960 /fs
parent34990461342fc9aba806bd941653b72c89dd73a2 (diff)
downloadlinux-2971148d0fecedcbd594ff2f2784496bdc7a7ffa.tar.gz
linux-2971148d0fecedcbd594ff2f2784496bdc7a7ffa.tar.bz2
linux-2971148d0fecedcbd594ff2f2784496bdc7a7ffa.zip
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 <riteshh@linux.ibm.com> Signed-off-by: Eric Whitney <enwlinux@gmail.com> Link: https://lore.kernel.org/r/20200311205125.25061-1-enwlinux@gmail.com Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'fs')
-rw-r--r--fs/ext4/extents.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index a1342caad01d..0e86bc611f07 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -4033,7 +4033,6 @@ int ext4_ext_map_blocks(handle_t *handle, struct inode *inode,
unsigned int allocated_clusters = 0;
struct ext4_allocation_request ar;
ext4_lblk_t cluster_offset;
- bool map_from_cluster = false;
ext_debug("blocks %u/%u requested for inode %lu\n",
map->m_lblk, map->m_len, inode->i_ino);
@@ -4148,7 +4147,6 @@ int ext4_ext_map_blocks(handle_t *handle, struct inode *inode,
get_implied_cluster_alloc(inode->i_sb, map, ex, path)) {
ar.len = allocated = map->m_len;
newblock = map->m_pblk;
- map_from_cluster = true;
goto got_allocated_blocks;
}
@@ -4169,7 +4167,6 @@ int ext4_ext_map_blocks(handle_t *handle, struct inode *inode,
get_implied_cluster_alloc(inode->i_sb, map, ex2, path)) {
ar.len = allocated = map->m_len;
newblock = map->m_pblk;
- map_from_cluster = true;
goto got_allocated_blocks;
}
@@ -4274,7 +4271,7 @@ got_allocated_blocks:
* clusters discovered to be delayed allocated. Once allocated, a
* cluster is not included in the reserved count.
*/
- if (test_opt(inode->i_sb, DELALLOC) && !map_from_cluster) {
+ if (test_opt(inode->i_sb, DELALLOC) && allocated_clusters) {
if (flags & EXT4_GET_BLOCKS_DELALLOC_RESERVE) {
/*
* When allocating delayed allocated clusters, simply