diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2022-04-21 19:13:57 +0200 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 23:09:32 +0200 |
commit | 1cab5a82cc67a09705fbe0607e6ab751f6663524 (patch) | |
tree | 3937f33e238033aa482a14cced3369ed5cdbc44b /fs/bcachefs/lru.c | |
parent | bcachefs: Add persistent counters (diff) | |
download | linux-1cab5a82cc67a09705fbe0607e6ab751f6663524.tar.xz linux-1cab5a82cc67a09705fbe0607e6ab751f6663524.zip |
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.c | 4 |
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; |