allocate_and_lock_block(9)
π allocate_and_lock_block(9) β the kernel API manual, but make it make sense
okay so bestie, welcome to the allocate_and_lock_block(9) page from the Kernel API Manual β¨ this is a little function that lives in the kernel-adjacent world and honestly? it's giving "small but mighty" energy. let's get into it π«Ά
πΈ NAME πΈ
allocate_and_lock_block β literally just: attempt to allocate a block from this zone. that's the whole vibe. lowkey does what it says on the tin π
β¨ SYNOPSIS β¨
int allocate_and_lock_block (struct allocation *allocation );
that's it. that's the whole call. one argument, returns an int, no cap π
π― ARGUMENTS π―
allocationβ thestruct allocationof thedata_viothat's out here attempting to allocate. that's the thing you're passing in. it wants a block. be nice to it π
π¦ DESCRIPTION π¦
so here's the tea: if a block does get allocated, the recipient will also hold a lock on it. like, you don't just get the block, you get the block and the lock, packaged together, main character bundle deal π no separate step, no "come back later for your lock", it's included.
π₯ RETURN π₯
VDO_SUCCESSβ yay!! a block was allocated, slay π- an error code β ok so it didn't work out, but you get an error code back so at least you know what happened π
π SEE ALSO π
the whole friend group, fr fr:
- Kernel file
./drivers/md/dm-vdo/physical-zone.c vdo_is_pbn_read_lock(9)vdo_downgrade_pbn_write_lock(9)vdo_claim_pbn_lock_increment(9)vdo_assign_pbn_lock_provisional_reference(9)vdo_unassign_pbn_lock_provisional_reference(9)release_pbn_lock_provisional_reference(9)union idle_pbn_lock(9)struct pbn_lock_pool(9)return_pbn_lock_to_pool(9)make_pbn_lock_pool(9)free_pbn_lock_pool(9)borrow_pbn_lock_from_pool(9)initialize_zone(9)vdo_make_physical_zones(9)vdo_free_physical_zones(9)vdo_get_physical_zone_pbn_lock(9)vdo_attempt_physical_zone_pbn_lock(9)retry_allocation(9)continue_allocating(9)vdo_allocate_block_in_zone(9)vdo_release_physical_zone_pbn_lock(9)vdo_dump_physical_zone(9)
bestie reminder: it's an attempt. allocate_and_lock_block does not promise you a block. check that return value, always π
and that's the page!! brought to you by ./drivers/md/dm-vdo, dated October 2026 β mwah, go read the source, ily, bye π§ββοΈπ
π¦ 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