summaryrefslogtreecommitdiff
path: root/fs/bcachefs/recovery.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-12-08 07:28:26 +0300
committerKent Overstreet <kent.overstreet@linux.dev>2024-01-01 19:47:40 +0300
commit27b2df982fa3343552e8a98a744581da69064207 (patch)
treefba3296b6d73abb39a85a89c1ce6916958e291a1 /fs/bcachefs/recovery.c
parent8c066edeb43b067badac984b6a0493d07d15c00a (diff)
downloadlinux-27b2df982fa3343552e8a98a744581da69064207.tar.xz
bcachefs: Kill for_each_btree_key()
for_each_btree_key() handles transaction restarts, like for_each_btree_key2(), but only calls bch2_trans_begin() after a transaction restart - for_each_btree_key2() wraps every loop iteration in a transaction. The for_each_btree_key() behaviour is problematic when it leads to holding the SRCU lock that prevents key cache reclaim for an unbounded amount of time - there's no real need to keep it around. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/recovery.c')
-rw-r--r--fs/bcachefs/recovery.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/bcachefs/recovery.c b/fs/bcachefs/recovery.c
index 629ddbb5850f..ed366b35a1f2 100644
--- a/fs/bcachefs/recovery.c
+++ b/fs/bcachefs/recovery.c
@@ -534,7 +534,8 @@ static int bch2_set_may_go_rw(struct bch_fs *c)
keys->gap = keys->nr;
set_bit(BCH_FS_may_go_rw, &c->flags);
- if (keys->nr || c->opts.fsck)
+
+ if (keys->nr || c->opts.fsck || !c->sb.clean)
return bch2_fs_read_write_early(c);
return 0;
}