bcachefs: extents no longer require special handling for packing
authorKent Overstreet <kent.overstreet@linux.dev>
Sat, 26 Nov 2022 09:36:56 +0000 (04:36 -0500)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:09:47 +0000 (17:09 -0400)
Extent overwrite used to  be handled differently, underneath the
journaling layer and within the core btree code. This imposed
restrictions on bkey packing/packed formats, which no longer apply.

This patch deletes those restrictions.

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

index 0291d216e5dd59290b27a6542000a909da257c77..a10046ae01f26cf8bdbdf3ff1c45f6ef13f4deda 100644 (file)
@@ -323,15 +323,6 @@ bool bch2_bkey_pack_key(struct bkey_packed *out, const struct bkey *in,
 #define x(id, field)   if (!set_inc_field(&state, id, in->field)) return false;
        bkey_fields()
 #undef x
-
-       /*
-        * Extents - we have to guarantee that if an extent is packed, a trimmed
-        * version will also pack:
-        */
-       if (bkey_start_offset(in) <
-           le64_to_cpu(format->field_offset[BKEY_FIELD_OFFSET]))
-               return false;
-
        pack_state_finish(&state, out);
        out->u64s       = format->key_u64s + in->u64s - BKEY_U64s;
        out->format     = KEY_FORMAT_LOCAL_BTREE;
index 0ce020bcc55f3ad7b83a86ea03b9a2dc4e56856a..df8189476016c8a299ffcc9ee785bf40b8fb98d5 100644 (file)
@@ -689,7 +689,6 @@ static inline void bch2_bkey_format_add_key(struct bkey_format_state *s, const s
 #define x(id, field) __bkey_format_add(s, id, k->field);
        bkey_fields()
 #undef x
-       __bkey_format_add(s, BKEY_FIELD_OFFSET, bkey_start_offset(k));
 }
 
 void bch2_bkey_format_add_pos(struct bkey_format_state *, struct bpos);