bio_associate_blkg_from_css(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– bio_associate_blkg_from_css πŸ’– (that's the 9 kernel API manual, bestie, we're in the kernel section)

Ok so picture this: you've got a bio (a block I/O request, the main character) and you've got a css (a cgroup subsystem state, its emotional support), and you need them to be, like, linked. This is the function that does the linking. Periodt.


✨ NAME ✨

bio_associate_blkg_from_css β€” associate a bio with a specified css 🫢


🌸 SYNOPSIS 🌸

void bio_associate_blkg_from_css (struct bio *bio , struct
       cgroup_subsys_state *css );

No return value, it just does the thing. Void. Iconic behavior honestly πŸ’…


πŸŽ€ ARGUMENTS πŸŽ€

  • bio β€” the target bio 🎯 like, this is the one getting associated
  • css β€” the target css 🎯 the thing it's getting associated with

πŸ¦‹ DESCRIPTION πŸ¦‹

Okay so here's the vibe: this function associates bio with the blkg it finds by combining the css's blkg and the request_queue of the bio. Two ingredients, one blkg, slay 🧚

Now β€” and this is the important part, don't skip it β€” if the association fails, that's handled by walking up the blkg tree 🌳. Which means the blkg you end up associated with can be, like, anything between blkg and q->root_blkg. Not a bug, that's just how it goes.

When does that even happen? Only when a cgroup is dying πŸ’€ and then the remaining bios will spill over to the closest alive blkg. Rip to the dying cgroup but those bios are built different, they find a way 🌈

Also! A reference will be taken on the blkg, and it'll be released when bio is freed πŸ”₯ So like, the bookkeeping is handled, you don't gotta worry about it. No cap.


πŸ‘‘ SEE ALSO πŸ‘‘

Kernel file ./block/blk-cgroup.c β€” go read it, it's giving source of truth πŸ’œ


πŸ’‘ friendly reminder bestie: every single one of those above is a real page, go click around, iykyk

And that's the whole page! Source <pink>./block</pink>, dated <purple>October 2026</purple>, and yes the whole thing is filed under <hotpink>bio_associate_blkg_from_css(9)</hotpink> πŸ’– Go be a kernel girlie, you got this πŸ«Άβœ¨πŸŽ€

πŸ“¦ where this page comes from