Re: [PATCH] ext4: Modify the rec_len helpers to accommodate future cases

From: Theodore Ts'o
Date: Thu Aug 17 2023 - 13:32:28 EST


On Mon, Aug 07, 2023 at 09:26:54AM +0800, zhangshida wrote:
> From: Shida Zhang <zhangshida@xxxxxxxxxx>
>
> Following Andreas' suggestion, it is time to adapt these helpers
> to handle larger records during runtime, especially in preparation
> for the eventual support of ext4 with a block size greater than
> PAGE_SIZE.

Is there a reason for landing this now? We don't have support for
block_size > PAGE_SIZE yet, and this patch doesn't come for free, at
least not systems with page_size < 64k. These inline functions are
*very* hot and get used in a large number of places. Have you looked
to see what it might do to text size of the ext4 code? And whether
the expansion to the icache might actually impact performance on CPU
bound workloads with very large directories?

I will note that there are some opportunities to optimize how often we
use ext4_rec_len_from_disk. For example, it gets called from
ext4_check_dir_entry(), and often the callers of that function will
need the directory record length. So having ext4_check_dir_entry()
optionally fill in the rec_len via a passed-in pointer might be
worthwhile.

Cheers,

- Ted