diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2022-04-10 19:59:26 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:09:31 -0400 |
commit | 7003589dabcdfd10345ede31044ce5e13ee65e7f (patch) | |
tree | c34b49a991b90bea0cdfab392e20063e40d2c4a8 /fs/bcachefs/lru.c | |
parent | 84befe8ef9a07be1cd9bac4e1a1c66c667f71499 (diff) | |
download | lwn-7003589dabcdfd10345ede31044ce5e13ee65e7f.tar.gz lwn-7003589dabcdfd10345ede31044ce5e13ee65e7f.zip |
bcachefs: Ensure buckets have io_time[READ] set
It's an error if a bucket is in state BCH_DATA_cached but not on the LRU
btree - i.e io_time[READ] == 0 - so, make sure it's set before adding
it.
Also, make some of the LRU code a bit clearer and more direct.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Diffstat (limited to 'fs/bcachefs/lru.c')
-rw-r--r-- | fs/bcachefs/lru.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/fs/bcachefs/lru.c b/fs/bcachefs/lru.c index d8180bc1c6b1..49a0f0d69664 100644 --- a/fs/bcachefs/lru.c +++ b/fs/bcachefs/lru.c @@ -30,7 +30,7 @@ void bch2_lru_to_text(struct printbuf *out, struct bch_fs *c, pr_buf(out, "idx %llu", le64_to_cpu(lru->idx)); } -static int lru_delete(struct btree_trans *trans, u64 id, u64 idx, u64 time) +int bch2_lru_delete(struct btree_trans *trans, u64 id, u64 idx, u64 time) { struct btree_iter iter; struct bkey_s_c k; @@ -72,7 +72,7 @@ err: return ret; } -static int lru_set(struct btree_trans *trans, u64 lru_id, u64 idx, u64 *time) +int bch2_lru_set(struct btree_trans *trans, u64 lru_id, u64 idx, u64 *time) { struct btree_iter iter; struct bkey_s_c k; @@ -119,8 +119,8 @@ int bch2_lru_change(struct btree_trans *trans, u64 id, u64 idx, if (old_time == *new_time) return 0; - return lru_delete(trans, id, idx, old_time) ?: - lru_set(trans, id, idx, new_time); + return bch2_lru_delete(trans, id, idx, old_time) ?: + bch2_lru_set(trans, id, idx, new_time); } static int bch2_check_lru_key(struct btree_trans *trans, |