bcachefs: alloc_v4_u64s() fix
authorKent Overstreet <kent.overstreet@linux.dev>
Sat, 20 May 2023 06:20:28 +0000 (02:20 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:10:01 +0000 (17:10 -0400)
With the recent bkey_ops.min_val_size addition, bkey values are
automatically extended to the size of the current version.

The check in bch2_alloc_v4_invalid() needs to be updated to take this
into account.

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

index dcdef3bcd4c49159fb1962601acb1e5bb9d495c4..f774a660a68122e561082399e0f84d306ddb8eeb 100644 (file)
@@ -269,9 +269,9 @@ int bch2_alloc_v4_invalid(const struct bch_fs *c, struct bkey_s_c k,
        struct bkey_s_c_alloc_v4 a = bkey_s_c_to_alloc_v4(k);
        int rw = flags & WRITE;
 
-       if (alloc_v4_u64s(a.v) != bkey_val_u64s(k.k)) {
-               prt_printf(err, "bad val size (%lu != %u)",
-                      bkey_val_u64s(k.k), alloc_v4_u64s(a.v));
+       if (alloc_v4_u64s(a.v) > bkey_val_u64s(k.k)) {
+               prt_printf(err, "bad val size (%u > %lu)",
+                      alloc_v4_u64s(a.v), bkey_val_u64s(k.k));
                return -BCH_ERR_invalid_bkey;
        }