summaryrefslogtreecommitdiffstats
path: root/fs/bcachefs/btree_types.h
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-11-03 18:30:08 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2023-11-04 22:19:13 -0400
commitd3c7727bb9269c7f7a2f17ef76b9e5c9b8cc8863 (patch)
tree402a0d35410e968724409c01de6b112b332d73e4 /fs/bcachefs/btree_types.h
parent01ccee225a373d859eb6e5d42dbe0138a40a7e0a (diff)
downloadlinux-d3c7727bb9269c7f7a2f17ef76b9e5c9b8cc8863.tar.gz
linux-d3c7727bb9269c7f7a2f17ef76b9e5c9b8cc8863.tar.bz2
linux-d3c7727bb9269c7f7a2f17ef76b9e5c9b8cc8863.zip
bcachefs: rebalance_work btree is not a snapshots btree
rebalance_work entries may refer to entries in the extents btree, which is a snapshots btree, or they may also refer to entries in the reflink btree, which is not. Hence rebalance_work keys may use the snapshot field but it's not required to be nonzero - add a new btree flag to reflect this. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/btree_types.h')
-rw-r--r--fs/bcachefs/btree_types.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/fs/bcachefs/btree_types.h b/fs/bcachefs/btree_types.h
index 7cc8d6b12161..a685883e5405 100644
--- a/fs/bcachefs/btree_types.h
+++ b/fs/bcachefs/btree_types.h
@@ -710,6 +710,17 @@ static inline bool btree_type_has_snapshots(enum btree_id id)
return (1U << id) & mask;
}
+static inline bool btree_type_has_snapshot_field(enum btree_id id)
+{
+ const unsigned mask = 0
+#define x(name, nr, flags, ...) |((!!((flags) & BTREE_ID_SNAPSHOT_FIELD)) << nr)
+ BCH_BTREE_IDS()
+#undef x
+ ;
+
+ return (1U << id) & mask;
+}
+
static inline bool btree_type_has_ptrs(enum btree_id id)
{
const unsigned mask = 0