ext4_mb_use_preallocated will ignore the demand to alloc at goal block only. Return false if EXT4_MB_HINT_GOAL_ONLY is set before use preallocated blocks in ext4_mb_use_preallocated. Signed-off-by: Kemeng Shi <shikemeng@xxxxxxxxxxxxxxx> --- fs/ext4/mballoc.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index 375d9655b525..352ac9139fee 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c @@ -4368,6 +4368,9 @@ ext4_mb_use_preallocated(struct ext4_allocation_context *ac) if (!(ac->ac_flags & EXT4_MB_HINT_DATA)) return false; + if (unlikely(ac->ac_flags & EXT4_MB_HINT_GOAL_ONLY)) + return false; + /* first, try per-file preallocation */ rcu_read_lock(); list_for_each_entry_rcu(pa, &ei->i_prealloc_list, pa_inode_list) { -- 2.30.0