summaryrefslogtreecommitdiff
path: root/fs/bcachefs/subvolume.h
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-04-29 20:24:18 +0300
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-23 00:10:00 +0300
commit174f930b8e1cad3915819a46bb20da214f68f2b5 (patch)
tree413eb321e97d3184f68716c8df8a4eef9c1e5b44 /fs/bcachefs/subvolume.h
parentab158fce47220df20f0fe2360767227328f6765b (diff)
downloadlinux-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/subvolume.h')
-rw-r--r--fs/bcachefs/subvolume.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/bcachefs/subvolume.h b/fs/bcachefs/subvolume.h
index df6657952e2f..1f6f7862e48f 100644
--- a/fs/bcachefs/subvolume.h
+++ b/fs/bcachefs/subvolume.h
@@ -15,6 +15,7 @@ int bch2_mark_snapshot(struct btree_trans *, enum btree_id, unsigned,
.key_invalid = bch2_snapshot_invalid, \
.val_to_text = bch2_snapshot_to_text, \
.atomic_trigger = bch2_mark_snapshot, \
+ .min_val_size = 24, \
})
static inline struct snapshot_t *snapshot_t(struct bch_fs *c, u32 id)
@@ -119,6 +120,7 @@ void bch2_subvolume_to_text(struct printbuf *, struct bch_fs *, struct bkey_s_c)
#define bch2_bkey_ops_subvolume ((struct bkey_ops) { \
.key_invalid = bch2_subvolume_invalid, \
.val_to_text = bch2_subvolume_to_text, \
+ .min_val_size = 16, \
})
int bch2_subvolume_get(struct btree_trans *, unsigned,