fscache_begin_cookie_access(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

okay bestie, buckle up β€” this one's from the Kernel API Manual and it's genuinely one of those little functions that keeps your filesystem from falling apart while you're not looking. let's get into it 🫢


✨ NAME ✨

fscache_begin_cookie_access β€” pin a cache so data can be accessed

like, grab the cache by the hand and be like "don't go anywhere, i need you for a sec" πŸ’…


✨ SYNOPSIS ✨

bool fscache_begin_cookie_access (struct fscache_cookie *cookie , enum
fscache_access_trace why );

she returns a bool, she takes a cookie, she takes a why, she's booked and busy ✨


✨ ARGUMENTS ✨

  • cookie β€” a data file cookie πŸͺ (yes really, that's the actual struct name, we love a themed kernel)
  • why β€” an indication of the circumstances of the access, for tracing purposes πŸ” β€” basically the receipts for why you're touching this thing

✨ DESCRIPTION ✨

so the whole vibe here is: attempt to pin the cache to prevent it from going away whilst we're accessing data, and return true if it worked. iconic behaviour, no notes. here's exactly how she does it, step by step πŸ‘‘

  1. if the cookie is not being cached (ie. FSCACHE_COOKIE_IS_CACHING is not set), we return false to indicate that access was not permitted. sorry bestie, door's closed πŸšͺ
  2. if the cookie is being cached, we increment its n_accesses count and then recheck the IS_CACHING flag, ending the access if it got cleared. yes she double-checks, she's thorough like that πŸ™ˆ
  3. when we end the access, we decrement the cookie's n_accesses and wake up any waiters if it reaches 0. everybody up, we're done here πŸ””
  4. whilst the cookie is actively being cached, its n_accesses is kept artificially incremented to prevent wakeups from happening. yes, artificially. it's called commitment πŸ’€
  5. when the cache is taken offline, or if the cookie is culled, the flag is cleared to prevent new accesses, the cookie's n_accesses is decremented, and we wait for it to become 0. the full shut-down-the-club routine πŸŒ™
also quick note: the why indicator is merely provided for tracing purposes β€” it's the vibe documentation, not the actual mechanics πŸŽ€

✨ SEE ALSO ✨

all her besties in the kernel file ./fs/netfs/fscache_cookie.c πŸ¦‹


and that's the whole page, bestie 🌸 sourced from ./fs/netfs, dated October 2026, and it's the fscache_begin_cookie_access(9) girl herself signing off β€” go pin that cache, you're gonna slay πŸ’œβœ¨πŸŽ€

πŸ“¦ where this page comes from