]> git.sesse.net Git - bcachefs-tools-debian/blob - libbcachefs/bset.h
Update bcachefs sources to 0906b1fb49 bcachefs: fixes for 32 bit/big endian machines
[bcachefs-tools-debian] / libbcachefs / bset.h
1 #ifndef _BCACHEFS_BSET_H
2 #define _BCACHEFS_BSET_H
3
4 #include <linux/kernel.h>
5 #include <linux/types.h>
6
7 #include "bcachefs_format.h"
8 #include "bkey.h"
9 #include "bkey_methods.h"
10 #include "btree_types.h"
11 #include "util.h" /* for time_stats */
12 #include "vstructs.h"
13
14 /*
15  * BKEYS:
16  *
17  * A bkey contains a key, a size field, a variable number of pointers, and some
18  * ancillary flag bits.
19  *
20  * We use two different functions for validating bkeys, bkey_invalid and
21  * bkey_deleted().
22  *
23  * The one exception to the rule that ptr_invalid() filters out invalid keys is
24  * that it also filters out keys of size 0 - these are keys that have been
25  * completely overwritten. It'd be safe to delete these in memory while leaving
26  * them on disk, just unnecessary work - so we filter them out when resorting
27  * instead.
28  *
29  * We can't filter out stale keys when we're resorting, because garbage
30  * collection needs to find them to ensure bucket gens don't wrap around -
31  * unless we're rewriting the btree node those stale keys still exist on disk.
32  *
33  * We also implement functions here for removing some number of sectors from the
34  * front or the back of a bkey - this is mainly used for fixing overlapping
35  * extents, by removing the overlapping sectors from the older key.
36  *
37  * BSETS:
38  *
39  * A bset is an array of bkeys laid out contiguously in memory in sorted order,
40  * along with a header. A btree node is made up of a number of these, written at
41  * different times.
42  *
43  * There could be many of them on disk, but we never allow there to be more than
44  * 4 in memory - we lazily resort as needed.
45  *
46  * We implement code here for creating and maintaining auxiliary search trees
47  * (described below) for searching an individial bset, and on top of that we
48  * implement a btree iterator.
49  *
50  * BTREE ITERATOR:
51  *
52  * Most of the code in bcache doesn't care about an individual bset - it needs
53  * to search entire btree nodes and iterate over them in sorted order.
54  *
55  * The btree iterator code serves both functions; it iterates through the keys
56  * in a btree node in sorted order, starting from either keys after a specific
57  * point (if you pass it a search key) or the start of the btree node.
58  *
59  * AUXILIARY SEARCH TREES:
60  *
61  * Since keys are variable length, we can't use a binary search on a bset - we
62  * wouldn't be able to find the start of the next key. But binary searches are
63  * slow anyways, due to terrible cache behaviour; bcache originally used binary
64  * searches and that code topped out at under 50k lookups/second.
65  *
66  * So we need to construct some sort of lookup table. Since we only insert keys
67  * into the last (unwritten) set, most of the keys within a given btree node are
68  * usually in sets that are mostly constant. We use two different types of
69  * lookup tables to take advantage of this.
70  *
71  * Both lookup tables share in common that they don't index every key in the
72  * set; they index one key every BSET_CACHELINE bytes, and then a linear search
73  * is used for the rest.
74  *
75  * For sets that have been written to disk and are no longer being inserted
76  * into, we construct a binary search tree in an array - traversing a binary
77  * search tree in an array gives excellent locality of reference and is very
78  * fast, since both children of any node are adjacent to each other in memory
79  * (and their grandchildren, and great grandchildren...) - this means
80  * prefetching can be used to great effect.
81  *
82  * It's quite useful performance wise to keep these nodes small - not just
83  * because they're more likely to be in L2, but also because we can prefetch
84  * more nodes on a single cacheline and thus prefetch more iterations in advance
85  * when traversing this tree.
86  *
87  * Nodes in the auxiliary search tree must contain both a key to compare against
88  * (we don't want to fetch the key from the set, that would defeat the purpose),
89  * and a pointer to the key. We use a few tricks to compress both of these.
90  *
91  * To compress the pointer, we take advantage of the fact that one node in the
92  * search tree corresponds to precisely BSET_CACHELINE bytes in the set. We have
93  * a function (to_inorder()) that takes the index of a node in a binary tree and
94  * returns what its index would be in an inorder traversal, so we only have to
95  * store the low bits of the offset.
96  *
97  * The key is 84 bits (KEY_DEV + key->key, the offset on the device). To
98  * compress that,  we take advantage of the fact that when we're traversing the
99  * search tree at every iteration we know that both our search key and the key
100  * we're looking for lie within some range - bounded by our previous
101  * comparisons. (We special case the start of a search so that this is true even
102  * at the root of the tree).
103  *
104  * So we know the key we're looking for is between a and b, and a and b don't
105  * differ higher than bit 50, we don't need to check anything higher than bit
106  * 50.
107  *
108  * We don't usually need the rest of the bits, either; we only need enough bits
109  * to partition the key range we're currently checking.  Consider key n - the
110  * key our auxiliary search tree node corresponds to, and key p, the key
111  * immediately preceding n.  The lowest bit we need to store in the auxiliary
112  * search tree is the highest bit that differs between n and p.
113  *
114  * Note that this could be bit 0 - we might sometimes need all 80 bits to do the
115  * comparison. But we'd really like our nodes in the auxiliary search tree to be
116  * of fixed size.
117  *
118  * The solution is to make them fixed size, and when we're constructing a node
119  * check if p and n differed in the bits we needed them to. If they don't we
120  * flag that node, and when doing lookups we fallback to comparing against the
121  * real key. As long as this doesn't happen to often (and it seems to reliably
122  * happen a bit less than 1% of the time), we win - even on failures, that key
123  * is then more likely to be in cache than if we were doing binary searches all
124  * the way, since we're touching so much less memory.
125  *
126  * The keys in the auxiliary search tree are stored in (software) floating
127  * point, with an exponent and a mantissa. The exponent needs to be big enough
128  * to address all the bits in the original key, but the number of bits in the
129  * mantissa is somewhat arbitrary; more bits just gets us fewer failures.
130  *
131  * We need 7 bits for the exponent and 3 bits for the key's offset (since keys
132  * are 8 byte aligned); using 22 bits for the mantissa means a node is 4 bytes.
133  * We need one node per 128 bytes in the btree node, which means the auxiliary
134  * search trees take up 3% as much memory as the btree itself.
135  *
136  * Constructing these auxiliary search trees is moderately expensive, and we
137  * don't want to be constantly rebuilding the search tree for the last set
138  * whenever we insert another key into it. For the unwritten set, we use a much
139  * simpler lookup table - it's just a flat array, so index i in the lookup table
140  * corresponds to the i range of BSET_CACHELINE bytes in the set. Indexing
141  * within each byte range works the same as with the auxiliary search trees.
142  *
143  * These are much easier to keep up to date when we insert a key - we do it
144  * somewhat lazily; when we shift a key up we usually just increment the pointer
145  * to it, only when it would overflow do we go to the trouble of finding the
146  * first key in that range of bytes again.
147  */
148
149 extern bool bch2_expensive_debug_checks;
150
151 static inline bool btree_keys_expensive_checks(const struct btree *b)
152 {
153 #ifdef CONFIG_BCACHEFS_DEBUG
154         return bch2_expensive_debug_checks || *b->expensive_debug_checks;
155 #else
156         return false;
157 #endif
158 }
159
160 enum bset_aux_tree_type {
161         BSET_NO_AUX_TREE,
162         BSET_RO_AUX_TREE,
163         BSET_RW_AUX_TREE,
164 };
165
166 #define BSET_TREE_NR_TYPES      3
167
168 #define BSET_NO_AUX_TREE_VAL    (U16_MAX)
169 #define BSET_RW_AUX_TREE_VAL    (U16_MAX - 1)
170
171 static inline enum bset_aux_tree_type bset_aux_tree_type(const struct bset_tree *t)
172 {
173         switch (t->extra) {
174         case BSET_NO_AUX_TREE_VAL:
175                 EBUG_ON(t->size);
176                 return BSET_NO_AUX_TREE;
177         case BSET_RW_AUX_TREE_VAL:
178                 EBUG_ON(!t->size);
179                 return BSET_RW_AUX_TREE;
180         default:
181                 EBUG_ON(!t->size);
182                 return BSET_RO_AUX_TREE;
183         }
184 }
185
186 typedef void (*compiled_unpack_fn)(struct bkey *, const struct bkey_packed *);
187
188 static inline void
189 __bkey_unpack_key_format_checked(const struct btree *b,
190                                struct bkey *dst,
191                                const struct bkey_packed *src)
192 {
193 #ifdef HAVE_BCACHEFS_COMPILED_UNPACK
194         {
195                 compiled_unpack_fn unpack_fn = b->aux_data;
196                 unpack_fn(dst, src);
197
198                 if (btree_keys_expensive_checks(b)) {
199                         struct bkey dst2 = __bch2_bkey_unpack_key(&b->format, src);
200
201                         /*
202                          * hack around a harmless race when compacting whiteouts
203                          * for a write:
204                          */
205                         dst2.needs_whiteout = dst->needs_whiteout;
206
207                         BUG_ON(memcmp(dst, &dst2, sizeof(*dst)));
208                 }
209         }
210 #else
211         *dst = __bch2_bkey_unpack_key(&b->format, src);
212 #endif
213 }
214
215 static inline struct bkey
216 bkey_unpack_key_format_checked(const struct btree *b,
217                                const struct bkey_packed *src)
218 {
219         struct bkey dst;
220
221         __bkey_unpack_key_format_checked(b, &dst, src);
222         return dst;
223 }
224
225 static inline void __bkey_unpack_key(const struct btree *b,
226                                      struct bkey *dst,
227                                      const struct bkey_packed *src)
228 {
229         if (likely(bkey_packed(src)))
230                 __bkey_unpack_key_format_checked(b, dst, src);
231         else
232                 *dst = *packed_to_bkey_c(src);
233 }
234
235 /**
236  * bkey_unpack_key -- unpack just the key, not the value
237  */
238 static inline struct bkey bkey_unpack_key(const struct btree *b,
239                                           const struct bkey_packed *src)
240 {
241         return likely(bkey_packed(src))
242                 ? bkey_unpack_key_format_checked(b, src)
243                 : *packed_to_bkey_c(src);
244 }
245
246 static inline struct bpos
247 bkey_unpack_pos_format_checked(const struct btree *b,
248                                const struct bkey_packed *src)
249 {
250 #ifdef HAVE_BCACHEFS_COMPILED_UNPACK
251         return bkey_unpack_key_format_checked(b, src).p;
252 #else
253         return __bkey_unpack_pos(&b->format, src);
254 #endif
255 }
256
257 static inline struct bpos bkey_unpack_pos(const struct btree *b,
258                                           const struct bkey_packed *src)
259 {
260         return likely(bkey_packed(src))
261                 ? bkey_unpack_pos_format_checked(b, src)
262                 : packed_to_bkey_c(src)->p;
263 }
264
265 /* Disassembled bkeys */
266
267 static inline struct bkey_s_c bkey_disassemble(struct btree *b,
268                                                const struct bkey_packed *k,
269                                                struct bkey *u)
270 {
271         __bkey_unpack_key(b, u, k);
272
273         return (struct bkey_s_c) { u, bkeyp_val(&b->format, k), };
274 }
275
276 /* non const version: */
277 static inline struct bkey_s __bkey_disassemble(struct btree *b,
278                                                struct bkey_packed *k,
279                                                struct bkey *u)
280 {
281         __bkey_unpack_key(b, u, k);
282
283         return (struct bkey_s) { .k = u, .v = bkeyp_val(&b->format, k), };
284 }
285
286 #define for_each_bset(_b, _t)                                   \
287         for (_t = (_b)->set; _t < (_b)->set + (_b)->nsets; _t++)
288
289 static inline bool bset_has_ro_aux_tree(struct bset_tree *t)
290 {
291         return bset_aux_tree_type(t) == BSET_RO_AUX_TREE;
292 }
293
294 static inline bool bset_has_rw_aux_tree(struct bset_tree *t)
295 {
296         return bset_aux_tree_type(t) == BSET_RW_AUX_TREE;
297 }
298
299 static inline void bch2_bset_set_no_aux_tree(struct btree *b,
300                                             struct bset_tree *t)
301 {
302         BUG_ON(t < b->set);
303
304         for (; t < b->set + ARRAY_SIZE(b->set); t++) {
305                 t->size = 0;
306                 t->extra = BSET_NO_AUX_TREE_VAL;
307                 t->aux_data_offset = U16_MAX;
308         }
309 }
310
311 static inline void btree_node_set_format(struct btree *b,
312                                          struct bkey_format f)
313 {
314         int len;
315
316         b->format       = f;
317         b->nr_key_bits  = bkey_format_key_bits(&f);
318
319         len = bch2_compile_bkey_format(&b->format, b->aux_data);
320         BUG_ON(len < 0 || len > U8_MAX);
321
322         b->unpack_fn_len = len;
323
324         bch2_bset_set_no_aux_tree(b, b->set);
325 }
326
327 static inline struct bset *bset_next_set(struct btree *b,
328                                          unsigned block_bytes)
329 {
330         struct bset *i = btree_bset_last(b);
331
332         EBUG_ON(!is_power_of_2(block_bytes));
333
334         return ((void *) i) + round_up(vstruct_bytes(i), block_bytes);
335 }
336
337 void bch2_btree_keys_free(struct btree *);
338 int bch2_btree_keys_alloc(struct btree *, unsigned, gfp_t);
339 void bch2_btree_keys_init(struct btree *, bool *);
340
341 void bch2_bset_init_first(struct btree *, struct bset *);
342 void bch2_bset_init_next(struct bch_fs *, struct btree *,
343                          struct btree_node_entry *);
344 void bch2_bset_build_aux_tree(struct btree *, struct bset_tree *, bool);
345 void bch2_bset_fix_invalidated_key(struct btree *, struct bset_tree *,
346                                   struct bkey_packed *);
347
348 void bch2_bset_insert(struct btree *, struct btree_node_iter *,
349                      struct bkey_packed *, struct bkey_i *, unsigned);
350 void bch2_bset_delete(struct btree *, struct bkey_packed *, unsigned);
351
352 /* Bkey utility code */
353
354 /* packed or unpacked */
355 static inline int bkey_cmp_p_or_unp(const struct btree *b,
356                                     const struct bkey_packed *l,
357                                     const struct bkey_packed *r_packed,
358                                     struct bpos *r)
359 {
360         EBUG_ON(r_packed && !bkey_packed(r_packed));
361
362         if (unlikely(!bkey_packed(l)))
363                 return bkey_cmp(packed_to_bkey_c(l)->p, *r);
364
365         if (likely(r_packed))
366                 return __bch2_bkey_cmp_packed_format_checked(l, r_packed, b);
367
368         return __bch2_bkey_cmp_left_packed_format_checked(b, l, r);
369 }
370
371 /* Returns true if @k is after iterator position @pos */
372 static inline bool btree_iter_pos_cmp_packed(const struct btree *b,
373                                              struct bpos *pos,
374                                              const struct bkey_packed *k,
375                                              bool strictly_greater)
376 {
377         int cmp = bkey_cmp_left_packed(b, k, pos);
378
379         return cmp > 0 ||
380                 (cmp == 0 && !strictly_greater && !bkey_deleted(k));
381 }
382
383 static inline bool btree_iter_pos_cmp_p_or_unp(const struct btree *b,
384                                         struct bpos pos,
385                                         const struct bkey_packed *pos_packed,
386                                         const struct bkey_packed *k,
387                                         bool strictly_greater)
388 {
389         int cmp = bkey_cmp_p_or_unp(b, k, pos_packed, &pos);
390
391         return cmp > 0 ||
392                 (cmp == 0 && !strictly_greater && !bkey_deleted(k));
393 }
394
395 struct bset_tree *bch2_bkey_to_bset(struct btree *, struct bkey_packed *);
396 struct bkey_packed *bch2_bkey_prev_all(struct btree *, struct bset_tree *,
397                                   struct bkey_packed *);
398 struct bkey_packed *bch2_bkey_prev(struct btree *, struct bset_tree *,
399                                    struct bkey_packed *);
400
401 enum bch_extent_overlap {
402         BCH_EXTENT_OVERLAP_ALL          = 0,
403         BCH_EXTENT_OVERLAP_BACK         = 1,
404         BCH_EXTENT_OVERLAP_FRONT        = 2,
405         BCH_EXTENT_OVERLAP_MIDDLE       = 3,
406 };
407
408 /* Returns how k overlaps with m */
409 static inline enum bch_extent_overlap bch2_extent_overlap(const struct bkey *k,
410                                                          const struct bkey *m)
411 {
412         int cmp1 = bkey_cmp(k->p, m->p) < 0;
413         int cmp2 = bkey_cmp(bkey_start_pos(k),
414                             bkey_start_pos(m)) > 0;
415
416         return (cmp1 << 1) + cmp2;
417 }
418
419 /* Btree key iteration */
420
421 static inline void __bch2_btree_node_iter_init(struct btree_node_iter *iter,
422                                               bool is_extents)
423 {
424         iter->is_extents = is_extents;
425         memset(iter->data, 0, sizeof(iter->data));
426 }
427
428 void bch2_btree_node_iter_push(struct btree_node_iter *, struct btree *,
429                               const struct bkey_packed *,
430                               const struct bkey_packed *);
431 void bch2_btree_node_iter_init(struct btree_node_iter *, struct btree *,
432                               struct bpos, bool, bool);
433 void bch2_btree_node_iter_init_from_start(struct btree_node_iter *,
434                                          struct btree *, bool);
435 struct bkey_packed *bch2_btree_node_iter_bset_pos(struct btree_node_iter *,
436                                                  struct btree *,
437                                                  struct bset_tree *);
438
439 void bch2_btree_node_iter_sort(struct btree_node_iter *, struct btree *);
440 void bch2_btree_node_iter_set_drop(struct btree_node_iter *,
441                                    struct btree_node_iter_set *);
442 void bch2_btree_node_iter_advance(struct btree_node_iter *, struct btree *);
443
444 #define btree_node_iter_for_each(_iter, _set)                           \
445         for (_set = (_iter)->data;                                      \
446              _set < (_iter)->data + ARRAY_SIZE((_iter)->data) &&        \
447              (_set)->k != (_set)->end;                                  \
448              _set++)
449
450 static inline bool __btree_node_iter_set_end(struct btree_node_iter *iter,
451                                              unsigned i)
452 {
453         return iter->data[i].k == iter->data[i].end;
454 }
455
456 static inline bool bch2_btree_node_iter_end(struct btree_node_iter *iter)
457 {
458         return __btree_node_iter_set_end(iter, 0);
459 }
460
461 static inline int __btree_node_iter_cmp(bool is_extents,
462                                         struct btree *b,
463                                         struct bkey_packed *l,
464                                         struct bkey_packed *r)
465 {
466         /*
467          * For non extents, when keys compare equal the deleted keys have to
468          * come first - so that bch2_btree_node_iter_next_check() can detect
469          * duplicate nondeleted keys (and possibly other reasons?)
470          *
471          * For extents, bkey_deleted() is used as a proxy for k->size == 0, so
472          * deleted keys have to sort last.
473          */
474         return bkey_cmp_packed(b, l, r) ?: is_extents
475                 ? (int) bkey_deleted(l) - (int) bkey_deleted(r)
476                 : (int) bkey_deleted(r) - (int) bkey_deleted(l);
477 }
478
479 static inline int btree_node_iter_cmp(struct btree_node_iter *iter,
480                                       struct btree *b,
481                                       struct btree_node_iter_set l,
482                                       struct btree_node_iter_set r)
483 {
484         return __btree_node_iter_cmp(iter->is_extents, b,
485                         __btree_node_offset_to_key(b, l.k),
486                         __btree_node_offset_to_key(b, r.k));
487 }
488
489 static inline void __bch2_btree_node_iter_push(struct btree_node_iter *iter,
490                               struct btree *b,
491                               const struct bkey_packed *k,
492                               const struct bkey_packed *end)
493 {
494         if (k != end) {
495                 struct btree_node_iter_set *pos;
496
497                 btree_node_iter_for_each(iter, pos)
498                         ;
499
500                 BUG_ON(pos >= iter->data + ARRAY_SIZE(iter->data));
501                 *pos = (struct btree_node_iter_set) {
502                         __btree_node_key_to_offset(b, k),
503                         __btree_node_key_to_offset(b, end)
504                 };
505         }
506 }
507
508 static inline struct bkey_packed *
509 __bch2_btree_node_iter_peek_all(struct btree_node_iter *iter,
510                                 struct btree *b)
511 {
512         return __btree_node_offset_to_key(b, iter->data->k);
513 }
514
515 static inline struct bkey_packed *
516 bch2_btree_node_iter_peek_all(struct btree_node_iter *iter,
517                               struct btree *b)
518 {
519         return bch2_btree_node_iter_end(iter)
520                 ? NULL
521                 : __bch2_btree_node_iter_peek_all(iter, b);
522 }
523
524 static inline struct bkey_packed *
525 bch2_btree_node_iter_peek(struct btree_node_iter *iter, struct btree *b)
526 {
527         struct bkey_packed *ret;
528
529         while ((ret = bch2_btree_node_iter_peek_all(iter, b)) &&
530                bkey_deleted(ret))
531                 bch2_btree_node_iter_advance(iter, b);
532
533         return ret;
534 }
535
536 static inline struct bkey_packed *
537 bch2_btree_node_iter_next_all(struct btree_node_iter *iter, struct btree *b)
538 {
539         struct bkey_packed *ret = bch2_btree_node_iter_peek_all(iter, b);
540
541         if (ret)
542                 bch2_btree_node_iter_advance(iter, b);
543
544         return ret;
545 }
546
547 struct bkey_packed *bch2_btree_node_iter_prev_all(struct btree_node_iter *,
548                                                  struct btree *);
549 struct bkey_packed *bch2_btree_node_iter_prev(struct btree_node_iter *,
550                                              struct btree *);
551
552 /*
553  * Iterates over all _live_ keys - skipping deleted (and potentially
554  * overlapping) keys
555  */
556 #define for_each_btree_node_key(b, k, iter, _is_extents)                \
557         for (bch2_btree_node_iter_init_from_start((iter), (b), (_is_extents));\
558              ((k) = bch2_btree_node_iter_peek(iter, b));                        \
559              bch2_btree_node_iter_advance(iter, b))
560
561 struct bkey_s_c bch2_btree_node_iter_peek_unpack(struct btree_node_iter *,
562                                                 struct btree *,
563                                                 struct bkey *);
564
565 #define for_each_btree_node_key_unpack(b, k, iter, _is_extents, unpacked)\
566         for (bch2_btree_node_iter_init_from_start((iter), (b), (_is_extents));\
567              (k = bch2_btree_node_iter_peek_unpack((iter), (b), (unpacked))).k;\
568              bch2_btree_node_iter_advance(iter, b))
569
570 /* Accounting: */
571
572 static inline void btree_keys_account_key(struct btree_nr_keys *n,
573                                           unsigned bset,
574                                           struct bkey_packed *k,
575                                           int sign)
576 {
577         n->live_u64s            += k->u64s * sign;
578         n->bset_u64s[bset]      += k->u64s * sign;
579
580         if (bkey_packed(k))
581                 n->packed_keys  += sign;
582         else
583                 n->unpacked_keys += sign;
584 }
585
586 #define btree_keys_account_key_add(_nr, _bset_idx, _k)          \
587         btree_keys_account_key(_nr, _bset_idx, _k, 1)
588 #define btree_keys_account_key_drop(_nr, _bset_idx, _k) \
589         btree_keys_account_key(_nr, _bset_idx, _k, -1)
590
591 struct bset_stats {
592         struct {
593                 size_t nr, bytes;
594         } sets[BSET_TREE_NR_TYPES];
595
596         size_t floats;
597         size_t failed_unpacked;
598         size_t failed_prev;
599         size_t failed_overflow;
600 };
601
602 void bch2_btree_keys_stats(struct btree *, struct bset_stats *);
603 int bch2_bkey_print_bfloat(struct btree *, struct bkey_packed *,
604                           char *, size_t);
605
606 /* Debug stuff */
607
608 void bch2_dump_bset(struct btree *, struct bset *, unsigned);
609 void bch2_dump_btree_node(struct btree *);
610 void bch2_dump_btree_node_iter(struct btree *, struct btree_node_iter *);
611
612 #ifdef CONFIG_BCACHEFS_DEBUG
613
614 void __bch2_verify_btree_nr_keys(struct btree *);
615 void bch2_btree_node_iter_verify(struct btree_node_iter *, struct btree *);
616 void bch2_verify_key_order(struct btree *, struct btree_node_iter *,
617                           struct bkey_packed *);
618
619 #else
620
621 static inline void __bch2_verify_btree_nr_keys(struct btree *b) {}
622 static inline void bch2_btree_node_iter_verify(struct btree_node_iter *iter,
623                                               struct btree *b) {}
624 static inline void bch2_verify_key_order(struct btree *b,
625                                         struct btree_node_iter *iter,
626                                         struct bkey_packed *where) {}
627 #endif
628
629 static inline void bch2_verify_btree_nr_keys(struct btree *b)
630 {
631         if (btree_keys_expensive_checks(b))
632                 __bch2_verify_btree_nr_keys(b);
633 }
634
635 #endif /* _BCACHEFS_BSET_H */