fscache_read(9)
β¨ 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 forterm_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β GiveENODATAif 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:
fscache_acquire_volume(9)fscache_relinquish_volume(9)fscache_acquire_cookie(9)fscache_use_cookie(9)fscache_unuse_cookie(9)fscache_relinquish_cookie(9)fscache_update_cookie(9)fscache_resize_cookie(9)fscache_invalidate(9)fscache_operation_valid(9)fscache_begin_read_operation(9)fscache_end_operation(9)fscache_begin_write_operation(9)fscache_write(9)fscache_clear_page_bits(9)fscache_write_to_cache(9)fscache_note_page_release(9)
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
- 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