]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
jbd2: store jinode dirty range in PAGE_SIZE units
authorLi Chen <me@linux.beauty>
Fri, 6 Mar 2026 08:56:42 +0000 (16:56 +0800)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 9 Apr 2026 14:52:35 +0000 (10:52 -0400)
commit4edafa81a1d6020272d0c6eb68faeb810dd083c1
tree9c18d55cab73708fde3160a28c15df18282169ba
parentbe81084e032c2d74f51173e30f687ce13476cb73
jbd2: store jinode dirty range in PAGE_SIZE units

jbd2_inode fields are updated under journal->j_list_lock, but some paths
read them without holding the lock (e.g. fast commit helpers and ordered
truncate helpers).

READ_ONCE() alone is not sufficient for the dirty range fields when they
are stored as loff_t because 32-bit platforms can observe torn loads.
Store the dirty range in PAGE_SIZE units as pgoff_t instead.

Represent the dirty range end as an exclusive end page. This avoids a
special sentinel value and keeps MAX_LFS_FILESIZE on 32-bit representable.

Publish a new dirty range by updating end_page before start_page, and
treat start_page >= end_page as empty in the accessor for robustness.

Use READ_ONCE() on the read side and WRITE_ONCE() on the write side for the
dirty range and i_flags to match the existing lockless access pattern.

Suggested-by: Jan Kara <jack@suse.cz>
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Li Chen <me@linux.beauty>
Link: https://patch.msgid.link/20260306085643.465275-5-me@linux.beauty
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs/jbd2/commit.c
fs/jbd2/journal.c
fs/jbd2/transaction.c
include/linux/jbd2.h