bd_link_disk_holder(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

okay so we're in the Kernel API Manual today and this one is genuinely iconic, no cap.


✨ NAME ✨

bd_link_disk_holder β€” creates symlinks between the holding disk and the slave bdev 🫢

like that's literally the whole job. symlinks. between things. slay.


🌸 SYNOPSIS 🌸

int bd_link_disk_holder (struct block_device *bdev , struct gendisk *disk );

πŸ¦‹ ARGUMENTS πŸ¦‹

  • bdev β€” the claimed slave bdev. yes bestie, it has to be claimed already, we'll get to that.
  • disk β€” the holding disk. the main character in this whole situation πŸ‘‘

πŸ”₯ DESCRIPTION πŸ”₯

DON'T USE THIS UNLESS YOU'RE ALREADY USING IT.

no literally. that's in the manpage. that's not me being dramatic. if you're not already in this ecosystem, back away slowly πŸ’€

so this function creates the following sysfs symlinks:

  • going from the "slaves" directory of the holder disk β†’ to the claimed bdev
  • going from the "holders" directory of the bdev β†’ to the holder disk

like it's giving mutuals. both directions. we love a two-way link πŸ’–

for example, if /dev/dm-0 maps to /dev/sda and disk for dm-0 is passed to bd_link_disk_holder, then:

/sys/block/dm-0/slaves/sda --> /sys/block/sda
/sys/block/sda/holders/dm-0 --> /sys/block/dm-0

see how they point at each other?? obsessed. πŸ₯Ή

now the rules, and these are NOT optional:

the caller must have claimed bdev before calling this function, and must ensure that both bdev and disk are valid during the creation and lifetime of these symlinks. like not just when you make them β€” the whole time they exist. if they go away while the symlinks are still vibing, that's on you bestie 😭


🌈 CONTEXT 🌈

might sleep. 😴

like fr fr, this one can nap. plan accordingly.


⭐ RETURN ⭐

  • 0 on success πŸ’š
  • -errno on failure πŸ’”

🧚 SEE ALSO 🧚


and that's the page!! πŸ“ mwah πŸ’œ

kiss kiss, this was brought to you by the ./block crew, October 2026 edition β€” bd_link_disk_holder(9), logging off πŸŽ€βœ¨

πŸ“¦ where this page comes from