[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e575a8e9-5a90-6fc7-62eb-ee3f433bc687@huaweicloud.com>
Date: Tue, 24 Dec 2024 20:09:43 +0800
From: Kemeng Shi <shikemeng@...weicloud.com>
To: Andreas Dilger <adilger@...ger.ca>
Cc: Theodore Ts'o <tytso@....edu>,
Ext4 Developers List <linux-ext4@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 2/6] ext4: remove unneeded bits mask in dx_get_block()
on 12/20/2024 9:10 AM, Andreas Dilger wrote:
> On Dec 19, 2024, at 4:00 AM, Kemeng Shi <shikemeng@...weicloud.com> wrote:
>>
>> As high four bits of block in dx_entry is not used by any feature for now, we can remove unneeded bits mask in dx_get_block() and add it back
>> when it's really needed.
>
> Actually, the opposite is true. This mask protects the *CURRENT* code
> from any future use for these bits, so removing it now means that they
> could never be used in the future, since the block number would be
> taken as all 32 bits instead of only the bottom 28 bits. I don't think
> we are in any danger of having a 16TB single directory any time soon.
>
> However, the top bits were intended to store a "fullness" for the index
> blocks, to optimize online directory shrinking without having to scan
> each of the blocks for how many entries are currently in the block.
> This would allow the dirent removal to easily see "this block and the
> previous/next block are only 1/3 full and could be merged".
>
> See the following thread for a prototype patch and discussion on this:
> https://patchwork.ozlabs.org/project/linux-ext4/patch/20190821182740.97127-1-harshadshirwadkar@gmail.com/
>
> I think removing this mask has a negative effect on future usefulness,
> and virtually no benefit to the code today, so I would object to landing
> it.
Sure, it makes sense to reserve bit for future use if it will likely be
used. But I wonder would it be better to catch using high four bits in
in ext4_append() in which case we could forbit using high four bits in
time rather than lost dir when reserved bits are really used in future.
This also reduce cpu cost as dx_get_block() is used likely more frequent
than ext4_append().
Just a thought.
Thanks,
Kemeng
Powered by blists - more mailing lists