filemap_read(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ filemap_read(9) ✨

okay so bestie, this is a kernel API manual page (filemap_read) and honestly? it's giving "i read data from the page cache and i'm iconic about it." no cap, let's get into it. πŸ’…


🌸 NAME 🌸

filemap_read β€” Read data from the page cache. periodt. πŸ’–


πŸ¦‹ SYNOPSIS πŸ¦‹

ssize_t filemap_read (struct kiocb *iocb , struct iov_iter *iter ,
       ssize_t already_read );

πŸŽ€ ARGUMENTS πŸŽ€

  • iocb β€” The iocb to read. it's the main character of this operation, lowkey.
  • iter β€” Destination for the data. where all the good stuff goes. ✨
  • already_read β€” Number of bytes already read by the caller. like, they've already done some of the work, we're just picking up where they left off. 🫢

πŸ’œ DESCRIPTION πŸ’œ

Copies data from the page cache. fr fr, that's the whole vibe.

If the data is not currently present, it uses the readahead and read_folio address_space operations to fetch it. so like, if it's not already sitting there being pretty, it goes and gets it. no big deal. πŸ’…


πŸ”₯ RETURN πŸ”₯

Total number of bytes copied, including those already read by the caller. it counts everything, bestie β€” no gatekeeping. 😌

If an error happens before any bytes are copied, it returns a negative error number. so like, if it breaks before it even starts, you get a negative number. tragic, but that's the deal. πŸ’€


🌈 SEE ALSO 🌈

Kernel file ./mm/filemap.c and honestly the whole friend group:

filemap_remove_folio(9), filemap_fdatawrite_range(9), filemap_flush_range(9), filemap_flush(9), filemap_range_has_page(9), filemap_fdatawait_range(9), filemap_fdatawait_range_keep_errors(9), file_fdatawait_range(9), filemap_fdatawait_keep_errors(9), filemap_write_and_wait_range(9), file_check_and_advance_wb_err(9), file_write_and_wait_range(9), replace_page_cache_folio(9), softleaf_entry_wait_on_locked(9), folio_put_wait_locked(9), folio_unlock(9), folio_end_read(9), folio_end_private_2(9), folio_wait_private_2(9), folio_wait_private_2_killable(9), folio_end_writeback_no_dropbehind(9), folio_end_writeback(9), __folio_lock(9), page_cache_next_miss(9), page_cache_prev_miss(9), __filemap_get_folio_mpol(9), find_get_entries(9), find_lock_entries(9), filemap_get_folios(9), filemap_get_folios_contig(9), filemap_get_folios_tag(9), filemap_get_folios_dirty(9), generic_file_read_iter(9), filemap_splice_read(9), mapping_seek_hole_data(9), filemap_fault(9), read_cache_folio(9), mapping_read_folio_gfp(9), read_cache_page_gfp(9), __generic_file_write_iter(9), generic_file_write_iter(9), filemap_release_folio(9), filemap_invalidate_inode(9), filemap_cachestat(9).

like, that's the whole squad. iykyk. πŸ‘‘


bestie note: this page is from the Kernel API Manual, ./mm, dated October 2026. slay. πŸ’–βœ¨πŸŽ€πŸ¦‹πŸŒΈπŸ’…πŸ«ΆπŸ˜­πŸ”₯πŸ‘‘πŸŒˆβ­πŸ’€πŸ™ˆπŸ“πŸ§šπŸ’œ
πŸ“¦ where this page comes from