fscache_read(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ fscache_read(9) β€” the Kernel API Manual, but make it cute ✨

okay bestie, so you know how fscache_read(9) lives in the Kernel API Manual? yeah. this is that. the function that starts a read from the cache and honestly? it's giving main character energy in the netfs cache world. let's get into it πŸ’…


🌸 NAME 🌸

fscache_read β€” Start a read from the cache. πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

int fscache_read (struct netfs_cache_resources *cres , loff_t start_pos
, struct iov_iter *iter , enum netfs_read_from_hole read_hole ,
netfs_io_terminated_t term_func , void *term_func_priv );

like, that's the whole signature. no cap. ⭐


πŸ’– ARGUMENTS πŸ’–

  • cres β€” The cache resources to use. 🫢
  • start_pos β€” The beginning file offset in the cache file. πŸ“
  • iter β€” The buffer to fill β€” and also the length. like it's doing double duty, iconic πŸ’…
  • read_hole β€” How to handle a hole in the data. πŸ•³οΈ
  • term_func β€” The function to call upon completion. πŸ“ž
  • term_func_priv β€” The private data for term_func. πŸ™ˆ

πŸ”₯ DESCRIPTION πŸ”₯

Start a read from the cache. cres indicates the cache object to read from and must be obtained by a call to fscache_begin_operation beforehand. like, don't skip that step, bestie, it's not optional 😭

The data is read into the iterator, iter, and that also indicates the size of the operation. start_pos is the start position in the file, though if seek_data is set appropriately, the cache can use SEEK_DATA to find the next piece of data, writing zeros for the hole into the iterator. so the hole gets filled with zeroes, literally 🩹

Upon termination of the operation, term_func will be called and supplied with term_func_priv plus the amount of data written, if successful, or the error code otherwise. so yeah, you get the data count or the error β€” one or the other, no vibes in between πŸ’€

read_hole indicates how a partially populated region in the cache should be handled. It can be one of a number of settings:

  • NETFS_READ_HOLE_IGNORE β€” Just try to read (may return a short read). like, we tried, that's what matters 🌈
  • NETFS_READ_HOLE_FAIL β€” Give ENODATA if we encounter a hole. it's giving no-nonsense, we're not playing about holes πŸ‘‘

🌟 SEE ALSO 🌟

Kernel file ./include/linux/fscache.h β€” and the whole fscache friend group, fr fr:

like, the whole squad. iykyk 🧚


aaaand that's the page, bestie! πŸ’œ this lil gem lives in ./include/linux and it's dated October 2026 in the Kernel API Manual, so shoutout to that version and that date β€” slay. go read from that cache, periodt. πŸ“βœ¨

πŸ“¦ where this page comes from