del_gendisk(9)
π del_gendisk(9) β kernel API manual, bestie edition β¨
Okay so this is del_gendisk, straight out of the Kernel API Manual β the β¨officialβ¨ page, just vibing in a way you'll actually remember. Grab a snack, we're removing a gendisk π
πΈ NAME πΈ
del_gendisk β remove the gendisk. That's it, that's the whole name. Iconic, minimal, no notes π«Ά
β SYNOPSIS β
void del_gendisk (struct gendisk *disk );
Yeah bestie, it returns void β no return value, no "did it work?" text, it just does the thing π
π¦ ARGUMENTS π¦
diskβ thestruct gendiskyou wanna remove. That's the one. The main character of this whole operation π
π DESCRIPTION π
So what does it actually do? It removes the gendisk and all its associated resources. All of them. Not some β all. And listen, that means it deletes the partitions associated with the gendisk, and it unregisters the associated request_queue. Both. Gone. Cleaned up β¨
Think of it as the counter to the respective device_add_disk call β like, device_add_disk said "hello world, here's a disk" and del_gendisk is the "ok bye bestie" on the other side of the conversation π
Now, important bit, don't skip this: the final removal of the struct gendisk happens when its refcount reaches 0 with put_disk β and put_disk should be called after del_gendisk, if device_add_disk was used. Like, that's the order. Respect the order π
And one more thing, fr fr: drivers exist which depend on the release of the gendisk to be synchronous. So it should not be deferred. Do not push it off. Do not "later" it. It is not a later task π
π΄ CONTEXT π΄
can sleep π
(That's the whole section. It can sleep. Let it nap. Sweet dreams, kernel function π)
π₯ SEE ALSO π₯
Kernel file ./block/genhd.c, plus the whole friend group:
bdev_count_inflight(9)__register_blkdev(9)add_disk_fwnode(9)device_add_disk(9)blk_mark_disk_dead(9)invalidate_disk(9)disk_release(9)put_disk(9)set_disk_ro(9)
And that's the page, bestie π This little gem lives under ./block β that's the source for ya β dated October 2026, and its manual tag is del_gendisk(9), in case you need to cite your sources. Now go forth and unregister those queues π§πΈ
π¦ 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