Re: [PATCH] ntfs: keep i_size of a directory equal to its index root

From: Hyunchul Lee

Date: Wed Nov 25 2026 - 21:01:14 EST


Hi Showta,

> diff --git a/fs/ntfs/index.c b/fs/ntfs/index.c
> index fe2a79b..73c8e6f 100644
> --- a/fs/ntfs/index.c
> +++ b/fs/ntfs/index.c
> @@ -1434,6 +1434,8 @@ retry:
> icx->idx_ni->data_size = ix_root_size;
> icx->idx_ni->initialized_size = ix_root_size;
> icx->idx_ni->allocated_size = (ix_root_size + 7) & ~7;
> + /* As ntfs_ir_truncate() does; i_size kept the old length. */

Could you remove this comment?

> @@ -611,6 +611,13 @@ static struct ntfs_inode *__ntfs_create(const struct mnt_idmap *idmap, struct in
> err = ntfs_attr_open(ni, AT_INDEX_ROOT, I30, 4);
> if (err)
> goto err_out;
> + /*
> + * ntfs_attr_open() sets data_size to the length of the new
> + * $INDEX_ROOT, as ntfs_read_locked_inode() does with i_size
> + * too. i_size stayed at the 0 set above, so stat() gave 0
> + * until the directory was read back from disk.
> + */

Please remove this one as well.

> + i_size_write(vi, ni->data_size);
> } else {
> /* Add DATA attribute to inode. */
> err = ntfs_attr_add(ni, AT_DATA, AT_UNNAMED, 0, NULL, 0);
> --
> 2.54.0 (Apple Git-157)
>

--
Thanks,
Hyunchul