]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
bcachefs: Add comment explaining why asserts in invalidate_one_bucket() are impossible
authorKent Overstreet <kent.overstreet@linux.dev>
Fri, 7 Feb 2025 22:12:47 +0000 (17:12 -0500)
committerKent Overstreet <kent.overstreet@linux.dev>
Sat, 15 Mar 2025 01:02:13 +0000 (21:02 -0400)
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/alloc_background.c

index 43c29b0d2d2058cf65a4c15edfcc2ad6a9375716..a354558022802530e58e9f09e88fdd0d60e8e465 100644 (file)
@@ -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);