STRUCT BTT(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… struct btt(9) πŸ’…

okay so bestie, welcome to the Kernel API Manual, and today's main character is struct btt β€” literally the handle for a BTT instance. that's it, that's the vibe. it's the little struct that holds the whole BTT situation together 🫢


✨ SYNOPSIS ✨

struct btt {
    struct gendisk *btt_disk;
    struct list_head arena_list;
    struct dentry *debugfs_dir;
    struct nd_btt *nd_btt;
    u64 nlba;
    unsigned long long rawsize;
    u32 lbasize;
    u32 sector_size;
    struct nd_region *nd_region;
    struct mutex init_lock;
    int init_state;
    int num_arenas;
    struct badblocks *phys_bb;
 };

🌸 MEMBERS 🌸

so. let's meet the cast. every single field, no skipping, i promise πŸŽ€

  • btt_disk β€” pointer to the gendisk for the BTT device. the whole disk situation, basically πŸ‘‘
  • arena_list β€” head of the list of arenas. yes we're talking linked-list head energy, it's giving list_head and we love that for us
  • debugfs_dir β€” the debugfs dentry. your little doorway into debugfs land πŸšͺ
  • nd_btt β€” parent nd_btt struct. it's got a whole parent, very family-oriented of it
  • nlba β€” number of logical blocks exposed to the upper layers, after you subtract all the space that metadata ate. metadata really said "i'm taking some of that" 😭
  • rawsize β€” total size in bytes of the available backing device. the full snack, unfiltered
  • lbasize β€” LBA size as requested and presented to the upper layers. lowkey important: this is sector_size plus the size of any metadata. yes, the metadata is baked in πŸ’…
  • sector_size β€” the Linux sector size β€” 512 or 4096. those are the only two options, no in-between, no cap 🧚
  • nd_region β€” struct nd_region pointer. that's it, that's the field
  • init_lock β€” mutex used for the BTT initialization. please respect the lock, bestie, or it gets ugly πŸ”’
  • init_state β€” flag describing the initialization state for the BTT. is it initialized? is it not? the flag knows 🌈
  • num_arenas β€” number of arenas in the BTT instance. count 'em πŸ”₯
  • phys_bb β€” pointer to the namespace's badblocks structure. everybody's got a lil list of bad blocks, no judgement πŸ’€

⭐ SEE ALSO ⭐

  • Kernel file ./drivers/nvdimm/btt.h
  • struct arena_info(9)

not me documenting a kernel struct like it's a group chat πŸ’€ but honestly? it ate. go read the source, bestie, iykyk πŸ¦‹

and that's a wrap! this page came straight out of ./drivers/nvdimm, dated October 2026 β€” iconic, timeless, periodt πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from