]> git.ipfire.org Git - thirdparty/linux.git/commit
ext4: mark inode format migration fast-commit ineligible
authorLi Chen <me@linux.beauty>
Thu, 11 Dec 2025 11:51:38 +0000 (19:51 +0800)
committerTheodore Ts'o <tytso@mit.edu>
Tue, 20 Jan 2026 00:26:35 +0000 (19:26 -0500)
commit87e79fa122bc9a6576f1690ee264fcbd77d3ab58
tree2607463d70c8c8d883b351e5b6abacb72d46d579
parentd518215c27194486fe13136a8dbbbabeefb5c9b6
ext4: mark inode format migration fast-commit ineligible

Fast commits only log operations that have dedicated replay support.
Inode format migration (indirect<->extent layout changes via
EXT4_IOC_MIGRATE or toggling EXT4_EXTENTS_FL) rewrites the block mapping
representation without going through the fast commit tracking paths.
In practice these migrations are rare and usually followed by further
updates, but mixing them into a fast commit makes the overall semantics
harder to reason about and risks replay gaps if new call sites appear.

Teach ext4 to mark the filesystem fast-commit ineligible when
ext4_ext_migrate() or ext4_ind_migrate() start their journal transactions.
This forces those transactions to fall back to a full commit, ensuring
that the entire inode layout change is captured by the normal journal
rather than partially encoded in fast commit TLVs. This change should
not affect common workloads but makes format migrations safer and easier
to reason about under fast commit.

Testing:
1. prepare:
    dd if=/dev/zero of=/root/fc.img bs=1M count=0 seek=128
    mkfs.ext4 -O fast_commit -F /root/fc.img
    mkdir -p /mnt/fc && mount -t ext4 -o loop /root/fc.img /mnt/fc
2.  Created a test file and toggled the extents flag to exercise both
    ext4_ind_migrate() and ext4_ext_migrate():
    touch /mnt/fc/migtest
    chattr -e /mnt/fc/migtest
    chattr +e /mnt/fc/migtest
3. Verified fast-commit ineligible statistics:
    tail -n 1 /proc/fs/ext4/loop0/fc_info
    "Inode format migration":       2

Signed-off-by: Li Chen <me@linux.beauty>
Link: https://patch.msgid.link/20251211115146.897420-2-me@linux.beauty
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs/ext4/fast_commit.c
fs/ext4/fast_commit.h
fs/ext4/migrate.c
include/trace/events/ext4.h