vdo_attempt_...one_pbn_lock(9)
π vdo_attempt_physical_zone_pbn_lock π
okay so this is a page from the Kernel API Manual, and the function name got so long the header literally had to abbreviate it to vdo_attempt_...one_pbn_lock(9) β she's iconic like that, bestie. anyway. let's get into it π«Ά
β¨ NAME β¨
vdo_attempt_physical_zone_pbn_lock β the function that tries to lock a physical block in the zone that's responsible for it. that's it, that's the vibe.
πΈ SYNOPSIS πΈ
int vdo_attempt_physical_zone_pbn_lock (struct physical_zone *zone ,
physical_block_number_t pbn , enum pbn_lock_type type , struct pbn_lock
**lock_ptr );
π ARGUMENTS π
zoneβ the physical zone that's responsible for the PBN. she's the main character of this whole situation lowkey.pbnβ the physical block number you wanna lock. yes. that one.typeβ the type you initialize a brand new lock with, if we end up making one.lock_ptrβ a pointer whose whole job is to receive the lock, whether that lock is existing or new. either way it's coming home in this pointer.
π¦ DESCRIPTION π¦
so here's the tea β β if the PBN is already locked, we just hand you back the existing lock. no drama, no new objects, we're reusing, we're sustainable, we're slaying.
otherwise? a new lock instance gets borrowed from the pool, initialized, and returned to you. and here's the part you gotta pay attention to: the lock owner will be NULL for a new lock acquired by the caller β meaning you are responsible for setting that field, and you gotta do it promptly, fr fr, don't be out here leaving it NULL and wandering off π
the lock owner will be non-NULL when there's already an existing lock on the PBN. so like, if you see a non-NULL owner, that's your sign someone else is already in there. read the room, iykyk.
β RETURN β
VDO_SUCCESS or an error. that's it. if it works it's a slay, if it doesn't it's an error, we move.
π₯ SEE ALSO π₯
the whole friend group π«Ά all of these are hanging out in the 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)allocate_and_lock_block(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)
and that's the whole page, bestie π this little masterpiece lives in ./drivers/md/dm-vdo, dated October 2026, and it goes by vdo_attempt_...one_pbn_lock(9) β short name, huge energy. go lock some physical blocks, you got this πβ¨
π¦ 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