linux/fs/bcachefs
Kent Overstreet e5fa91d7ac bcachefs: Fix restart handling in for_each_btree_key()
Code that uses for_each_btree_key often wants transaction restarts to be
handled locally and not returned. Originally, we wouldn't return
transaction restarts if there was a single iterator in the transaction -
the reasoning being if there weren't other iterators being invalidated,
and the current iterator was being advanced/retraversed, there weren't
any locks or iterators we were required to preserve.

But with the btree_path conversion that approach doesn't work anymore -
even when we're using for_each_btree_key() with a single iterator there
will still be two paths in the transaction, since we now always preserve
the path at the pos the iterator was initialized at - the reason being
that on restart we often restart from the same place.

And it turns out there's now a lot of for_each_btree_key() uses that _do
not_ want transaction restarts handled locally, and should be returning
them.

This patch splits out for_each_btree_key_norestart() and
for_each_btree_key_continue_norestart(), and converts existing users as
appropriate. for_each_btree_key(), for_each_btree_key_continue(), and
for_each_btree_node() now handle transaction restarts themselves by
calling bch2_trans_begin() when necessary - and the old hack to not
return transaction restarts when there's a single path in the
transaction has been deleted.

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2023-10-22 17:09:14 -04:00
..
acl.c bcachefs: Plumb through subvolume id 2023-10-22 17:09:12 -04:00
acl.h bcachefs: Plumb through subvolume id 2023-10-22 17:09:12 -04:00
alloc_background.c bcachefs: Fix allocator shutdown error message 2023-10-22 17:09:13 -04:00
alloc_background.h bcachefs: Add open_buckets to sysfs 2023-10-22 17:09:08 -04:00
alloc_foreground.c bcachefs: Allocator refactoring 2023-10-22 17:09:01 -04:00
alloc_foreground.h bcachefs: Don't let copygc buckets be stolen by other threads 2023-10-22 17:08:43 -04:00
alloc_types.h bcachefs: Add allocator thread state to sysfs 2023-10-22 17:08:54 -04:00
bcachefs.h bcachefs: Subvolumes, snapshots 2023-10-22 17:09:12 -04:00
bcachefs_format.h bcachefs: Fix restart handling in for_each_btree_key() 2023-10-22 17:09:14 -04:00
bcachefs_ioctl.h bcachefs: Subvolumes, snapshots 2023-10-22 17:09:12 -04:00
bkey.c bcachefs: Fix shift-by-64 in bch2_bkey_format_validate() 2023-10-22 17:09:07 -04:00
bkey.h bcachefs: Whiteouts for snapshots 2023-10-22 17:09:12 -04:00
bkey_buf.h bcachefs: Reduce/kill BKEY_PADDED use 2023-10-22 17:08:50 -04:00
bkey_methods.c bcachefs: Require snapshot id to be set 2023-10-22 17:09:13 -04:00
bkey_methods.h bcachefs: Re-implement extent merging in transaction commit path 2023-10-22 17:09:06 -04:00
bkey_sort.c bcachefs: Drop bkey noops 2023-10-22 17:08:57 -04:00
bkey_sort.h bcachefs: Kill support for !BTREE_NODE_NEW_EXTENT_OVERWRITE() 2023-10-22 17:08:55 -04:00
bset.c bcachefs: btree_path 2023-10-22 17:09:11 -04:00
bset.h bcachefs: Increase BSET_CACHELINE to 256 bytes 2023-10-22 17:08:59 -04:00
btree_cache.c bcachefs: Improve btree_node_mem_ptr optimization 2023-10-22 17:09:12 -04:00
btree_cache.h bcachefs: btree_path 2023-10-22 17:09:11 -04:00
btree_gc.c bcachefs: for_each_btree_node() now returns errors directly 2023-10-22 17:09:14 -04:00
btree_gc.h bcachefs: Split out SPOS_MAX 2023-10-22 17:09:07 -04:00
btree_io.c bcachefs: Fix some compiler warnings 2023-10-22 17:09:12 -04:00
btree_io.h bcachefs: Clean up/rename bch2_trans_node_* fns 2023-10-22 17:09:11 -04:00
btree_iter.c bcachefs: Fix restart handling in for_each_btree_key() 2023-10-22 17:09:14 -04:00
btree_iter.h bcachefs: Fix restart handling in for_each_btree_key() 2023-10-22 17:09:14 -04:00
btree_key_cache.c bcachefs: BTREE_ITER_FILTER_SNAPSHOTS 2023-10-22 17:09:12 -04:00
btree_key_cache.h bcachefs: btree_path 2023-10-22 17:09:11 -04:00
btree_locking.h Revert "bcachefs: Add more assertions for locking btree iterators out of order" 2023-10-22 17:09:12 -04:00
btree_types.h bcachefs: bch2_trans_exit() no longer returns errors 2023-10-22 17:09:14 -04:00
btree_update.h bcachefs: bch2_trans_exit() no longer returns errors 2023-10-22 17:09:14 -04:00
btree_update_interior.c bcachefs: for_each_btree_node() now returns errors directly 2023-10-22 17:09:14 -04:00
btree_update_interior.h bcachefs: Kill retry loop in btree merge path 2023-10-22 17:09:11 -04:00
btree_update_leaf.c bcachefs: Fix restart handling in for_each_btree_key() 2023-10-22 17:09:14 -04:00
buckets.c bcachefs: Fix for leaking of reflinked extents 2023-10-22 17:09:14 -04:00
buckets.h bcachefs: btree_path 2023-10-22 17:09:11 -04:00
buckets_types.h bcachefs: Fix bch2_trans_mark_dev_sb() 2023-10-22 17:09:00 -04:00
chardev.c bcachefs: set disk state should check new_state 2023-10-22 17:09:08 -04:00
chardev.h
checksum.c bcachefs: add bcachefs xxhash support 2023-10-22 17:09:07 -04:00
checksum.h bcachefs: add bcachefs xxhash support 2023-10-22 17:09:07 -04:00
clock.c bcachefs: Persist 64 bit io clocks 2023-10-22 17:08:52 -04:00
clock.h bcachefs: Convert various code to printbuf 2023-10-22 17:08:43 -04:00
clock_types.h bcachefs: Persist 64 bit io clocks 2023-10-22 17:08:52 -04:00
compress.c bcachefs: Work around a zstd bug 2023-10-22 17:08:50 -04:00
compress.h
debug.c bcachefs: for_each_btree_node() now returns errors directly 2023-10-22 17:09:14 -04:00
debug.h bcachefs: Update bch2_btree_verify() 2023-10-22 17:09:01 -04:00
dirent.c bcachefs: Fix restart handling in for_each_btree_key() 2023-10-22 17:09:14 -04:00
dirent.h bcachefs: Snapshot creation, deletion 2023-10-22 17:09:13 -04:00
disk_groups.c bcachefs: Fix a couple null ptr derefs when no disk groups exist 2023-10-22 17:08:43 -04:00
disk_groups.h bcachefs: Fix disk groups not being updated when set via sysfs 2023-10-22 17:08:43 -04:00
ec.c bcachefs: bch2_trans_exit() no longer returns errors 2023-10-22 17:09:14 -04:00
ec.h bcachefs: Clean up bch2_btree_and_journal_walk() 2023-10-22 17:09:02 -04:00
ec_types.h bcachefs: Have fsck check for stripe pointers matching stripe 2023-10-22 17:08:55 -04:00
error.c bcachefs: Don't ratelimit certain fsck errors 2023-10-22 17:09:07 -04:00
error.h bcachefs: Don't ratelimit certain fsck errors 2023-10-22 17:09:07 -04:00
extent_update.c bcachefs: Fix restart handling in for_each_btree_key() 2023-10-22 17:09:14 -04:00
extent_update.h bcachefs: Reduce iter->trans usage 2023-10-22 17:09:10 -04:00
extents.c bcachefs: Fix implementation of KEY_TYPE_error 2023-10-22 17:09:13 -04:00
extents.h bcachefs: Fix implementation of KEY_TYPE_error 2023-10-22 17:09:13 -04:00
extents_types.h bcachefs: Limit pointers to being in only one stripe 2023-10-22 17:08:29 -04:00
eytzinger.h bcachefs: Fix check for if extent update is allocating 2023-10-22 17:08:14 -04:00
fifo.h bcachefs: Convert bucket invalidation to key marking path 2023-10-22 17:08:16 -04:00
fs-common.c bcachefs: Snapshot deletion fix 2023-10-22 17:09:13 -04:00
fs-common.h bcachefs: Snapshot creation, deletion 2023-10-22 17:09:13 -04:00
fs-io.c bcachefs: Fix restart handling in for_each_btree_key() 2023-10-22 17:09:14 -04:00
fs-io.h bcachefs: fix truncate with ATTR_MODE 2023-10-22 17:09:07 -04:00
fs-ioctl.c bcachefs: Delete dentry when deleting snapshots 2023-10-22 17:09:14 -04:00
fs-ioctl.h bcachefs: Fix mtime/ctime updates 2023-10-22 17:08:07 -04:00
fs.c bcachefs: bch2_trans_exit() no longer returns errors 2023-10-22 17:09:14 -04:00
fs.h bcachefs: Snapshot creation, deletion 2023-10-22 17:09:13 -04:00
fsck.c bcachefs: Fix check_path() for snapshots 2023-10-22 17:09:14 -04:00
fsck.h bcachefs: Drop bch2_fsck_inode_nlink() 2023-10-22 17:08:59 -04:00
inode.c bcachefs: Plumb through subvolume id 2023-10-22 17:09:12 -04:00
inode.h bcachefs: Plumb through subvolume id 2023-10-22 17:09:12 -04:00
io.c bcachefs: Fix restart handling in for_each_btree_key() 2023-10-22 17:09:14 -04:00
io.h bcachefs: Convert io paths for snapshots 2023-10-22 17:09:12 -04:00
io_types.h bcachefs: Convert io paths for snapshots 2023-10-22 17:09:12 -04:00
journal.c bcachefs: Add a workqueue for btree io completions 2023-10-22 17:09:04 -04:00
journal.h bcachefs: Fix for btree_gc repairing interior btree ptrs 2023-10-22 17:09:01 -04:00
journal_io.c bcachefs: Allow shorter JSET_ENTRY_dev_usage entries 2023-10-22 17:09:06 -04:00
journal_io.h bcachefs: Fix compat code for superblock 2023-10-22 17:08:55 -04:00
journal_reclaim.c bcachefs: Fix compiler warnings 2023-10-22 17:09:14 -04:00
journal_reclaim.h bcachefs: Make sure to initialize j->last_flushed 2023-10-22 17:09:02 -04:00
journal_seq_blacklist.c bcachefs: Handle transaction restarts in bch2_blacklist_entries_gc() 2023-10-22 17:09:14 -04:00
journal_seq_blacklist.h bcachefs: Fix a bug with the journal_seq_blacklist mechanism 2023-10-22 17:08:43 -04:00
journal_types.h bcachefs: Fix journal write error path 2023-10-22 17:09:04 -04:00
Kconfig bcachefs: add bcachefs xxhash support 2023-10-22 17:09:07 -04:00
keylist.c bcachefs: Fix bch2_verify_keylist_sorted 2023-10-22 17:09:02 -04:00
keylist.h bcachefs: Interior btree updates are now fully transactional 2023-10-22 17:08:40 -04:00
keylist_types.h
Makefile bcachefs: Subvolumes, snapshots 2023-10-22 17:09:12 -04:00
migrate.c bcachefs: Handle transaction restarts in bch2_blacklist_entries_gc() 2023-10-22 17:09:14 -04:00
migrate.h
move.c bcachefs: Handle transaction restarts in bch2_blacklist_entries_gc() 2023-10-22 17:09:14 -04:00
move.h bcachefs: add progress stats to sysfs 2023-10-22 17:09:10 -04:00
move_types.h bcachefs: add progress stats to sysfs 2023-10-22 17:09:10 -04:00
movinggc.c bcachefs: add progress stats to sysfs 2023-10-22 17:09:10 -04:00
movinggc.h bcachefs: Make copygc thread global 2023-10-22 17:08:42 -04:00
opts.c bcachefs: Subvolumes, snapshots 2023-10-22 17:09:12 -04:00
opts.h bcachefs: Disable quota support 2023-10-22 17:09:12 -04:00
quota.c bcachefs: bch2_trans_exit() no longer returns errors 2023-10-22 17:09:14 -04:00
quota.h bcachefs: more project quota fixes 2023-10-22 17:08:14 -04:00
quota_types.h bcachefs: bch2_fs_quota_transfer 2023-10-22 17:08:13 -04:00
rebalance.c bcachefs: add progress stats to sysfs 2023-10-22 17:09:10 -04:00
rebalance.h bcachefs: Convert various code to printbuf 2023-10-22 17:08:43 -04:00
rebalance_types.h bcachefs: add progress stats to sysfs 2023-10-22 17:09:10 -04:00
recovery.c bcachefs: New on disk format to fix reflink_p pointers 2023-10-22 17:09:14 -04:00
recovery.h bcachefs: Clean up bch2_btree_and_journal_walk() 2023-10-22 17:09:02 -04:00
reflink.c bcachefs: Fix restart handling in for_each_btree_key() 2023-10-22 17:09:14 -04:00
reflink.h bcachefs: Plumb through subvolume id 2023-10-22 17:09:12 -04:00
replicas.c bcachefs: cached data shouldn't prevent fs from mounting 2023-10-22 17:09:14 -04:00
replicas.h bcachefs: Kill bch2_fs_usage_scratch_get() 2023-10-22 17:08:59 -04:00
replicas_types.h bcachefs: Switch replicas to mark_lock 2023-10-22 17:08:13 -04:00
siphash.c
siphash.h
six.c
six.h
str_hash.h bcachefs: Fix restart handling in for_each_btree_key() 2023-10-22 17:09:14 -04:00
subvolume.c bcachefs: Fix a cache coherency bug in bch2_subvolume_create() 2023-10-22 17:09:14 -04:00
subvolume.h bcachefs: Fix compiler warnings 2023-10-22 17:09:14 -04:00
super-io.c bcachefs: Mask out unknown compat features when going read-write 2023-10-22 17:09:08 -04:00
super-io.h bcachefs: Fix compat code for superblock 2023-10-22 17:08:55 -04:00
super.c bcachefs: Fix bch2_dev_remove_alloc() 2023-10-22 17:09:13 -04:00
super.h bcachefs: Fix some refcounting bugs 2023-10-22 17:09:03 -04:00
super_types.h bcachefs: Eliminate more PAGE_SIZE uses 2023-10-22 17:08:59 -04:00
sysfs.c bcachefs: bch2_trans_exit() no longer returns errors 2023-10-22 17:09:14 -04:00
sysfs.h
tests.c bcachefs: Fix unit & perf tests for snapshots 2023-10-22 17:09:12 -04:00
tests.h bcachefs: Add error handling to unit & perf tests 2023-10-22 17:08:48 -04:00
trace.c
trace.h bcachefs: Better approach to write vs. read lock deadlocks 2023-10-22 17:09:12 -04:00
util.c bcachefs: Fix a pcpu var splat 2023-10-22 17:09:13 -04:00
util.h bcachefs: Keep a sorted list of btree iterators 2023-10-22 17:09:10 -04:00
varint.c bcachefs: Add a valgrind memcheck hint 2023-10-22 17:09:13 -04:00
varint.h bcachefs: Add safe versions of varint encode/decode 2023-10-22 17:09:08 -04:00
vstructs.h
xattr.c bcachefs: Fix restart handling in for_each_btree_key() 2023-10-22 17:09:14 -04:00
xattr.h bcachefs: Plumb through subvolume id 2023-10-22 17:09:12 -04:00