From 1cab5a82cc67a09705fbe0607e6ab751f6663524 Mon Sep 17 00:00:00 2001 From: Kent Overstreet Date: Thu, 21 Apr 2022 13:13:57 -0400 Subject: 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 --- fs/bcachefs/lru.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'fs/bcachefs/lru.c') 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; -- cgit v1.2.3-70-g09d2