vdo_attempt_...one_pbn_lock(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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:


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