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>2022-12-19 12:35:18 -0500
commit7958ebe32438f58a0e59f240aa288b14efcc0964 (patch)
tree62d3a1f306da778614c53004bda650973c364cd6
parent7a4d61ad5a36ae4f54c9ecc654a8930d806fa54f (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)