linux/fs/btrfs
Qu Wenruo ecde48a1a6 btrfs: expose per-inode stable writes flag
The address space flag AS_STABLE_WRITES determine if FGP_STABLE for will
wait for the folio to finish its writeback.

For btrfs, due to the default data checksum behavior, if we modify the
folio while it's still under writeback, it will cause data checksum
mismatch.  Thus for quite some call sites we manually call
folio_wait_writeback() to prevent such problem from happening.

Currently there is only one call site inside btrfs really utilizing
FGP_STABLE, and in that case we also manually call folio_wait_writeback()
to do the waiting.

But it's better to properly expose the stable writes flag to a per-inode
basis, to allow call sites to fully benefit from FGP_STABLE flag.
E.g. for inodes with NODATASUM allowing beginning dirtying the page
without waiting for writeback.

This involves:

- Update the mapping's stable write flag when setting/clearing NODATASUM
  inode flag using ioctl
  This only works for empty files, so it should be fine.

- Update the mapping's stable write flag when reading an inode from disk

- Remove the explicit folio_wait_writeback() for FGP_BEGINWRITE call
  site

Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2025-03-18 20:35:41 +01:00
..
tests btrfs: selftests: fix btrfs_test_delayed_refs() leak of transaction 2025-02-17 17:24:14 +01:00
accessors.c move asm/unaligned.h to linux/unaligned.h 2024-10-02 17:23:23 -04:00
accessors.h move asm/unaligned.h to linux/unaligned.h 2024-10-02 17:23:23 -04:00
acl.c
acl.h
async-thread.c btrfs: async-thread: rename DFT_THRESHOLD to DEFAULT_THRESHOLD 2025-01-13 14:53:23 +01:00
async-thread.h
backref.c btrfs: update prelim_ref_insert() to use rb helpers 2025-01-13 14:53:18 +01:00
backref.h btrfs: remove detached list from struct btrfs_backref_cache 2025-01-13 14:53:15 +01:00
bio.c btrfs: add tracking of read blocks for read policy 2025-01-13 14:53:21 +01:00
bio.h btrfs: fix error propagation of split bios 2024-10-23 18:17:43 +02:00
block-group.c btrfs: block-group: remove unnecessary calls to btrfs_mark_buffer_dirty() 2025-01-13 14:53:19 +01:00
block-group.h btrfs: constify more pointer parameters 2024-09-10 16:51:22 +02:00
block-rsv.c btrfs: drop fs_info argument from btrfs_update_space_info_*() 2025-01-13 14:53:14 +01:00
block-rsv.h btrfs: constify more pointer parameters 2024-09-10 16:51:22 +02:00
btrfs_inode.h btrfs: expose per-inode stable writes flag 2025-03-18 20:35:41 +01:00
compression.c btrfs: use filemap_get_folio() helper 2024-11-11 14:34:19 +01:00
compression.h btrfs: lzo: drop unused paramter level from lzo_alloc_workspace() 2024-11-11 14:34:16 +01:00
ctree.c btrfs: fix lockdep splat while merging a relocation root 2025-01-23 22:34:05 +01:00
ctree.h btrfs: remove pointless comment from ctree.h 2025-01-13 14:53:17 +01:00
defrag.c btrfs: fix defrag not merging contiguous extents due to merged extent maps 2024-10-31 16:46:41 +01:00
defrag.h btrfs: drop transaction parameter from btrfs_add_inode_defrag() 2024-09-10 16:51:19 +02:00
delalloc-space.c btrfs: drop fs_info argument from btrfs_update_space_info_*() 2025-01-13 14:53:14 +01:00
delalloc-space.h btrfs: constify pointer parameters where applicable 2024-07-11 15:33:22 +02:00
delayed-inode.c btrfs: drop unused parameter fs_info to btrfs_delete_delayed_insertion_item() 2025-01-13 14:53:21 +01:00
delayed-inode.h btrfs: remove hole from struct btrfs_delayed_node 2024-11-11 14:34:22 +01:00
delayed-ref.c btrfs: update tree_insert() to use rb helpers 2025-01-13 14:53:18 +01:00
delayed-ref.h btrfs: move select_delayed_ref() and export it 2025-01-13 14:53:13 +01:00
dev-replace.c btrfs: dev-replace: remove unnecessary call to btrfs_mark_buffer_dirty() 2025-01-13 14:53:19 +01:00
dev-replace.h
dir-item.c btrfs: dir-item: remove unnecessary calls to btrfs_mark_buffer_dirty() 2025-01-13 14:53:19 +01:00
dir-item.h btrfs: drop unused parameter fs_info from btrfs_match_dir_item_name() 2024-11-11 14:34:17 +01:00
direct-io.c btrfs: always fallback to buffered write if the inode requires checksum 2025-03-18 20:35:32 +01:00
direct-io.h btrfs: move the direct IO code into its own file 2024-07-11 15:33:29 +02:00
discard.c btrfs: constify more pointer parameters 2024-09-10 16:51:22 +02:00
discard.h
disk-io.c btrfs: split waiting from read_extent_buffer_pages(), drop parameter wait 2025-01-13 14:53:23 +01:00
disk-io.h btrfs: remove stray comment about SRCU 2025-01-13 14:53:21 +01:00
export.c btrfs: remove super block argument from btrfs_iget() 2024-07-11 15:33:25 +02:00
export.h
extent-io-tree.c btrfs: introduce EXTENT_DIO_LOCKED 2024-09-10 16:51:20 +02:00
extent-io-tree.h btrfs: introduce EXTENT_DIO_LOCKED 2024-09-10 16:51:20 +02:00
extent-tree.c btrfs: use SECTOR_SIZE defines in btrfs_issue_discard() 2025-01-13 14:53:22 +01:00
extent-tree.h btrfs: move extent-tree function declarations out of ctree.h 2025-01-13 14:53:17 +01:00
extent_io.c btrfs: avoid assigning twice to block_start at btrfs_do_readpage() 2025-03-18 20:35:41 +01:00
extent_io.h btrfs: split waiting from read_extent_buffer_pages(), drop parameter wait 2025-01-13 14:53:23 +01:00
extent_map.c btrfs: do regular iput instead of delayed iput during extent map shrinking 2025-02-21 09:32:11 +01:00
extent_map.h btrfs: make the extent map shrinker run asynchronously as a work queue job 2024-11-11 14:34:17 +01:00
fiemap.c btrfs: correct typos in multiple comments across various files 2024-11-11 14:34:14 +01:00
fiemap.h
file-item.c btrfs: file-item: remove unnecessary calls to btrfs_mark_buffer_dirty() 2025-01-13 14:53:19 +01:00
file-item.h btrfs: constify more pointer parameters 2024-09-10 16:51:22 +02:00
file.c btrfs: expose per-inode stable writes flag 2025-03-18 20:35:41 +01:00
file.h btrfs: convert btrfs_buffered_write() to use folios 2024-11-11 14:34:19 +01:00
free-space-cache.c btrfs: convert io_ctl_prepare_pages() to work on folios 2025-03-17 14:44:43 +01:00
free-space-cache.h btrfs: add cancellation points to trim loops 2024-10-07 23:21:56 +02:00
free-space-tree.c btrfs: free-space-tree: remove unnecessary calls to btrfs_mark_buffer_dirty() 2025-01-13 14:53:19 +01:00
free-space-tree.h
fs.c btrfs: use uuid_is_null() to verify if an uuid is empty 2025-01-13 14:53:17 +01:00
fs.h btrfs: add tracking of read blocks for read policy 2025-01-13 14:53:21 +01:00
inode-item.c btrfs: inode-item: remove unnecessary calls to btrfs_mark_buffer_dirty() 2025-01-13 14:53:19 +01:00
inode-item.h btrfs: constify more pointer parameters 2024-09-10 16:51:22 +02:00
inode.c btrfs: expose per-inode stable writes flag 2025-03-18 20:35:41 +01:00
ioctl.c btrfs: expose per-inode stable writes flag 2025-03-18 20:35:41 +01:00
ioctl.h btrfs: move btrfs_is_empty_uuid() from ioctl.c into fs.c 2025-01-13 14:53:17 +01:00
Kconfig btrfs: split out CONFIG_BTRFS_EXPERIMENTAL from CONFIG_BTRFS_DEBUG 2024-11-11 14:34:12 +01:00
locking.c btrfs: remove unused btrfs_try_tree_write_lock() 2024-11-11 14:34:14 +01:00
locking.h btrfs: add assertions and comment about path expectations to btrfs_cross_ref_exist() 2025-01-13 14:53:16 +01:00
lru_cache.c
lru_cache.h btrfs: cleanup recursive include of the same header 2024-07-11 15:33:22 +02:00
lzo.c btrfs: lzo: drop unused paramter level from lzo_alloc_workspace() 2024-11-11 14:34:16 +01:00
Makefile btrfs: selftests: add delayed ref self test cases 2025-01-13 14:53:13 +01:00
messages.c btrfs: disable rate limiting when debug enabled 2024-10-01 19:29:41 +02:00
messages.h
misc.h btrfs: constify pointer parameters where applicable 2024-07-11 15:33:22 +02:00
ordered-data.c btrfs: fix assertion failure when splitting ordered extent after transaction abort 2025-01-23 22:34:09 +01:00
ordered-data.h btrfs: convert btrfs_mark_ordered_io_finished() to take a folio 2024-09-10 16:51:14 +02:00
orphan.c btrfs: BTRFS_PATH_AUTO_FREE in orphan.c 2024-09-10 16:51:22 +02:00
orphan.h
print-tree.c btrfs: avoid using fixed char array size for tree names 2024-08-02 22:44:27 +02:00
print-tree.h
props.c btrfs: pass a btrfs_inode to btrfs_set_prop() 2024-07-11 15:33:29 +02:00
props.h btrfs: pass a btrfs_inode to btrfs_set_prop() 2024-07-11 15:33:29 +02:00
qgroup.c btrfs: avoid starting new transaction when cleaning qgroup during subvolume drop 2025-01-23 22:34:17 +01:00
qgroup.h btrfs: drop unused transaction parameter from btrfs_qgroup_add_swapped_blocks() 2024-11-11 14:34:16 +01:00
raid-stripe-tree.c btrfs: don't use btrfs_set_item_key_safe on RAID stripe-extents 2025-01-14 15:52:22 +01:00
raid-stripe-tree.h btrfs: tests: add selftests for raid-stripe-tree 2024-11-11 14:34:14 +01:00
raid56.c btrfs: make assert_rbio() to only check CONFIG_BTRFS_ASSERT 2024-11-11 14:34:12 +01:00
raid56.h
rcu-string.h
ref-verify.c btrfs: ref-verify: fix use-after-free after invalid ref action 2024-11-29 16:52:29 +01:00
ref-verify.h
reflink.c btrfs: convert copy_inline_to_page() to use folio 2024-09-10 16:51:21 +02:00
reflink.h
relocation.c btrfs: open code set_page_extent_mapped() 2025-01-13 14:53:22 +01:00
relocation.h
root-tree.c btrfs: root-tree: remove unnecessary calls to btrfs_mark_buffer_dirty() 2025-01-13 14:53:20 +01:00
root-tree.h
scrub.c btrfs: avoid NULL pointer dereference if no valid extent tree 2025-01-06 16:32:31 +01:00
scrub.h
send.c btrfs: send: remove redundant assignments to variable ret 2025-01-13 14:53:14 +01:00
send.h btrfs: split out CONFIG_BTRFS_EXPERIMENTAL from CONFIG_BTRFS_DEBUG 2024-11-11 14:34:12 +01:00
space-info.c btrfs: zoned: reclaim unused zone by zone resetting 2025-01-13 14:53:14 +01:00
space-info.h btrfs: zoned: reclaim unused zone by zone resetting 2025-01-13 14:53:14 +01:00
subpage.c btrfs: update some folio related comments 2025-03-17 14:44:42 +01:00
subpage.h btrfs: do proper folio cleanup when run_delalloc_nocow() failed 2025-01-13 15:52:17 +01:00
super.c \n 2025-01-23 13:36:06 -08:00
super.h btrfs: change BTRFS_MOUNT_* flags to 64bit type 2024-07-19 17:20:23 +02:00
sysfs.c btrfs: replace deprecated strncpy() with strscpy() 2025-02-26 09:24:01 +01:00
sysfs.h btrfs: configure read policy via module parameter 2025-01-13 14:53:21 +01:00
transaction.c btrfs: fix use-after-free when attempting to join an aborted transaction 2025-01-23 22:34:14 +01:00
transaction.h btrfs: move abort_should_print_stack() to transaction.h 2025-01-13 14:53:17 +01:00
tree-checker.c btrfs: validate system chunk array at btrfs_validate_super() 2025-01-13 14:53:18 +01:00
tree-checker.h btrfs: validate system chunk array at btrfs_validate_super() 2025-01-13 14:53:18 +01:00
tree-log.c btrfs: tree-log: remove unnecessary calls to btrfs_mark_buffer_dirty() 2025-01-13 14:53:18 +01:00
tree-log.h btrfs: avoid transaction commit on any fsync after subvolume creation 2024-07-11 15:33:24 +02:00
tree-mod-log.c btrfs: drop unused parameter path from btrfs_tree_mod_log_rewind() 2024-11-11 14:34:15 +01:00
tree-mod-log.h btrfs: drop unused parameter path from btrfs_tree_mod_log_rewind() 2024-11-11 14:34:15 +01:00
ulist.c btrfs: preallocate ulist memory for qgroup rsv 2024-07-11 15:33:26 +02:00
ulist.h btrfs: preallocate ulist memory for qgroup rsv 2024-07-11 15:33:26 +02:00
uuid-tree.c btrfs: uuid-tree: remove unnecessary call to btrfs_mark_buffer_dirty() 2025-01-13 14:53:20 +01:00
uuid-tree.h btrfs: move uuid tree related code to uuid-tree.[ch] 2024-09-10 16:51:12 +02:00
verity.c btrfs: add and use helper to verify the calling task has locked the inode 2024-09-10 16:51:22 +02:00
verity.h
volumes.c for-6.14-rc5-tag 2025-03-07 11:17:30 -10:00
volumes.h btrfs: add read policy to set a preferred device 2025-01-13 14:53:21 +01:00
xattr.c btrfs: xattr: remove unnecessary call to btrfs_mark_buffer_dirty() 2025-01-13 14:53:20 +01:00
xattr.h btrfs: constify pointer parameters where applicable 2024-07-11 15:33:22 +02:00
zlib.c btrfs: zlib: refactor S390x HW acceleration buffer preparation 2025-03-18 20:35:41 +01:00
zoned.c btrfs: zoned: reclaim unused zone by zone resetting 2025-01-13 14:53:14 +01:00
zoned.h btrfs: zoned: reclaim unused zone by zone resetting 2025-01-13 14:53:14 +01:00
zstd.c btrfs: zstd: assert the timer pointer in callback 2024-11-11 14:34:15 +01:00