diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2023-04-29 20:24:18 +0300 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-23 00:10:00 +0300 |
commit | 174f930b8e1cad3915819a46bb20da214f68f2b5 (patch) | |
tree | 413eb321e97d3184f68716c8df8a4eef9c1e5b44 /fs/bcachefs/reflink.c | |
parent | ab158fce47220df20f0fe2360767227328f6765b (diff) | |
download | linux-174f930b8e1cad3915819a46bb20da214f68f2b5.tar.xz |
bcachefs: bkey_ops.min_val_size
This adds a new field to bkey_ops for the minimum size of the value,
which standardizes that check and also enforces the new rule (previously
done somewhat ad-hoc) that we can extend value types by adding new
fields on to the end.
To make that work we do _not_ initialize min_val_size with sizeof,
instead we initialize it to the size of the first version of those
values.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/reflink.c')
-rw-r--r-- | fs/bcachefs/reflink.c | 20 |
1 files changed, 0 insertions, 20 deletions
diff --git a/fs/bcachefs/reflink.c b/fs/bcachefs/reflink.c index d8426e754cdf..9430899a5a31 100644 --- a/fs/bcachefs/reflink.c +++ b/fs/bcachefs/reflink.c @@ -30,12 +30,6 @@ int bch2_reflink_p_invalid(const struct bch_fs *c, struct bkey_s_c k, { struct bkey_s_c_reflink_p p = bkey_s_c_to_reflink_p(k); - if (bkey_val_bytes(p.k) != sizeof(*p.v)) { - prt_printf(err, "incorrect value size (%zu != %zu)", - bkey_val_bytes(p.k), sizeof(*p.v)); - return -EINVAL; - } - if (c->sb.version >= bcachefs_metadata_version_reflink_p_fix && le64_to_cpu(p.v->idx) < le32_to_cpu(p.v->front_pad)) { prt_printf(err, "idx < front_pad (%llu < %u)", @@ -80,14 +74,6 @@ bool bch2_reflink_p_merge(struct bch_fs *c, struct bkey_s _l, struct bkey_s_c _r int bch2_reflink_v_invalid(const struct bch_fs *c, struct bkey_s_c k, unsigned flags, struct printbuf *err) { - struct bkey_s_c_reflink_v r = bkey_s_c_to_reflink_v(k); - - if (bkey_val_bytes(r.k) < sizeof(*r.v)) { - prt_printf(err, "incorrect value size (%zu < %zu)", - bkey_val_bytes(r.k), sizeof(*r.v)); - return -BCH_ERR_invalid_bkey; - } - return bch2_bkey_ptrs_invalid(c, k, flags, err); } @@ -133,12 +119,6 @@ int bch2_trans_mark_reflink_v(struct btree_trans *trans, int bch2_indirect_inline_data_invalid(const struct bch_fs *c, struct bkey_s_c k, unsigned flags, struct printbuf *err) { - if (bkey_val_bytes(k.k) < sizeof(struct bch_indirect_inline_data)) { - prt_printf(err, "incorrect value size (%zu < %zu)", - bkey_val_bytes(k.k), sizeof(struct bch_indirect_inline_data)); - return -BCH_ERR_invalid_bkey; - } - return 0; } |