[PATCH v6 00/11] Data in direntry (dirdata) feature

Artem Blagodarenko <[email protected]> Mon, 27 Jul 2026 17:11:12 -0400
Newsgroups org.kernel.vger.linux-ext4
Message-ID <[email protected]>
EXT4 currently stores an 8-byte hash in the directory entry immediately
after the file name to support simultaneous fscrypt and casefold
functionality.

The dirdata feature provides a general mechanism to store multiple
metadata records in each directory entry after the NUL filename
terminator. The unused high 4 bits of 'file_type' indicate which
records are present; each record starts with a 1-byte length field,
providing forward compatibility.

The first user of this feature is LUFID (Locally Unique File ID), an
identifier that must survive rename and be accessible from directory
readdir without an inode lookup.

e2fsprogs support is provided in a separate patch series.

Thanks to Sashiko AI review for identifying several correctness and
safety issues in earlier versions of this series.

Changes in v6:

Patch 09 (LUFID rename support): replace the unconditional kmemdup()
in ext4_lufid_snapshot() with a small inline buffer
(EXT4_LUFID_INLINE_SIZE = 65 bytes: 1-byte header + 4 × 16-byte FIDs),
falling back to heap allocation only when the LUFID payload exceeds that
limit (ddh_length is u8 so the maximum is 255 bytes). Introduce struct
ext4_lufid_snap and ext4_lufid_snap_release() so callers are
storage-agnostic; the two-snapshot case in ext4_cross_rename() now
avoids both heap allocations in the common case.

Artem Blagodarenko (11):
  ext4: validate count against limit in ext4_dx_csum_verify/_set
  ext4: replace ext4_dir_entry with ext4_dir_entry_2
  ext4: add ext4_dir_entry_is_tail()
  ext4: refactor dx_root to support variable dirent sizes
  ext4: add dirdata format definitions and access helpers
  ext4: add ext4_dir_entry_len()
  ext4: rename ext4_dir_rec_len() and clarify dirdata usage
  ext4: dirdata feature
  ext4: add dirdata LUFID support for directory entry rename
  ext4: add dirdata set/get helpers
  ext4: Add EXT4_IOC_SET_LUFID ioctl for setting LUFID on directory
    entries

 fs/ext4/dir.c             |  33 +-
 fs/ext4/ext4.h            | 235 ++++++++-
 fs/ext4/fast_commit.c     |   1 +
 fs/ext4/fast_commit.h     |   1 +
 fs/ext4/inline.c          |  49 +-
 fs/ext4/ioctl.c           |  84 ++++
 fs/ext4/namei.c           | 974 +++++++++++++++++++++++++++++++-------
 fs/ext4/sysfs.c           |   2 +
 include/uapi/linux/ext4.h |  14 +
 9 files changed, 1168 insertions(+), 225 deletions(-)

-- 
2.43.7