linux/fs/btrfs
Filipe Manana 45c4102f0d btrfs: avoid transaction commit on any fsync after subvolume creation
As of commit 1b53e51a4a ("btrfs: don't commit transaction for every
subvol create") we started to make any fsync after creating a subvolume
to fallback to a transaction commit if the fsync is performed in the
same transaction that was used to create the subvolume. This happens
with the following at ioctl.c:create_subvol():

  $ cat fs/btrfs/ioctl.c
  (...)
      /* Tree log can't currently deal with an inode which is a new root. */
      btrfs_set_log_full_commit(trans);
  (...)

Note that the comment is misleading as the problem is not that fsync can
not deal with the root inode of a new root, but that we can not log any
inode that belongs to a root that was not yet persisted because that would
make log replay fail since the root doesn't exist at log replay time.

The above simply makes any fsync fallback to a full transaction commit if
it happens in the same transaction used to create the subvolume - even if
it's an inode that belongs to any other subvolume. This is a brute force
solution and it doesn't necessarily improve performance for every workload
out there - it just moves a full transaction commit from one place, the
subvolume creation, to another - an fsync for any inode.

Just improve on this by making the fallback to a transaction commit only
for an fsync against an inode of the new subvolume, or for the directory
that contains the dentry that points to the new subvolume (in case anyone
attempts to fsync the directory in the same transaction).

Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2024-07-11 15:33:24 +02:00
..
tests btrfs: remove extent_map::block_start member 2024-07-11 15:33:21 +02:00
accessors.c btrfs: remove unused included headers 2024-03-04 16:24:46 +01:00
accessors.h btrfs: constify parameters of write_eb_member() and its users 2024-07-11 15:33:19 +02:00
acl.c btrfs: remove unused included headers 2024-03-04 16:24:46 +01:00
acl.h btrfs: add forward declarations and headers, part 1 2024-03-04 16:24:49 +01:00
async-thread.c btrfs: remove unused included headers 2024-03-04 16:24:46 +01:00
async-thread.h btrfs: add forward declarations and headers, part 1 2024-03-04 16:24:49 +01:00
backref.c btrfs: change root->root_key.objectid to btrfs_root_id() 2024-05-07 21:31:06 +02:00
backref.h btrfs: uninline some static inline helpers from backref.h 2024-03-04 16:24:53 +01:00
bio.c btrfs: zoned: allocate dummy checksums for zoned NODATASUM writes 2024-06-13 20:43:55 +02:00
bio.h btrfs: add forward declarations and headers, part 2 2024-03-04 16:24:49 +01:00
block-group.c btrfs: move btrfs_block_group_root() to block-group.c 2024-07-11 15:33:18 +02:00
block-group.h btrfs: mark btrfs_put_caching_control() static 2024-03-05 17:13:23 +01:00
block-rsv.c btrfs: change root->root_key.objectid to btrfs_root_id() 2024-05-07 21:31:06 +02:00
block-rsv.h btrfs: add forward declarations and headers, part 2 2024-03-04 16:24:49 +01:00
btrfs_inode.h btrfs: constify pointer parameters where applicable 2024-07-11 15:33:22 +02:00
compression.c btrfs: remove extent_map::block_start member 2024-07-11 15:33:21 +02:00
compression.h btrfs: compression: migrate compression/decompression paths to folios 2024-05-07 21:31:02 +02:00
ctree.c btrfs: change root->root_key.objectid to btrfs_root_id() 2024-05-07 21:31:06 +02:00
ctree.h btrfs: remove inode_lock from struct btrfs_root and use xarray locks 2024-07-11 15:33:17 +02:00
defrag.c btrfs: remove extent_map::block_start member 2024-07-11 15:33:21 +02:00
defrag.h btrfs: add forward declarations and headers, part 1 2024-03-04 16:24:49 +01:00
delalloc-space.c btrfs: constify pointer parameters where applicable 2024-07-11 15:33:22 +02:00
delalloc-space.h btrfs: constify pointer parameters where applicable 2024-07-11 15:33:22 +02:00
delayed-inode.c btrfs: constify pointer parameters where applicable 2024-07-11 15:33:22 +02:00
delayed-inode.h btrfs: constify pointer parameters where applicable 2024-07-11 15:33:22 +02:00
delayed-ref.c btrfs: remove no longer used btrfs_migrate_to_delayed_refs_rsv() 2024-07-11 15:33:16 +02:00
delayed-ref.h btrfs: remove no longer used btrfs_migrate_to_delayed_refs_rsv() 2024-07-11 15:33:16 +02:00
dev-replace.c btrfs: simplify range parameters of btrfs_wait_ordered_roots() 2024-07-11 15:33:19 +02:00
dev-replace.h btrfs: add forward declarations and headers, part 1 2024-03-04 16:24:49 +01:00
dir-item.c btrfs: constify pointer parameters where applicable 2024-07-11 15:33:22 +02:00
dir-item.h btrfs: constify pointer parameters where applicable 2024-07-11 15:33:22 +02:00
discard.c btrfs: unexport btrfs_run_discard_work and make it static 2023-06-19 13:59:25 +02:00
discard.h btrfs: unexport btrfs_run_discard_work and make it static 2023-06-19 13:59:25 +02:00
disk-io.c btrfs: constify pointer parameters where applicable 2024-07-11 15:33:22 +02:00
disk-io.h btrfs: constify pointer parameters where applicable 2024-07-11 15:33:22 +02:00
export.c btrfs: remove objectid from struct btrfs_inode on 64 bits platforms 2024-07-11 15:33:17 +02:00
export.h btrfs: add forward declarations and headers, part 1 2024-03-04 16:24:49 +01:00
extent_io.c btrfs: constify pointer parameters where applicable 2024-07-11 15:33:22 +02:00
extent_io.h btrfs: constify pointer parameters where applicable 2024-07-11 15:33:22 +02:00
extent_map.c btrfs: remove extent_map::block_start member 2024-07-11 15:33:21 +02:00
extent_map.h btrfs: do not directly include rwlock_types.h 2024-07-11 15:33:22 +02:00
extent-io-tree.c btrfs: rename err to ret in convert_extent_bit() 2024-05-07 21:31:01 +02:00
extent-io-tree.h btrfs: add forward declarations and headers, part 2 2024-03-04 16:24:49 +01:00
extent-tree.c btrfs: rename err to ret in btrfs_drop_snapshot() 2024-07-11 15:33:21 +02:00
extent-tree.h btrfs: add forward declarations and headers, part 3 2024-03-04 16:24:49 +01:00
fiemap.c btrfs: move fiemap code into its own file 2024-07-11 15:33:20 +02:00
fiemap.h btrfs: move fiemap code into its own file 2024-07-11 15:33:20 +02:00
file-item.c btrfs: remove extent_map::block_start member 2024-07-11 15:33:21 +02:00
file-item.h btrfs: remove search_commit parameter from btrfs_lookup_csums_list() 2024-05-07 21:31:03 +02:00
file.c btrfs: cleanup duplicated parameters related to can_nocow_file_extent_args 2024-07-11 15:33:21 +02:00
file.h btrfs: pass a btrfs_inode to btrfs_fdatawrite_range() 2024-07-11 15:33:18 +02:00
free-space-cache.c btrfs: pass a btrfs_inode to btrfs_wait_ordered_range() 2024-07-11 15:33:18 +02:00
free-space-cache.h btrfs: add forward declarations and headers, part 2 2024-03-04 16:24:49 +01:00
free-space-tree.c btrfs: move transaction abort to the error site btrfs_rebuild_free_space_tree() 2024-03-04 16:24:48 +01:00
free-space-tree.h btrfs: add forward declarations and headers, part 2 2024-03-04 16:24:49 +01:00
fs.c btrfs: sysfs: update fs features directory asynchronously 2023-02-13 17:50:35 +01:00
fs.h btrfs: constify pointer parameters where applicable 2024-07-11 15:33:22 +02:00
inode-item.c btrfs: change root->root_key.objectid to btrfs_root_id() 2024-05-07 21:31:06 +02:00
inode-item.h btrfs: add forward declarations and headers, part 2 2024-03-04 16:24:49 +01:00
inode.c btrfs: remove pointless code when creating and deleting a subvolume 2024-07-11 15:33:24 +02:00
ioctl.c btrfs: avoid transaction commit on any fsync after subvolume creation 2024-07-11 15:33:24 +02:00
ioctl.h btrfs: constify pointer parameters where applicable 2024-07-11 15:33:22 +02:00
Kconfig btrfs: check-integrity: remove CONFIG_BTRFS_FS_CHECK_INTEGRITY option 2023-10-12 16:44:05 +02:00
locking.c btrfs: change root->root_key.objectid to btrfs_root_id() 2024-05-07 21:31:06 +02:00
locking.h btrfs: cleanup recursive include of the same header 2024-07-11 15:33:22 +02:00
lru_cache.c btrfs: fix typos found by codespell 2023-12-15 23:00:04 +01:00
lru_cache.h btrfs: cleanup recursive include of the same header 2024-07-11 15:33:22 +02:00
lzo.c btrfs: compression: migrate compression/decompression paths to folios 2024-05-07 21:31:02 +02:00
Makefile btrfs: move fiemap code into its own file 2024-07-11 15:33:20 +02:00
messages.c btrfs: remove colon from messages with state 2024-04-18 01:46:35 +02:00
messages.h btrfs: constify fs_info parameter in __btrfs_panic() 2023-12-15 20:27:02 +01:00
misc.h btrfs: constify pointer parameters where applicable 2024-07-11 15:33:22 +02:00
ordered-data.c btrfs: update panic message when splitting ordered extent 2024-07-11 15:33:23 +02:00
ordered-data.h btrfs: cleanup duplicated parameters related to create_io_em() 2024-07-11 15:33:21 +02:00
orphan.c btrfs: remove unused included headers 2024-03-04 16:24:46 +01:00
orphan.h btrfs: add forward declarations and headers, part 1 2024-03-04 16:24:49 +01:00
print-tree.c btrfs: new inline ref storing owning subvol of data extents 2023-10-12 16:44:11 +02:00
print-tree.h btrfs: add forward declarations and headers, part 1 2024-03-04 16:24:49 +01:00
props.c btrfs: constify pointer parameters where applicable 2024-07-11 15:33:22 +02:00
props.h btrfs: constify pointer parameters where applicable 2024-07-11 15:33:22 +02:00
qgroup.c btrfs: constify pointer parameters where applicable 2024-07-11 15:33:22 +02:00
qgroup.h btrfs: constify pointer parameters where applicable 2024-07-11 15:33:22 +02:00
raid-stripe-tree.c btrfs: remove unused included headers 2024-03-04 16:24:46 +01:00
raid-stripe-tree.h btrfs: add forward declarations and headers, part 1 2024-03-04 16:24:49 +01:00
raid56.c btrfs: raid56: do extra dumping for CONFIG_BTRFS_ASSERT 2024-07-11 15:33:16 +02:00
raid56.h btrfs: add forward declarations and headers, part 2 2024-03-04 16:24:49 +01:00
rcu-string.h btrfs: add forward declarations and headers, part 1 2024-03-04 16:24:49 +01:00
ref-verify.c btrfs: fix uninitialized return value in the ref-verify tool 2024-07-02 19:14:57 +02:00
ref-verify.h btrfs: add forward declarations and headers, part 1 2024-03-04 16:24:49 +01:00
reflink.c btrfs: pass a btrfs_inode to btrfs_wait_ordered_range() 2024-07-11 15:33:18 +02:00
reflink.h btrfs: add forward declarations and headers, part 1 2024-03-04 16:24:49 +01:00
relocation.c btrfs: pass reloc_control to setup_relocation_extent_mapping() 2024-07-11 15:33:23 +02:00
relocation.h btrfs: add forward declarations and headers, part 1 2024-03-04 16:24:49 +01:00
root-tree.c btrfs: change root->root_key.objectid to btrfs_root_id() 2024-05-07 21:31:06 +02:00
root-tree.h btrfs: qgroup: fix qgroup prealloc rsv leak in subvolume operations 2024-04-02 19:18:23 +02:00
scrub.c btrfs: add and use helper to commit the current transaction 2024-07-11 15:33:20 +02:00
scrub.h btrfs: add forward declarations and headers, part 1 2024-03-04 16:24:49 +01:00
send.c btrfs: constify pointer parameters where applicable 2024-07-11 15:33:22 +02:00
send.h btrfs: constify pointer parameters where applicable 2024-07-11 15:33:22 +02:00
space-info.c btrfs: add and use helper to commit the current transaction 2024-07-11 15:33:20 +02:00
space-info.h btrfs: add forward declarations and headers, part 2 2024-03-04 16:24:49 +01:00
subpage.c btrfs: lock subpage ranges in one go for writepage_delalloc() 2024-07-11 15:33:22 +02:00
subpage.h btrfs: subpage: introduce helpers to handle subpage delalloc locking 2024-07-11 15:33:22 +02:00
super.c btrfs: constify pointer parameters where applicable 2024-07-11 15:33:22 +02:00
super.h btrfs: constify pointer parameters where applicable 2024-07-11 15:33:22 +02:00
sysfs.c btrfs: use btrfs_is_testing() everywhere 2024-05-07 21:31:07 +02:00
sysfs.h btrfs: add forward declarations and headers, part 1 2024-03-04 16:24:49 +01:00
transaction.c btrfs: add and use helper to commit the current transaction 2024-07-11 15:33:20 +02:00
transaction.h btrfs: add and use helper to commit the current transaction 2024-07-11 15:33:20 +02:00
tree-checker.c btrfs: use btrfs_is_testing() everywhere 2024-05-07 21:31:07 +02:00
tree-checker.h btrfs: make sure that WRITTEN is set on all metadata blocks 2024-05-02 22:11:13 +02:00
tree-log.c btrfs: avoid transaction commit on any fsync after subvolume creation 2024-07-11 15:33:24 +02: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: change root->root_key.objectid to btrfs_root_id() 2024-05-07 21:31:06 +02:00
tree-mod-log.h btrfs: add forward declarations and headers, part 1 2024-03-04 16:24:49 +01:00
ulist.c btrfs: remove unused included headers 2024-03-04 16:24:46 +01:00
ulist.h btrfs: add forward declarations and headers, part 2 2024-03-04 16:24:49 +01:00
uuid-tree.c btrfs: constify pointer parameters where applicable 2024-07-11 15:33:22 +02:00
uuid-tree.h btrfs: constify pointer parameters where applicable 2024-07-11 15:33:22 +02:00
verity.c btrfs: remove unused included headers 2024-03-04 16:24:46 +01:00
verity.h btrfs: add forward declarations and headers, part 1 2024-03-04 16:24:49 +01:00
volumes.c btrfs: constify pointer parameters where applicable 2024-07-11 15:33:22 +02:00
volumes.h btrfs: constify pointer parameters where applicable 2024-07-11 15:33:22 +02:00
xattr.c btrfs: constify pointer parameters where applicable 2024-07-11 15:33:22 +02:00
xattr.h btrfs: constify pointer parameters where applicable 2024-07-11 15:33:22 +02:00
zlib.c btrfs: compression: migrate compression/decompression paths to folios 2024-05-07 21:31:02 +02:00
zoned.c btrfs: constify pointer parameters where applicable 2024-07-11 15:33:22 +02:00
zoned.h btrfs: constify pointer parameters where applicable 2024-07-11 15:33:22 +02:00
zstd.c btrfs: compression: migrate compression/decompression paths to folios 2024-05-07 21:31:02 +02:00