Re: [PATCH v2 2/2] ext4: get ext4_group_desc in ext4_mb_prefetch only when necessary

From: Andreas Dilger

Date: Wed May 27 2026 - 15:53:00 EST


On May 27, 2026, at 03:03, Bohdan Trach <bohdan.trach@xxxxxxxxxxxxxxx> wrote:
>
> Getting ext4_group_desc structure can contribute to the cost of
> ext4_mb_prefetch() without any need, as most groups fail the
> !EXT4_MB_GRP_TEST_AND_SET_READ check.
>
> Optimize ext4_mb_prefetch by getting the group description only when
> necessary.
>
> The result is further increase in performance of fallocate() system call
> path that triggers ext4_mb_prefetch() via a linear group scan.
>
> Signed-off-by: Bohdan Trach <bohdan.trach@xxxxxxxxxxxxxxx>
> Reviewed-by: Jan Kara <jack@xxxxxxx>

This looks reasonable, and is independent of the EXT4_MB_GRP_TEST_AND_SET_READ()
micro-optimization in the 1/2 patch.

Reviewed-by: Andreas Dilger <adilger@xxxxxxxxx <mailto:adilger@xxxxxxxxx>>

Cheers, Andreas