__devlink_s...id_decrement(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

okay so bestie, welcome to the __devlink_snapshot_id_decrement(9) page πŸ’– this is the Kernel API Manual and honestly it's giving "small function, big responsibility." let's get into it 🌸


πŸŽ€ NAME πŸŽ€

__devlink_snapshot_id_decrement β€” decrease the number of snapshots using an id πŸ¦‹ literally what it says on the tin, and it ate


✨ SYNOPSIS ✨

void __devlink_snapshot_id_decrement (struct devlink *devlink , u32 id );

no cap, that's the whole signature πŸ‘‘ void return, so she's not giving you anything back β€” she just does the thing 🫢


🌸 ARGUMENTS 🌸

  • devlink β€” the devlink instance πŸ’« your main character struct, the one everything hangs off of
  • id β€” the snapshot id πŸ“ the specific lil id we're out here decrementing for

πŸ’€ DESCRIPTION πŸ’€

so here's the vibe: this function tracks when a snapshot is deleted and stops using an id πŸ”₯ like, someone's done with that id, so we're noting it.

the way it works is: load the count for the given id from the snapshot xarray, decrement it, and store it back πŸ’… that's it, that's the whole move. read, minus one, write. iconic behavior honestly.

and then β€” plot twist β€” if the count reaches zero, erase this id from the xarray, freeing it up for future re-use by devlink_region_snapshot_id_get 🌈 so when nobody's using the id anymore, it goes back in the pool for someone else to grab later. recycling queen πŸ‘‘

when does this get called? good question bestie 😭 it's called in two situations:

  1. when a snapshot using the given id is deleted
  2. when the initial allocator of the id is finished using it

both of those, periodt. if you're the one who grabbed the id originally and you're done, you call this. and if a snapshot that was using the id gets deleted, this gets called too 🧚


πŸ¦‹ SEE ALSO πŸ¦‹


⭐ friendly reminder from your girl: this one is the decrement β€” the increment version is right there in SEE ALSO if you need the other direction. don't mix 'em up bestie πŸ’œ

k byeeee πŸŽ€ this page came from ./net/devlink, dated October 2026, and it's part of the Kernel API Manual β€” go read the whole devlink region family, they're all lowkey obsessed with each other πŸ’–βœ¨πŸ¦‹

πŸ“¦ where this page comes from