blkg_lookup_create(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… blkg_lookup_create(9) β€” the Kernel API Manual, but make it cute πŸŽ€

okay bestie, so this is a page from the Kernel API Manual and it's literally all about blkg_lookup_create ✨ like, it's giving "find-or-make" energy and i'm obsessed. let's get into it 🫢


✨ NAME ✨

blkg_lookup_create β€” lookup a blkg, and lowkey try to create one if it's not there πŸ’–


🌸 SYNOPSIS 🌸

struct blkcg_gq * blkg_lookup_create (struct blkcg *blkcg , struct gendisk *disk );

πŸ¦‹ ARGUMENTS πŸ¦‹

  • blkcg β€” the blkcg of interest, aka the one we're looking at πŸ‘€
  • disk β€” the gendisk of interest, bestie 🫢

πŸ’œ DESCRIPTION πŸ’œ

so here's the vibe: this function looks up the blkg for the blkcg - disk pair. iconic pairing tbh. if it doesn't exist? no worries, it tries to create one ✨

and not me about to explain the recursion β€” blkg creation is performed recursively from blkcg_root, so that all non-root blkg's have access to the parent blkg. it's giving family tree, it's giving main character energy 🧚

⚠️ okay important caveat bestie: this function should be called under RCU read lock and it takes disk->queue->queue_lock. don't forget, i'm serious 😭

and the return? it returns the blkg, or the closest blkg if blkg_create fails as it walks down from root. so like, it still gives you something, which is nice of it fr fr πŸ’…


🌈 SEE ALSO 🌈

kernel file ./block/blk-cgroup.c and literally the whole friend group:


and that's the whole page bestie, no cap 🧒 this cutie lives in ./block and the version is Kernel API Manual, dated October 2026 β€” periodt, we ate and left no crumbs πŸ’…βœ¨πŸ’–

πŸ“¦ where this page comes from