]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
ext4: use optimized mballoc scanning regardless of inode format
authorJan Kara <jack@suse.cz>
Wed, 14 Jan 2026 18:28:19 +0000 (19:28 +0100)
committerTheodore Ts'o <tytso@mit.edu>
Tue, 20 Jan 2026 03:54:58 +0000 (22:54 -0500)
Currently we don't used mballoc optimized scanning (using max free
extent order and avg free extent order group lists) for inodes with
indirect block based format. This is confusing for users and I don't see
a good reason for that. Even with indirect block based inode format we
can spend big amount of time searching for free blocks for large
filesystems with fragmented free space. To add to the confusion before
commit 077d0c2c78df ("ext4: make mb_optimize_scan performance mount
option work with extents") optimized scanning was applied *only* to
indirect block based inodes so that commit appears as a performance
regression to some users. Just use optimized scanning whenever it is
enabled by mount options.

Reviewed-by: Baokun Li <libaokun1@huawei.com>
Reviewed-by: Zhang Yi <yi.zhang@huawei.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Cc: stable@kernel.org
Link: https://patch.msgid.link/20260114182836.14120-4-jack@suse.cz
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs/ext4/mballoc.c

index 910b454b4a21e08cef8de0b5646ef89046ec0369..dbc82b65f810fed89da7fa7149d3a05de6f107d6 100644 (file)
@@ -1148,8 +1148,6 @@ static inline int should_optimize_scan(struct ext4_allocation_context *ac)
                return 0;
        if (ac->ac_criteria >= CR_GOAL_LEN_SLOW)
                return 0;
-       if (!ext4_test_inode_flag(ac->ac_inode, EXT4_INODE_EXTENTS))
-               return 0;
        return 1;
 }