space_valid(9)
π space_valid(9) π
okay so real talk, bestie β this one lives in the Kernel API Manual and it's called space_valid, and honestly the name is doing exactly what it says on the tin. it validates free dpa space against constraints. no cap. π¦
β¨ SYNOPSIS β¨
void space_valid (struct nd_region *nd_region , struct nvdimm_drvdata
*ndd , struct nd_label_id *label_id , struct resource *prev , struct
resource *next , struct resource *exist , resource_size_t n , struct
resource *valid );
likeβ¦ that's a lot of arguments, i know, but we're gonna go through every single one together, hand in hand π«Ά
π ARGUMENTS π
nd_regionβ the hosting region of the free space. it's giving "where the party's at" energy.nddβ dimm device data, but make it for debug. literally just there so you can peek at it when things go sideways πlabel_idβ the namespace id that's about to get space allocated to it. main character of the allocation moment πprevβ the potential allocation that comes right before the free space. front neighbor vibes.nextβ the allocation that follows the given free space range. back neighbor vibes.existβ the first allocation with the same id in the mapping. the og, the one that got there first β¨nβ the range that must be satisfied for pmem allocations. lowkey important for the pmem girlies.validβ the free space range that we're actually validating. the whole point, honestly π―
πΈ DESCRIPTION πΈ
okay so here's the tea β
BLK-space is valid as long as it does not precede a PMEM allocation in a given region. that's the rule, that's the whole rule, no exceptions, periodt.
PMEM-space has to be contiguous and adjacent to an existing allocation β but only if one exists, bestie, don't come for me. if there's no existing allocation to be adjacent to, then the adjacency requirement just isn't a thing, iykyk.
and if you're reserving PMEM? any space is valid π₯ like, go off, choose your own adventure, the constraint is not constraining you.
π SEE ALSO π
- Kernel file
./drivers/nvdimm/namespace_devs.c nd_is_uuid_unique(9)shrink_dpa_allocation(9)grow_dpa_allocation(9)namespace_update_uuid(9)create_namespace_pmem(9)
go read those next, they're all connected, it's a whole cinematic universe fr fr π
ngl this one is short but she's important β get the space validity wrong and your pmem allocation is not gonna have a good time π
and that's the page! π from ./drivers/nvdimm, dated October 2026, this has been space_valid(9) β mwah, slay, bye bestie ππ§
π¦ 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