diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2020-02-07 21:38:02 +0300 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-23 00:08:35 +0300 |
commit | 548b3d209fa5c6aaa9db58a69d9f6cf4ce8978b6 (patch) | |
tree | 9f96fb50cf49b7b72070011ec1ab6260cd1d9610 /fs/bcachefs/extents.c | |
parent | 237e80483a6466f3c1968c2a8bb115b3e24d951b (diff) | |
download | linux-548b3d209fa5c6aaa9db58a69d9f6cf4ce8978b6.tar.xz |
bcachefs: btree_ptr_v2
Add a new btree ptr type which contains the sequence number (random 64
bit cookie, actually) for that btree node - this lets us verify that
when we read in a btree node it really is the btree node we wanted.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/extents.c')
-rw-r--r-- | fs/bcachefs/extents.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/bcachefs/extents.c b/fs/bcachefs/extents.c index 10ca544317ba..cff4955d203b 100644 --- a/fs/bcachefs/extents.c +++ b/fs/bcachefs/extents.c @@ -748,6 +748,7 @@ void bch2_bkey_append_ptr(struct bkey_i *k, switch (k->k.type) { case KEY_TYPE_btree_ptr: + case KEY_TYPE_btree_ptr_v2: case KEY_TYPE_extent: EBUG_ON(bkey_val_u64s(&k->k) >= BKEY_EXTENT_VAL_U64s_MAX); @@ -1030,6 +1031,8 @@ const char *bch2_bkey_ptrs_invalid(const struct bch_fs *c, struct bkey_s_c k) if (k.k->type == KEY_TYPE_btree_ptr) size_ondisk = c->opts.btree_node_size; + if (k.k->type == KEY_TYPE_btree_ptr_v2) + size_ondisk = le16_to_cpu(bkey_s_c_to_btree_ptr_v2(k).v->sectors); bkey_extent_entry_for_each(ptrs, entry) { if (__extent_entry_type(entry) >= BCH_EXTENT_ENTRY_MAX) |