bcachefs: rebalance shouldn't attempt to compress unwritten extents
authorDaniel Hill <daniel@gluo.nz>
Wed, 6 Dec 2023 08:26:00 +0000 (21:26 +1300)
committerKent Overstreet <kent.overstreet@linux.dev>
Wed, 6 Dec 2023 22:43:21 +0000 (17:43 -0500)
This fixes a bug where rebalance would loop repeatedly on the same
extents.

Signed-off-by: Daniel Hill <daniel@gluo.nz>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/extents.c

index f6c92df552702a7455baa39532bf3c6231ae69b4..9d8afcb5979a12456c032a00faf5514962b9aa05 100644 (file)
@@ -1294,7 +1294,8 @@ unsigned bch2_bkey_ptrs_need_rebalance(struct bch_fs *c, struct bkey_s_c k,
                unsigned i = 0;
 
                bkey_for_each_ptr_decode(k.k, ptrs, p, entry) {
-                       if (p.crc.compression_type == BCH_COMPRESSION_TYPE_incompressible) {
+                       if (p.crc.compression_type == BCH_COMPRESSION_TYPE_incompressible ||
+                           p.ptr.unwritten) {
                                rewrite_ptrs = 0;
                                goto incompressible;
                        }