bch_bio_alloc_pages(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– bch_bio_alloc_pages(9) πŸ’–

okay so bestie, welcome to the Kernel API Manual β€” yes that's the manual name, we're being fancy today πŸ‘‘ β€” and today's main character is bch_bio_alloc_pages, a little function that hands out pages like they're concert tickets 🎟️


✨ NAME ✨

bch_bio_alloc_pages β€” allocates a single page for each bvec in a bio. literally one page per bvec, no more no less, it's giving fairness πŸ’…


🌸 SYNOPSIS 🌸

int bch_bio_alloc_pages (struct bio *bio , gfp_t gfp_mask );

πŸŽ€ ARGUMENTS πŸŽ€

  • bio β€” the bio you want pages for πŸ¦‹ this is the one getting pampered
  • gfp_mask β€” the flags for allocation, aka the vibe instructions for the allocator ✨

πŸ’œ DESCRIPTION πŸ’œ

So it allocates pages up to bio->bi_vcnt. that's the ceiling, bestie, it stops there, iconic behavior 🫢

Returns 0 on success 😌 and -ENOMEM on failure 😭. and hear me out β€” on failure, any allocated pages are freed. no leaks, no mess, she cleans up after herself, we love a responsible queen πŸ‘‘


🌈 SEE ALSO 🌈


ngl if you're poking around in bcache utility code, those two are your next stops, iykyk πŸ”₯

⭐ and that's the whole page fr fr β€” brought to you by ./drivers/md/bcache, dated October 2026, and living its best life as bch_bio_alloc_pages(9). mwah, go read some more kernel docs, ily πŸ’–πŸŽ€

πŸ“¦ where this page comes from