Re: [PATCH 2/2] ext4: correct the judgment of BUG in ext4_mb_normalize_request

From: Jan Kara
Date: Mon May 23 2022 - 17:08:15 EST


On Tue 24-05-22 01:38:44, Ritesh Harjani wrote:
> On 22/05/21 09:42PM, Baokun Li wrote:
> > When either of the "start + size <= ac->ac_o_ex.fe_logical" or
> > "start > ac->ac_o_ex.fe_logical" conditions is met, it indicates
> > that the fe_logical is not in the allocated range.
>
> Sounds about right to me based on the logic in ext4_mb_use_inode_pa().
> We try to allocate/preallocate such that ac->ac_o_ex.fe_logical should fall
> within the preallocated range. So if our start or start + size doesn't include
> fe_logical then it is a bug in the ext4_mb_normalize_request() logic.

I agree ac->ac_o_ex.fe_logical is a goal block. But AFAIK it never was a
hard guarantee that we would allocate extent that includes that block. It
was always treated as a hint only. In particular if you look at the logic
in ext4_mb_normalize_request() it does shift the start of the allocation to
avoid preallocated ranges etc. so I don't see how we are guaranteed that
ext4_mb_normalize_request() will result in an allocation request that
includes ac->ac_o_ex.fe_logical.

Honza

--
Jan Kara <jack@xxxxxxxx>
SUSE Labs, CR