__devlink_s...id_decrement(9)
π
__devlink_snapshot_id_decrement β Kernel API Manual β¨
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 ofidβ 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:
- when a snapshot using the given id is deleted
- 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 π¦
- the kernel file
./net/devlink/region.cπ (that's where the source lives, iykyk) __devlink_snapshot_id_increment(9)__devlink_snapshot_id_insert(9)__devlink_region_snapshot_id_get(9)__devlink_region_snapshot_create(9)devl_region_create(9)devlink_region_create(9)devlink_port_region_create(9)devl_region_destroy(9)devlink_region_destroy(9)devlink_region_snapshot_id_get(9)devlink_region_snapshot_id_put(9)devlink_region_snapshot_create(9)
β 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
- 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