]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
bcachefs: Rebalance now skips poisoned extents
authorKent Overstreet <kent.overstreet@linux.dev>
Tue, 11 Mar 2025 13:46:06 +0000 (09:46 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Thu, 22 May 2025 00:13:22 +0000 (20:13 -0400)
Let's not move poisoned extents unnecessarily, since we can't guard
against introducing more bitrot.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/rebalance.c

index 623273556aa978a77fbd5b0a2942869ca3cfa8db..3c45500c1a2807af489b29b61811991a30f1e66e 100644 (file)
@@ -95,6 +95,9 @@ static unsigned bch2_bkey_ptrs_need_rebalance(struct bch_fs *c,
 {
        struct bkey_ptrs_c ptrs = bch2_bkey_ptrs_c(k);
 
+       if (bch2_bkey_extent_ptrs_flags(ptrs) & BIT_ULL(BCH_EXTENT_FLAG_poisoned))
+               return 0;
+
        return bch2_bkey_ptrs_need_compress(c, opts, k, ptrs) |
                bch2_bkey_ptrs_need_move(c, opts, ptrs);
 }
@@ -107,6 +110,9 @@ u64 bch2_bkey_sectors_need_rebalance(struct bch_fs *c, struct bkey_s_c k)
        if (!opts)
                return 0;
 
+       if (bch2_bkey_extent_ptrs_flags(ptrs) & BIT_ULL(BCH_EXTENT_FLAG_poisoned))
+               return 0;
+
        const union bch_extent_entry *entry;
        struct extent_ptr_decoded p;
        u64 sectors = 0;