diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2023-04-29 13:24:18 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:10:00 -0400 |
commit | 174f930b8e1cad3915819a46bb20da214f68f2b5 (patch) | |
tree | 413eb321e97d3184f68716c8df8a4eef9c1e5b44 /fs/bcachefs/xattr.c | |
parent | ab158fce47220df20f0fe2360767227328f6765b (diff) | |
download | lwn-174f930b8e1cad3915819a46bb20da214f68f2b5.tar.gz lwn-174f930b8e1cad3915819a46bb20da214f68f2b5.zip |
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/xattr.c')
-rw-r--r-- | fs/bcachefs/xattr.c | 6 |
1 files changed, 0 insertions, 6 deletions
diff --git a/fs/bcachefs/xattr.c b/fs/bcachefs/xattr.c index 4c86878b3df2..448eb446946b 100644 --- a/fs/bcachefs/xattr.c +++ b/fs/bcachefs/xattr.c @@ -75,12 +75,6 @@ int bch2_xattr_invalid(const struct bch_fs *c, struct bkey_s_c k, const struct xattr_handler *handler; struct bkey_s_c_xattr xattr = bkey_s_c_to_xattr(k); - if (bkey_val_bytes(k.k) < sizeof(struct bch_xattr)) { - prt_printf(err, "incorrect value size (%zu < %zu)", - bkey_val_bytes(k.k), sizeof(*xattr.v)); - return -BCH_ERR_invalid_bkey; - } - if (bkey_val_u64s(k.k) < xattr_val_u64s(xattr.v->x_name_len, le16_to_cpu(xattr.v->x_val_len))) { |