summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2022-12-19 12:24:18 -0500
committerKent Overstreet <kent.overstreet@linux.dev>2023-01-06 19:48:01 -0500
commit41fa4bbba27006347f51ea47f109ae181c0ac609 (patch)
tree24e7c172bbae9fe8ee1443e7875383b527ed1e55
parent5c0b19111341cce19260acc0c74fa177cd7ed435 (diff)
bcachefs: Fix alloc_v4_backpointers()
BCH_ALLOC_V4_BACKPOINTERS_START() may be unset on older filesystems, and alloc_v4_backpointers() needs to take this into account - because it wasn't, __bch2_alloc_to_v4_mut() was zeroing out all fields, instead of only new ones. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
-rw-r--r--fs/bcachefs/alloc_background.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/bcachefs/alloc_background.h b/fs/bcachefs/alloc_background.h
index 47336e9e1018..a0c3c47b49b5 100644
--- a/fs/bcachefs/alloc_background.h
+++ b/fs/bcachefs/alloc_background.h
@@ -200,7 +200,9 @@ void bch2_do_invalidates(struct bch_fs *);
static inline struct bch_backpointer *alloc_v4_backpointers(struct bch_alloc_v4 *a)
{
- return (void *) ((u64 *) &a->v + BCH_ALLOC_V4_BACKPOINTERS_START(a));
+ return (void *) ((u64 *) &a->v +
+ (BCH_ALLOC_V4_BACKPOINTERS_START(a) ?:
+ BCH_ALLOC_V4_U64s_V0));
}
static inline const struct bch_backpointer *alloc_v4_backpointers_c(const struct bch_alloc_v4 *a)