summaryrefslogtreecommitdiff
path: root/fs/bcachefs/lru.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2022-04-21 20:13:57 +0300
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-23 00:09:32 +0300
commit1cab5a82cc67a09705fbe0607e6ab751f6663524 (patch)
tree3937f33e238033aa482a14cced3369ed5cdbc44b /fs/bcachefs/lru.c
parent104c69745fdf7e5f8aa022f60bc9d568987bd8b8 (diff)
downloadlinux-1cab5a82cc67a09705fbe0607e6ab751f6663524.tar.xz
bcachefs: Go RW before bch2_check_lrus()
btree updates before going RW are expensive if they're in random order, since they use the list of keys for journal replay to insert, which is just a gap buffer. This patch improves the bucket invalidate path so that if bch2_check_lrus() hasn't finished it only prints warnings instead of doing an emergency shutdown, which means we can now set BCH_FS_MAY_GO_RW before bch2_check_lrus(). Also, the filesystem state bits are reorganized a bit. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Diffstat (limited to 'fs/bcachefs/lru.c')
-rw-r--r--fs/bcachefs/lru.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/bcachefs/lru.c b/fs/bcachefs/lru.c
index fe9d15742947..ce23b38382f5 100644
--- a/fs/bcachefs/lru.c
+++ b/fs/bcachefs/lru.c
@@ -204,7 +204,9 @@ int bch2_check_lrus(struct bch_fs *c, bool initial)
for_each_btree_key(&trans, iter, BTREE_ID_lru, POS_MIN,
BTREE_ITER_PREFETCH, k, ret) {
- ret = __bch2_trans_do(&trans, NULL, NULL, 0,
+ ret = __bch2_trans_do(&trans, NULL, NULL,
+ BTREE_INSERT_NOFAIL|
+ BTREE_INSERT_LAZY_RW,
bch2_check_lru_key(&trans, &iter, initial));
if (ret)
break;