Commit e3fd3faa authored by Kent Overstreet's avatar Kent Overstreet

bcachefs: Fix btree ID bitmasks

these should be 64 bit bitmasks, not 32 bit.
Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent d4065456
...@@ -1382,9 +1382,10 @@ enum btree_id { ...@@ -1382,9 +1382,10 @@ enum btree_id {
/* /*
* Maximum number of btrees that we will _ever_ have under the current scheme, * Maximum number of btrees that we will _ever_ have under the current scheme,
* where we refer to them with bitfields * where we refer to them with 64 bit bitfields - and we also need a bit for
* the interior btree node type:
*/ */
#define BTREE_ID_NR_MAX 64 #define BTREE_ID_NR_MAX 63
static inline bool btree_id_is_alloc(enum btree_id id) static inline bool btree_id_is_alloc(enum btree_id id)
{ {
......
...@@ -761,13 +761,13 @@ static inline bool btree_node_type_needs_gc(enum btree_node_type type) ...@@ -761,13 +761,13 @@ static inline bool btree_node_type_needs_gc(enum btree_node_type type)
static inline bool btree_node_type_is_extents(enum btree_node_type type) static inline bool btree_node_type_is_extents(enum btree_node_type type)
{ {
const unsigned mask = 0 const u64 mask = 0
#define x(name, nr, flags, ...) |((!!((flags) & BTREE_ID_EXTENTS)) << (nr + 1)) #define x(name, nr, flags, ...) |((!!((flags) & BTREE_ID_EXTENTS)) << (nr + 1))
BCH_BTREE_IDS() BCH_BTREE_IDS()
#undef x #undef x
; ;
return (1U << type) & mask; return BIT_ULL(type) & mask;
} }
static inline bool btree_id_is_extents(enum btree_id btree) static inline bool btree_id_is_extents(enum btree_id btree)
...@@ -777,35 +777,35 @@ static inline bool btree_id_is_extents(enum btree_id btree) ...@@ -777,35 +777,35 @@ static inline bool btree_id_is_extents(enum btree_id btree)
static inline bool btree_type_has_snapshots(enum btree_id id) static inline bool btree_type_has_snapshots(enum btree_id id)
{ {
const unsigned mask = 0 const u64 mask = 0
#define x(name, nr, flags, ...) |((!!((flags) & BTREE_ID_SNAPSHOTS)) << nr) #define x(name, nr, flags, ...) |((!!((flags) & BTREE_ID_SNAPSHOTS)) << nr)
BCH_BTREE_IDS() BCH_BTREE_IDS()
#undef x #undef x
; ;
return (1U << id) & mask; return BIT_ULL(id) & mask;
} }
static inline bool btree_type_has_snapshot_field(enum btree_id id) static inline bool btree_type_has_snapshot_field(enum btree_id id)
{ {
const unsigned mask = 0 const u64 mask = 0
#define x(name, nr, flags, ...) |((!!((flags) & (BTREE_ID_SNAPSHOT_FIELD|BTREE_ID_SNAPSHOTS))) << nr) #define x(name, nr, flags, ...) |((!!((flags) & (BTREE_ID_SNAPSHOT_FIELD|BTREE_ID_SNAPSHOTS))) << nr)
BCH_BTREE_IDS() BCH_BTREE_IDS()
#undef x #undef x
; ;
return (1U << id) & mask; return BIT_ULL(id) & mask;
} }
static inline bool btree_type_has_ptrs(enum btree_id id) static inline bool btree_type_has_ptrs(enum btree_id id)
{ {
const unsigned mask = 0 const u64 mask = 0
#define x(name, nr, flags, ...) |((!!((flags) & BTREE_ID_DATA)) << nr) #define x(name, nr, flags, ...) |((!!((flags) & BTREE_ID_DATA)) << nr)
BCH_BTREE_IDS() BCH_BTREE_IDS()
#undef x #undef x
; ;
return (1U << id) & mask; return BIT_ULL(id) & mask;
} }
struct btree_root { struct btree_root {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment