summaryrefslogtreecommitdiff
path: root/scripts/Makefile.thinlto
diff options
context:
space:
mode:
authorZhang Yi <yi.zhang@huawei.com>2026-10-09 18:30:14 +0800
committerTheodore Ts'o <tytso@mit.edu>2026-10-15 10:53:12 -0400
commit0a6f584e91f4a65f54d4d4c4876e3e6e12977955 (patch)
treed1f4d1c73948b6419a0598afbe3722e3b852130f /scripts/Makefile.thinlto
parent3e28cc4432fe59f0957de775fe4903a860f7b6ef (diff)
downloadlinux-0a6f584e91f4a65f54d4d4c4876e3e6e12977955.tar.gz
linux-0a6f584e91f4a65f54d4d4c4876e3e6e12977955.zip
ext4: implement buffered write path using iomap
Introduce two new iomap_ops instances for ext4 buffered writes: - ext4_iomap_buffered_da_write_ops: for delayed allocation mode, using ext4_da_map_blocks() to map delalloc extents. - ext4_iomap_buffered_write_ops: for non-delayed allocation mode, using ext4_map_blocks() to directly allocate blocks. Also add ext4_iomap_valid() for the iomap infrastructure to check extent validity. This is useful for the iomap buffered write path because it does not hold the folio lock between mapping the inode extent and copying data. So it can race with writeback, which may modify or stale the extent type. Key changes and considerations: - Unwritten extents for new blocks (dioread_nolock always on) Since data=ordered mode is not used to prevent stale data exposure in the non-delayed allocation path, new blocks are always allocated as unwritten extents. - Short write and write failure handling a. Delalloc path: On short write or failure, the stale delalloc range must be dropped and its space reservation released. Otherwise, a clean folio may cover leftover delalloc extents, causing inaccurate space reservation accounting. b. Non-delalloc path: No cleanup of allocated blocks is needed on short write since leaving the preallocated blocks behind doesn't cause any real issue. These blocks are visible to users and are not permanently leaked. - Adjust the call frequency of ext4_nonda_switch() so that it is no longer called once per folio in the buffer_head path, but instead once per write. For code simplicity, ext4_iomap_buffered_da_write_ops will be shared with the later page-fault path. Since ext4_nonda_switch() -> try_to_writeback_inodes_sb() synchronously waits for writeback, which could lead to deadlock under the same folio lock acquired by iomap_page_mkwrite(), we can no longer call ext4_nonda_switch() inside ext4_iomap_buffered_da_write_ops. This may increase the probability of a writeback-time allocation failure, but the expected real-world impact is small, so it can be implemented this way for now. - Lock ordering reversal The folio lock and transaction start ordering is reversed compared to the buffer_head buffered write path. To handle this, the journal handle must be stopped in iomap_begin() callbacks. The lock ordering documentation in super.c has been updated accordingly. Signed-off-by: Zhang Yi <yi.zhang@huawei.com> Reviewed-by: Ojaswin Mujoo <ojaswin@linux.ibm.com> Tested-by: syzbot@syzkaller.appspotmail.com Link: https://patch.msgid.link/20261009103033.2920530-14-yi.zhang@huaweicloud.com Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'scripts/Makefile.thinlto')
0 files changed, 0 insertions, 0 deletions