]> git.sesse.net Git - bcachefs-tools-debian/blob - libbcache/btree_cache.c
update bcache sources
[bcachefs-tools-debian] / libbcache / btree_cache.c
1
2 #include "bcache.h"
3 #include "btree_cache.h"
4 #include "btree_io.h"
5 #include "btree_iter.h"
6 #include "btree_locking.h"
7 #include "debug.h"
8 #include "extents.h"
9
10 #include <trace/events/bcache.h>
11
12 #define DEF_BTREE_ID(kwd, val, name) name,
13
14 const char * const bch_btree_ids[] = {
15         DEFINE_BCH_BTREE_IDS()
16         NULL
17 };
18
19 #undef DEF_BTREE_ID
20
21 void bch_recalc_btree_reserve(struct bch_fs *c)
22 {
23         unsigned i, reserve = 16;
24
25         if (!c->btree_roots[0].b)
26                 reserve += 8;
27
28         for (i = 0; i < BTREE_ID_NR; i++)
29                 if (c->btree_roots[i].b)
30                         reserve += min_t(unsigned, 1,
31                                          c->btree_roots[i].b->level) * 8;
32
33         c->btree_cache_reserve = reserve;
34 }
35
36 #define mca_can_free(c)                                         \
37         max_t(int, 0, c->btree_cache_used - c->btree_cache_reserve)
38
39 static void __mca_data_free(struct bch_fs *c, struct btree *b)
40 {
41         EBUG_ON(btree_node_write_in_flight(b));
42
43         free_pages((unsigned long) b->data, btree_page_order(c));
44         b->data = NULL;
45         bch_btree_keys_free(b);
46 }
47
48 static void mca_data_free(struct bch_fs *c, struct btree *b)
49 {
50         __mca_data_free(c, b);
51         c->btree_cache_used--;
52         list_move(&b->list, &c->btree_cache_freed);
53 }
54
55 #define PTR_HASH(_k)    (bkey_i_to_extent_c(_k)->v._data[0])
56
57 static const struct rhashtable_params bch_btree_cache_params = {
58         .head_offset    = offsetof(struct btree, hash),
59         .key_offset     = offsetof(struct btree, key.v),
60         .key_len        = sizeof(struct bch_extent_ptr),
61 };
62
63 static void mca_data_alloc(struct bch_fs *c, struct btree *b, gfp_t gfp)
64 {
65         unsigned order = ilog2(btree_pages(c));
66
67         b->data = (void *) __get_free_pages(gfp, order);
68         if (!b->data)
69                 goto err;
70
71         if (bch_btree_keys_alloc(b, order, gfp))
72                 goto err;
73
74         c->btree_cache_used++;
75         list_move(&b->list, &c->btree_cache_freeable);
76         return;
77 err:
78         free_pages((unsigned long) b->data, order);
79         b->data = NULL;
80         list_move(&b->list, &c->btree_cache_freed);
81 }
82
83 static struct btree *mca_bucket_alloc(struct bch_fs *c, gfp_t gfp)
84 {
85         struct btree *b = kzalloc(sizeof(struct btree), gfp);
86         if (!b)
87                 return NULL;
88
89         six_lock_init(&b->lock);
90         INIT_LIST_HEAD(&b->list);
91         INIT_LIST_HEAD(&b->write_blocked);
92
93         mca_data_alloc(c, b, gfp);
94         return b->data ? b : NULL;
95 }
96
97 /* Btree in memory cache - hash table */
98
99 void mca_hash_remove(struct bch_fs *c, struct btree *b)
100 {
101         BUG_ON(btree_node_dirty(b));
102
103         b->nsets = 0;
104
105         rhashtable_remove_fast(&c->btree_cache_table, &b->hash,
106                                bch_btree_cache_params);
107
108         /* Cause future lookups for this node to fail: */
109         bkey_i_to_extent(&b->key)->v._data[0] = 0;
110 }
111
112 int mca_hash_insert(struct bch_fs *c, struct btree *b,
113                     unsigned level, enum btree_id id)
114 {
115         int ret;
116         b->level        = level;
117         b->btree_id     = id;
118
119         ret = rhashtable_lookup_insert_fast(&c->btree_cache_table, &b->hash,
120                                             bch_btree_cache_params);
121         if (ret)
122                 return ret;
123
124         mutex_lock(&c->btree_cache_lock);
125         list_add(&b->list, &c->btree_cache);
126         mutex_unlock(&c->btree_cache_lock);
127
128         return 0;
129 }
130
131 __flatten
132 static inline struct btree *mca_find(struct bch_fs *c,
133                                      const struct bkey_i *k)
134 {
135         return rhashtable_lookup_fast(&c->btree_cache_table, &PTR_HASH(k),
136                                       bch_btree_cache_params);
137 }
138
139 /*
140  * this version is for btree nodes that have already been freed (we're not
141  * reaping a real btree node)
142  */
143 static int mca_reap_notrace(struct bch_fs *c, struct btree *b, bool flush)
144 {
145         lockdep_assert_held(&c->btree_cache_lock);
146
147         if (!six_trylock_intent(&b->lock))
148                 return -ENOMEM;
149
150         if (!six_trylock_write(&b->lock))
151                 goto out_unlock_intent;
152
153         if (btree_node_write_error(b) ||
154             btree_node_noevict(b))
155                 goto out_unlock;
156
157         if (!list_empty(&b->write_blocked))
158                 goto out_unlock;
159
160         if (!flush &&
161             (btree_node_dirty(b) ||
162              btree_node_write_in_flight(b)))
163                 goto out_unlock;
164
165         /*
166          * Using the underscore version because we don't want to compact bsets
167          * after the write, since this node is about to be evicted - unless
168          * btree verify mode is enabled, since it runs out of the post write
169          * cleanup:
170          */
171         if (btree_node_dirty(b)) {
172                 if (verify_btree_ondisk(c))
173                         bch_btree_node_write(c, b, NULL, SIX_LOCK_intent, -1);
174                 else
175                         __bch_btree_node_write(c, b, NULL, SIX_LOCK_read, -1);
176         }
177
178         /* wait for any in flight btree write */
179         wait_on_bit_io(&b->flags, BTREE_NODE_write_in_flight,
180                        TASK_UNINTERRUPTIBLE);
181
182         return 0;
183 out_unlock:
184         six_unlock_write(&b->lock);
185 out_unlock_intent:
186         six_unlock_intent(&b->lock);
187         return -ENOMEM;
188 }
189
190 static int mca_reap(struct bch_fs *c, struct btree *b, bool flush)
191 {
192         int ret = mca_reap_notrace(c, b, flush);
193
194         trace_bcache_mca_reap(c, b, ret);
195         return ret;
196 }
197
198 static unsigned long bch_mca_scan(struct shrinker *shrink,
199                                   struct shrink_control *sc)
200 {
201         struct bch_fs *c = container_of(shrink, struct bch_fs,
202                                            btree_cache_shrink);
203         struct btree *b, *t;
204         unsigned long nr = sc->nr_to_scan;
205         unsigned long can_free;
206         unsigned long touched = 0;
207         unsigned long freed = 0;
208         unsigned i;
209
210         u64 start_time = local_clock();
211
212         if (btree_shrinker_disabled(c))
213                 return SHRINK_STOP;
214
215         if (c->btree_cache_alloc_lock)
216                 return SHRINK_STOP;
217
218         /* Return -1 if we can't do anything right now */
219         if (sc->gfp_mask & __GFP_IO)
220                 mutex_lock(&c->btree_cache_lock);
221         else if (!mutex_trylock(&c->btree_cache_lock))
222                 return -1;
223
224         /*
225          * It's _really_ critical that we don't free too many btree nodes - we
226          * have to always leave ourselves a reserve. The reserve is how we
227          * guarantee that allocating memory for a new btree node can always
228          * succeed, so that inserting keys into the btree can always succeed and
229          * IO can always make forward progress:
230          */
231         nr /= btree_pages(c);
232         can_free = mca_can_free(c);
233         nr = min_t(unsigned long, nr, can_free);
234
235         i = 0;
236         list_for_each_entry_safe(b, t, &c->btree_cache_freeable, list) {
237                 touched++;
238
239                 if (freed >= nr)
240                         break;
241
242                 if (++i > 3 &&
243                     !mca_reap_notrace(c, b, false)) {
244                         mca_data_free(c, b);
245                         six_unlock_write(&b->lock);
246                         six_unlock_intent(&b->lock);
247                         freed++;
248                 }
249         }
250 restart:
251         list_for_each_entry_safe(b, t, &c->btree_cache, list) {
252                 touched++;
253
254                 if (freed >= nr) {
255                         /* Save position */
256                         if (&t->list != &c->btree_cache)
257                                 list_move_tail(&c->btree_cache, &t->list);
258                         break;
259                 }
260
261                 if (!btree_node_accessed(b) &&
262                     !mca_reap(c, b, false)) {
263                         /* can't call mca_hash_remove under btree_cache_lock  */
264                         freed++;
265                         if (&t->list != &c->btree_cache)
266                                 list_move_tail(&c->btree_cache, &t->list);
267
268                         mca_data_free(c, b);
269                         mutex_unlock(&c->btree_cache_lock);
270
271                         mca_hash_remove(c, b);
272                         six_unlock_write(&b->lock);
273                         six_unlock_intent(&b->lock);
274
275                         if (freed >= nr)
276                                 goto out;
277
278                         if (sc->gfp_mask & __GFP_IO)
279                                 mutex_lock(&c->btree_cache_lock);
280                         else if (!mutex_trylock(&c->btree_cache_lock))
281                                 goto out;
282                         goto restart;
283                 } else
284                         clear_btree_node_accessed(b);
285         }
286
287         mutex_unlock(&c->btree_cache_lock);
288 out:
289         bch_time_stats_update(&c->mca_scan_time, start_time);
290
291         trace_bcache_mca_scan(c,
292                               touched * btree_pages(c),
293                               freed * btree_pages(c),
294                               can_free * btree_pages(c),
295                               sc->nr_to_scan);
296
297         return (unsigned long) freed * btree_pages(c);
298 }
299
300 static unsigned long bch_mca_count(struct shrinker *shrink,
301                                    struct shrink_control *sc)
302 {
303         struct bch_fs *c = container_of(shrink, struct bch_fs,
304                                            btree_cache_shrink);
305
306         if (btree_shrinker_disabled(c))
307                 return 0;
308
309         if (c->btree_cache_alloc_lock)
310                 return 0;
311
312         return mca_can_free(c) * btree_pages(c);
313 }
314
315 void bch_fs_btree_exit(struct bch_fs *c)
316 {
317         struct btree *b;
318         unsigned i;
319
320         if (c->btree_cache_shrink.list.next)
321                 unregister_shrinker(&c->btree_cache_shrink);
322
323         mutex_lock(&c->btree_cache_lock);
324
325 #ifdef CONFIG_BCACHE_DEBUG
326         if (c->verify_data)
327                 list_move(&c->verify_data->list, &c->btree_cache);
328
329         free_pages((unsigned long) c->verify_ondisk, ilog2(btree_pages(c)));
330 #endif
331
332         for (i = 0; i < BTREE_ID_NR; i++)
333                 if (c->btree_roots[i].b)
334                         list_add(&c->btree_roots[i].b->list, &c->btree_cache);
335
336         list_splice(&c->btree_cache_freeable,
337                     &c->btree_cache);
338
339         while (!list_empty(&c->btree_cache)) {
340                 b = list_first_entry(&c->btree_cache, struct btree, list);
341
342                 if (btree_node_dirty(b))
343                         bch_btree_complete_write(c, b, btree_current_write(b));
344                 clear_btree_node_dirty(b);
345
346                 mca_data_free(c, b);
347         }
348
349         while (!list_empty(&c->btree_cache_freed)) {
350                 b = list_first_entry(&c->btree_cache_freed,
351                                      struct btree, list);
352                 list_del(&b->list);
353                 kfree(b);
354         }
355
356         mutex_unlock(&c->btree_cache_lock);
357
358         if (c->btree_cache_table_init_done)
359                 rhashtable_destroy(&c->btree_cache_table);
360 }
361
362 int bch_fs_btree_init(struct bch_fs *c)
363 {
364         unsigned i;
365         int ret;
366
367         ret = rhashtable_init(&c->btree_cache_table, &bch_btree_cache_params);
368         if (ret)
369                 return ret;
370
371         c->btree_cache_table_init_done = true;
372
373         bch_recalc_btree_reserve(c);
374
375         for (i = 0; i < c->btree_cache_reserve; i++)
376                 if (!mca_bucket_alloc(c, GFP_KERNEL))
377                         return -ENOMEM;
378
379         list_splice_init(&c->btree_cache,
380                          &c->btree_cache_freeable);
381
382 #ifdef CONFIG_BCACHE_DEBUG
383         mutex_init(&c->verify_lock);
384
385         c->verify_ondisk = (void *)
386                 __get_free_pages(GFP_KERNEL, ilog2(btree_pages(c)));
387         if (!c->verify_ondisk)
388                 return -ENOMEM;
389
390         c->verify_data = mca_bucket_alloc(c, GFP_KERNEL);
391         if (!c->verify_data)
392                 return -ENOMEM;
393
394         list_del_init(&c->verify_data->list);
395 #endif
396
397         c->btree_cache_shrink.count_objects = bch_mca_count;
398         c->btree_cache_shrink.scan_objects = bch_mca_scan;
399         c->btree_cache_shrink.seeks = 4;
400         c->btree_cache_shrink.batch = btree_pages(c) * 2;
401         register_shrinker(&c->btree_cache_shrink);
402
403         return 0;
404 }
405
406 /*
407  * We can only have one thread cannibalizing other cached btree nodes at a time,
408  * or we'll deadlock. We use an open coded mutex to ensure that, which a
409  * cannibalize_bucket() will take. This means every time we unlock the root of
410  * the btree, we need to release this lock if we have it held.
411  */
412 void mca_cannibalize_unlock(struct bch_fs *c)
413 {
414         if (c->btree_cache_alloc_lock == current) {
415                 trace_bcache_mca_cannibalize_unlock(c);
416                 c->btree_cache_alloc_lock = NULL;
417                 closure_wake_up(&c->mca_wait);
418         }
419 }
420
421 int mca_cannibalize_lock(struct bch_fs *c, struct closure *cl)
422 {
423         struct task_struct *old;
424
425         old = cmpxchg(&c->btree_cache_alloc_lock, NULL, current);
426         if (old == NULL || old == current)
427                 goto success;
428
429         if (!cl) {
430                 trace_bcache_mca_cannibalize_lock_fail(c);
431                 return -ENOMEM;
432         }
433
434         closure_wait(&c->mca_wait, cl);
435
436         /* Try again, after adding ourselves to waitlist */
437         old = cmpxchg(&c->btree_cache_alloc_lock, NULL, current);
438         if (old == NULL || old == current) {
439                 /* We raced */
440                 closure_wake_up(&c->mca_wait);
441                 goto success;
442         }
443
444         trace_bcache_mca_cannibalize_lock_fail(c);
445         return -EAGAIN;
446
447 success:
448         trace_bcache_mca_cannibalize_lock(c);
449         return 0;
450 }
451
452 static struct btree *mca_cannibalize(struct bch_fs *c)
453 {
454         struct btree *b;
455
456         list_for_each_entry_reverse(b, &c->btree_cache, list)
457                 if (!mca_reap(c, b, false))
458                         return b;
459
460         while (1) {
461                 list_for_each_entry_reverse(b, &c->btree_cache, list)
462                         if (!mca_reap(c, b, true))
463                                 return b;
464
465                 /*
466                  * Rare case: all nodes were intent-locked.
467                  * Just busy-wait.
468                  */
469                 WARN_ONCE(1, "btree cache cannibalize failed\n");
470                 cond_resched();
471         }
472 }
473
474 struct btree *mca_alloc(struct bch_fs *c)
475 {
476         struct btree *b;
477         u64 start_time = local_clock();
478
479         mutex_lock(&c->btree_cache_lock);
480
481         /*
482          * btree_free() doesn't free memory; it sticks the node on the end of
483          * the list. Check if there's any freed nodes there:
484          */
485         list_for_each_entry(b, &c->btree_cache_freeable, list)
486                 if (!mca_reap_notrace(c, b, false))
487                         goto out_unlock;
488
489         /*
490          * We never free struct btree itself, just the memory that holds the on
491          * disk node. Check the freed list before allocating a new one:
492          */
493         list_for_each_entry(b, &c->btree_cache_freed, list)
494                 if (!mca_reap_notrace(c, b, false)) {
495                         mca_data_alloc(c, b, __GFP_NOWARN|GFP_NOIO);
496                         if (b->data)
497                                 goto out_unlock;
498
499                         six_unlock_write(&b->lock);
500                         six_unlock_intent(&b->lock);
501                         goto err;
502                 }
503
504         b = mca_bucket_alloc(c, __GFP_NOWARN|GFP_NOIO);
505         if (!b)
506                 goto err;
507
508         BUG_ON(!six_trylock_intent(&b->lock));
509         BUG_ON(!six_trylock_write(&b->lock));
510 out_unlock:
511         BUG_ON(bkey_extent_is_data(&b->key.k) && PTR_HASH(&b->key));
512         BUG_ON(btree_node_write_in_flight(b));
513
514         list_del_init(&b->list);
515         mutex_unlock(&c->btree_cache_lock);
516 out:
517         b->flags                = 0;
518         b->written              = 0;
519         b->nsets                = 0;
520         b->sib_u64s[0]          = 0;
521         b->sib_u64s[1]          = 0;
522         b->whiteout_u64s        = 0;
523         b->uncompacted_whiteout_u64s = 0;
524         bch_btree_keys_init(b, &c->expensive_debug_checks);
525
526         bch_time_stats_update(&c->mca_alloc_time, start_time);
527
528         return b;
529 err:
530         /* Try to cannibalize another cached btree node: */
531         if (c->btree_cache_alloc_lock == current) {
532                 b = mca_cannibalize(c);
533                 list_del_init(&b->list);
534                 mutex_unlock(&c->btree_cache_lock);
535
536                 mca_hash_remove(c, b);
537
538                 trace_bcache_mca_cannibalize(c);
539                 goto out;
540         }
541
542         mutex_unlock(&c->btree_cache_lock);
543         return ERR_PTR(-ENOMEM);
544 }
545
546 /* Slowpath, don't want it inlined into btree_iter_traverse() */
547 static noinline struct btree *bch_btree_node_fill(struct btree_iter *iter,
548                                                   const struct bkey_i *k,
549                                                   unsigned level,
550                                                   enum six_lock_type lock_type)
551 {
552         struct bch_fs *c = iter->c;
553         struct btree *b;
554
555         b = mca_alloc(c);
556         if (IS_ERR(b))
557                 return b;
558
559         bkey_copy(&b->key, k);
560         if (mca_hash_insert(c, b, level, iter->btree_id)) {
561                 /* raced with another fill: */
562
563                 /* mark as unhashed... */
564                 bkey_i_to_extent(&b->key)->v._data[0] = 0;
565
566                 mutex_lock(&c->btree_cache_lock);
567                 list_add(&b->list, &c->btree_cache_freeable);
568                 mutex_unlock(&c->btree_cache_lock);
569
570                 six_unlock_write(&b->lock);
571                 six_unlock_intent(&b->lock);
572                 return NULL;
573         }
574
575         /*
576          * If the btree node wasn't cached, we can't drop our lock on
577          * the parent until after it's added to the cache - because
578          * otherwise we could race with a btree_split() freeing the node
579          * we're trying to lock.
580          *
581          * But the deadlock described below doesn't exist in this case,
582          * so it's safe to not drop the parent lock until here:
583          */
584         if (btree_node_read_locked(iter, level + 1))
585                 btree_node_unlock(iter, level + 1);
586
587         bch_btree_node_read(c, b);
588         six_unlock_write(&b->lock);
589
590         if (lock_type == SIX_LOCK_read)
591                 six_lock_downgrade(&b->lock);
592
593         return b;
594 }
595
596 /**
597  * bch_btree_node_get - find a btree node in the cache and lock it, reading it
598  * in from disk if necessary.
599  *
600  * If IO is necessary and running under generic_make_request, returns -EAGAIN.
601  *
602  * The btree node will have either a read or a write lock held, depending on
603  * the @write parameter.
604  */
605 struct btree *bch_btree_node_get(struct btree_iter *iter,
606                                  const struct bkey_i *k, unsigned level,
607                                  enum six_lock_type lock_type)
608 {
609         struct btree *b;
610         struct bset_tree *t;
611
612         BUG_ON(level >= BTREE_MAX_DEPTH);
613 retry:
614         rcu_read_lock();
615         b = mca_find(iter->c, k);
616         rcu_read_unlock();
617
618         if (unlikely(!b)) {
619                 /*
620                  * We must have the parent locked to call bch_btree_node_fill(),
621                  * else we could read in a btree node from disk that's been
622                  * freed:
623                  */
624                 b = bch_btree_node_fill(iter, k, level, lock_type);
625
626                 /* We raced and found the btree node in the cache */
627                 if (!b)
628                         goto retry;
629
630                 if (IS_ERR(b))
631                         return b;
632         } else {
633                 /*
634                  * There's a potential deadlock with splits and insertions into
635                  * interior nodes we have to avoid:
636                  *
637                  * The other thread might be holding an intent lock on the node
638                  * we want, and they want to update its parent node so they're
639                  * going to upgrade their intent lock on the parent node to a
640                  * write lock.
641                  *
642                  * But if we're holding a read lock on the parent, and we're
643                  * trying to get the intent lock they're holding, we deadlock.
644                  *
645                  * So to avoid this we drop the read locks on parent nodes when
646                  * we're starting to take intent locks - and handle the race.
647                  *
648                  * The race is that they might be about to free the node we
649                  * want, and dropping our read lock on the parent node lets them
650                  * update the parent marking the node we want as freed, and then
651                  * free it:
652                  *
653                  * To guard against this, btree nodes are evicted from the cache
654                  * when they're freed - and PTR_HASH() is zeroed out, which we
655                  * check for after we lock the node.
656                  *
657                  * Then, btree_node_relock() on the parent will fail - because
658                  * the parent was modified, when the pointer to the node we want
659                  * was removed - and we'll bail out:
660                  */
661                 if (btree_node_read_locked(iter, level + 1))
662                         btree_node_unlock(iter, level + 1);
663
664                 if (!btree_node_lock(b, k->k.p, level, iter, lock_type))
665                         return ERR_PTR(-EINTR);
666
667                 if (unlikely(PTR_HASH(&b->key) != PTR_HASH(k) ||
668                              b->level != level ||
669                              race_fault())) {
670                         six_unlock_type(&b->lock, lock_type);
671                         if (btree_node_relock(iter, level + 1))
672                                 goto retry;
673
674                         return ERR_PTR(-EINTR);
675                 }
676         }
677
678         prefetch(b->aux_data);
679
680         for_each_bset(b, t) {
681                 void *p = (u64 *) b->aux_data + t->aux_data_offset;
682
683                 prefetch(p + L1_CACHE_BYTES * 0);
684                 prefetch(p + L1_CACHE_BYTES * 1);
685                 prefetch(p + L1_CACHE_BYTES * 2);
686         }
687
688         /* avoid atomic set bit if it's not needed: */
689         if (btree_node_accessed(b))
690                 set_btree_node_accessed(b);
691
692         if (unlikely(btree_node_read_error(b))) {
693                 six_unlock_type(&b->lock, lock_type);
694                 return ERR_PTR(-EIO);
695         }
696
697         EBUG_ON(!b->written);
698         EBUG_ON(b->btree_id != iter->btree_id ||
699                 BTREE_NODE_LEVEL(b->data) != level ||
700                 bkey_cmp(b->data->max_key, k->k.p));
701
702         return b;
703 }
704
705 int bch_print_btree_node(struct bch_fs *c, struct btree *b,
706                          char *buf, size_t len)
707 {
708         const struct bkey_format *f = &b->format;
709         struct bset_stats stats;
710         char ptrs[100];
711
712         memset(&stats, 0, sizeof(stats));
713
714         bch_val_to_text(c, BKEY_TYPE_BTREE, ptrs, sizeof(ptrs),
715                         bkey_i_to_s_c(&b->key));
716         bch_btree_keys_stats(b, &stats);
717
718         return scnprintf(buf, len,
719                          "l %u %llu:%llu - %llu:%llu:\n"
720                          "    ptrs: %s\n"
721                          "    format: u64s %u fields %u %u %u %u %u\n"
722                          "    unpack fn len: %u\n"
723                          "    bytes used %zu/%zu (%zu%% full)\n"
724                          "    sib u64s: %u, %u (merge threshold %zu)\n"
725                          "    nr packed keys %u\n"
726                          "    nr unpacked keys %u\n"
727                          "    floats %zu\n"
728                          "    failed unpacked %zu\n"
729                          "    failed prev %zu\n"
730                          "    failed overflow %zu\n",
731                          b->level,
732                          b->data->min_key.inode,
733                          b->data->min_key.offset,
734                          b->data->max_key.inode,
735                          b->data->max_key.offset,
736                          ptrs,
737                          f->key_u64s,
738                          f->bits_per_field[0],
739                          f->bits_per_field[1],
740                          f->bits_per_field[2],
741                          f->bits_per_field[3],
742                          f->bits_per_field[4],
743                          b->unpack_fn_len,
744                          b->nr.live_u64s * sizeof(u64),
745                          btree_bytes(c) - sizeof(struct btree_node),
746                          b->nr.live_u64s * 100 / btree_max_u64s(c),
747                          b->sib_u64s[0],
748                          b->sib_u64s[1],
749                          BTREE_FOREGROUND_MERGE_THRESHOLD(c),
750                          b->nr.packed_keys,
751                          b->nr.unpacked_keys,
752                          stats.floats,
753                          stats.failed_unpacked,
754                          stats.failed_prev,
755                          stats.failed_overflow);
756 }