summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2025-02-07 17:12:47 -0500
committerKent Overstreet <kent.overstreet@linux.dev>2025-02-07 18:13:31 -0500
commitd2490e56b40aee283edfd60a3f358a93a7614106 (patch)
treec1594fb191274eeba170c5b4095638b211a0c717
parent93f2f331b2832a15199ee7cd2a5ae13b1cca1799 (diff)
bcachefs: Add comment explaining why asserts in invalidate_one_bucket() are impossible
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
-rw-r--r--fs/bcachefs/alloc_background.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/bcachefs/alloc_background.c b/fs/bcachefs/alloc_background.c
index 43c29b0d2d20..a35455802280 100644
--- a/fs/bcachefs/alloc_background.c
+++ b/fs/bcachefs/alloc_background.c
@@ -2093,6 +2093,13 @@ static int invalidate_one_bucket(struct btree_trans *trans,
if (lru_pos_time(lru_iter->pos) != alloc_lru_idx_read(a->v))
goto out;
+ /*
+ * Impossible since alloc_lru_idx_read() only returns nonzero if the
+ * bucket is supposed to be on the cached bucket LRU (i.e.
+ * BCH_DATA_cached)
+ *
+ * bch2_lru_validate() also disallows lru keys with lru_pos_time() == 0
+ */
BUG_ON(a->v.data_type != BCH_DATA_cached);
BUG_ON(a->v.dirty_sectors);