fscache_begin_cache_access(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– fscache_begin_cache_access πŸ’–

ok so this is the manual page for fscache_begin_cache_access(9) from the Kernel API Manual, and bestie, it's literally the "pin a cache so it can be accessed" function. let's get into it 🫢


✨ SYNOPSIS ✨

bool fscache_begin_cache_access (struct fscache_cache *cache , enum
       fscache_access_trace why );

yeah that's the whole signature, no cap πŸ’…


πŸŽ€ ARGUMENTS πŸŽ€

  • cache β€” the cache-level cookie πŸͺ (yes really, that's what it's called)
  • why β€” an indication of the circumstances of the access, for tracing πŸ” like it's for the receipts, yk?

🌸 DESCRIPTION 🌸

okay so the whole vibe here is: we attempt to pin the cache so it doesn't just dip while we're mid-access, and we return true if that worked out. it's giving "hold my spot bestie" 🀞

here's literally how it works, step by step, no skipping:

  1. if the cache tests as not live (state is not FSCACHE_CACHE_IS_ACTIVE), then we return false to indicate access was not permitted πŸ™…β€β™€οΈ like, door's closed, sorry babe.
  2. if the cache tests as live, then we increment the n_accesses count and then recheck the liveness β€” ending the access if it ceased to be live πŸ‘€ (the double-check is so real of it)
  3. when we end the access, we decrement n_accesses and wake up the any waiters if it reaches 0 πŸ’€βž‘οΈπŸ””
  4. whilst the cache is caching, n_accesses is kept artificially incremented to prevent wakeups from happening 🧚✨ (it's fake it till you make it, but for counters)
  5. when the cache is taken offline, the state is changed to prevent new accesses, n_accesses is decremented and we wait for n_accesses to become 0 ⏳ periodt.
lowkey important: steps 2 and 5 are the whole "pin so it doesn't go away mid-access" moment β€” if the liveness check fails you gotta end the access, no exceptions πŸ‘‘

🌈 SEE ALSO 🌈


and that's the page babes πŸ’œ this one's from ./fs/netfs, dated October 2026, sitting pretty in the Kernel API Manual as fscache_begin_cache_access(9) β€” iconic, no notes πŸ”₯πŸ‘‘

πŸ“¦ where this page comes from