cache_key_invalid(9)
π cache_key_invalid(9) β from the Kernel API Manual, bestie
okay so picture this: you're deep in dm-pcache land and you need to know if a cache key has, like, expired. that's it. that's the whole function. let me tell you everything π«Ά
β¨ NAME β¨
cache_key_invalid β literally just checks if a cache key is invalid. that's the vibe check. π
πΈ SYNOPSIS πΈ
bool cache_key_invalid (struct pcache_cache_key *key );
π¦ ARGUMENTS π¦
keyβ a pointer to astruct pcache_cache_keystructure. yeah. that's the one you're checking. π
π DESCRIPTION π
So it returns true if the cache key is invalid because its generation is less than the generation of its segment β otherwise it returns false. simple as that, no cap. β¨
Now here's the lore, because it's actually kind of iconic: when the GC (garbage collection) thread decides a segment is reclaimable, it increments that segment's generation (gen). but β and this is the key part β it does not immediately remove all the related cache keys. not even close. so when you later go to access one of those cache keys, this function is exactly what you use to figure out whether that cache key has already become invalid. it's giving "cleanup crew hasn't shown up yet but the eviction notice is already posted" energy π
π₯ SEE ALSO π₯
Kernel file ./drivers/md/dm-pcache/cache.h, plus my whole friend group:
cache_seg_is_ctrl_seg(9)cache_seg_id_valid(9)cache_key_cutfront(9)cache_key_cutback(9)cache_key_data_crc(9)kset_onmedia_valid(9)cache_seg_remain(9)cache_key_lstart(9)cache_key_lend(9)cache_pos_onmedia_crc(9)
like, go read them, they're all slay π
and that's the whole page, bestie! π this one came straight out of ./drivers/md/dm-pcache, dated October 2026 β so yeah, future vibes, main character energy, periodt. π§π
π¦ 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