disk_release(9)
π disk_release(9)
okay so this is a page from the Kernel API Manual bestie, and it's literally all about disk_release β the little cleanup queen of the gendisk world. let's get into it π
β¨ NAME β¨
disk_release β releases all allocated resources of the gendisk. she's the one who closes the tab, empties the fridge and turns off the lights on her way out. no cap. π§Ή
β¨ SYNOPSIS β¨
void disk_release (struct device *dev );
that's it. that's the whole vibe check. π
β¨ ARGUMENTS β¨
devβ the device representing this disk π«Ά like, this is the actual thing you're handing over so she knows which disk's stuff needs releasing.
β¨ DESCRIPTION β¨
so, disk_release releases all allocated resources of the gendisk. all of them. every single one. she does not leave crumbs. π
now here's the lore for drivers that used device_add_disk: ngl, those drivers have a gendisk with a request_queue assigned to it. and because the request_queue sits on top of the gendisk for these drivers, we also call blk_put_queue for them. π
and bestie, we expect the request_queue refcount to reach 0 at this point β like, that's the whole point β so the request_queue will also be freed prior to the disk. order matters, that's the tea. π
β¨ CONTEXT β¨
- can sleep π΄
so yeah, she's allowed to nap. you do not have to hold your breath here. π¦
β¨ SEE ALSO β¨
all the siblings and adjacent icons, in the kernel file ./block/genhd.c:
bdev_count_inflight(9)__register_blkdev(9)add_disk_fwnode(9)device_add_disk(9)blk_mark_disk_dead(9)del_gendisk(9)invalidate_disk(9)put_disk(9)set_disk_ro(9)
okay that's the page! huge shoutout to the ./block directory and to October 2026 for the timestamp β this one's from the Kernel API Manual, and honestly? iconic. periodt. πππ
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms