Hi Heinrich,

On 2026-10-12T14:00:39, Heinrich Schuchardt
<[email protected]> wrote:
> fs: ext4: don't read time fields in XPL
>
> The ext4 readdir implementation populates dent time fields in XML
> builds though that information is never used.

Typo: 'XML' should be 'xPL'. Please can you also give the motivation?
Presumably it is the code-size saving in SPL. Do you have a figure?

> Guard the three rtc_to_tm() calls with !IS_ENABLED(CONFIG_XPL_BUILD),
> consistent with the FAT driver.

The patch also adds le32_to_cpu() to each of the three fields. That
fixes a real bug on big-endian hosts, since the struct ext2_inode
members are __le32. Please can you mention it here, or put it in its
own patch? It is currently hidden behind the subject.

>
> Guard the three rtc_to_tm() calls with !IS_ENABLED(CONFIG_XPL_BUILD),
> consistent with the FAT driver.
>
> Signed-off-by: Heinrich Schuchardt <[email protected]>
>
> fs/ext4/ext4fs.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)

> diff --git a/fs/ext4/ext4fs.c b/fs/ext4/ext4fs.c
> @@ -319,9 +319,11 @@ int ext4fs_readdir(struct fs_dir_stream *fs_dirs, struct 
> fs_dirent **dentp)
> +             rtc_to_tm(le32_to_cpu(fdiro.inode.ctime), &dent->create_time);

Your next patch points out that i_ctime is the inode change time, not
the creation time, yet here it is copied into create_time. Since you
are touching this line, should create_time be left zeroed, or filled
from i_crtime when the inode is large enough? What do you think?

> dirs->fpos += le16_to_cpu(dirent.direntlen);
>       dent->size = fdiro.inode.size;

BTW, the line below has the same endianness problem: 'size' is __le32
and is used without le32_to_cpu(). It also ignores size_high, so files
of 4GB or more show the wrong size in ls. Not for this patch, but it
may be worth a follow-up.

Regards,
Simon

Reply via email to