2024-02-01 11:46:53

by Jan Kara

[permalink] [raw]
Subject: Re: [PATCH] ext4: correct best extent lstart adjustment logic

Hi guys!

On Thu 01-02-24 16:38:33, Ojaswin Mujoo wrote:
> Thanks for the CC, I somehow missed this patch.
>
> As described in the discussion Jan linked [1] , there is a known bug in the
> normalize code (which i should probably get back to now ) where we sometimes
> end up with a goal range which doesn't completely cover the original extent and
> this was causing issues when we tried to cover the complete original request in
> the PA window adjustment logic. That and to minimize fragmentation, we ended up
> going with the logic we have right now.
>
> In short, I agree that in the example Baokun pointed out, it is not
> optimal to have to make an allocation request twice when we can get it in
> one go.
>
> I also think Baokun is correct that if keeping the best extent at the end
> doesn't cover the original start, then any other case should not lead to
> it overflowing out of goal extent, including the case where original
> extent is overflowing goal extent.

Right, it was not obvious to me yesterday but when I've now reread how the
normalization shifts the goal window, it is obvious.

> So, as mentioned, it boils down to a trade off between multiple allocations and slightly
> increased fragmentation. iiuc preallocations are anyways dropped when the file closes
> so I think it shouldn't hurt too much fragmentation wise to prioritize less
> allocations. What are your thoughts on this Jan, Baokun?

OK, I'm fine with the Baokun's change if we remove the problematic BUG_ON.

Honza
--
Jan Kara <[email protected]>
SUSE Labs, CR