From: Kent Overstreet Date: Fri, 7 Feb 2025 22:12:47 +0000 (-0500) Subject: bcachefs: Add comment explaining why asserts in invalidate_one_bucket() are impossible X-Git-Tag: v6.15-rc1~146^2~130 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b7f648e2ec3c3a06fc1397b2f3e88480da56b7ad;p=thirdparty%2Fkernel%2Flinux.git bcachefs: Add comment explaining why asserts in invalidate_one_bucket() are impossible Signed-off-by: Kent Overstreet --- diff --git a/fs/bcachefs/alloc_background.c b/fs/bcachefs/alloc_background.c index 43c29b0d2d205..a354558022802 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);