del_gendisk(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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 β€” the struct gendisk you 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:


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