ext4: remove repeat assignment to ac_f_ex
authorKemeng Shi <shikemeng@huaweicloud.com>
Fri, 3 Mar 2023 17:21:18 +0000 (01:21 +0800)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 6 Apr 2023 05:13:12 +0000 (01:13 -0400)
Call trace to assign ac_f_ex:
ext4_mb_use_best_found
ac->ac_f_ex = ac->ac_b_ex;
ext4_mb_new_preallocation
ext4_mb_new_group_pa
ac->ac_f_ex = ac->ac_b_ex;
ext4_mb_new_inode_pa
ac->ac_f_ex = ac->ac_b_ex;

Actually allocated blocks is already stored in ac_f_ex in
ext4_mb_use_best_found, so there is no need to assign ac_f_ex
in ext4_mb_new_group_pa and ext4_mb_new_inode_pa.
Just remove repeat assignment to ac_f_ex in ext4_mb_new_group_pa
and ext4_mb_new_inode_pa.

Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>
Reviewed-by: Ojaswin Mujoo <ojaswin@linux.ibm.com>
Link: https://lore.kernel.org/r/20230303172120.3800725-19-shikemeng@huaweicloud.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs/ext4/mballoc.c

index 4136e53341c33d6869bd3f166e8aae552c8d0fc7..59aa42457fcaa96353d83f5b5894af3535e59118 100644 (file)
@@ -4636,10 +4636,6 @@ ext4_mb_new_inode_pa(struct ext4_allocation_context *ac)
                BUG_ON(ac->ac_o_ex.fe_len > ac->ac_b_ex.fe_len);
        }
 
-       /* preallocation can change ac_b_ex, thus we store actually
-        * allocated blocks for history */
-       ac->ac_f_ex = ac->ac_b_ex;
-
        pa->pa_lstart = ac->ac_b_ex.fe_logical;
        pa->pa_pstart = ext4_grp_offs_to_block(sb, &ac->ac_b_ex);
        pa->pa_len = ac->ac_b_ex.fe_len;
@@ -4690,10 +4686,6 @@ ext4_mb_new_group_pa(struct ext4_allocation_context *ac)
 
        pa = ac->ac_pa;
 
-       /* preallocation can change ac_b_ex, thus we store actually
-        * allocated blocks for history */
-       ac->ac_f_ex = ac->ac_b_ex;
-
        pa->pa_pstart = ext4_grp_offs_to_block(sb, &ac->ac_b_ex);
        pa->pa_lstart = pa->pa_pstart;
        pa->pa_len = ac->ac_b_ex.fe_len;