i_blocks_per_folio(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ i_blocks_per_folio(9) ✨

okay so this is a page from the Kernel API Manual, manual section 9 (that's the kernel-API girlies πŸ’…), and it's all about i_blocks_per_folio β€” literally the function that tells you how many blocks fit in a folio. no cap, that's the whole vibe.


🌸 NAME 🌸

i_blocks_per_folio β€” how many blocks fit in this folio. that's it, that's the gig πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

unsigned int i_blocks_per_folio (const struct inode *inode , const
       struct folio *folio );

like, you hand it an inode and a folio, it hands you back an unsigned int. iconic signature behavior πŸ’–


πŸ’œ ARGUMENTS πŸ’œ

  • inode β€” the inode which contains the blocks. she's the container, the mother figure 🫢
  • folio β€” the folio. yes bestie, just the folio. that's the whole description. she's self-explanatory and she knows it ✨

🧚 DESCRIPTION 🧚

if the block size is larger than the size of this folio, return zero. that's the rule. no blocks fit, so you get a big fat 0 😭


πŸ”₯ CONTEXT πŸ”₯

the caller should hold a refcount on the folio to prevent it from being split.

bestie please hold that refcount πŸ™ˆ if the folio gets split while you're looking at her, that's on you and it's giving undefined chaos. main character responsibility energy.

πŸ‘‘ RETURN πŸ‘‘

the number of filesystem blocks covered by this folio. that's the answer, that's the tea 🌈


🌟 SEE ALSO 🌟

everything else living in the kernel's ./include/linux/pagemap.h file, and honestly? the whole friend group:

filemap_set_wb_err(9), filemap_check_wb_err(9), filemap_sample_wb_err(9), file_sample_sb_err(9), mapping_set_error(9), mapping_set_large_folios(9), mapping_align_index(9), mapping_pmd_folio_support(9), folio_flush_mapping(9), folio_inode(9), folio_attach_private(9), folio_change_private(9), folio_detach_private(9), fgf_t(9), fgf_set_order(9), write_begin_get_folio(9), filemap_get_folio(9), filemap_lock_folio(9), filemap_grab_folio(9), find_get_page(9), find_lock_page(9), find_or_create_page(9), grab_cache_page_nowait(9), folio_next_index(9), folio_next_pos(9), folio_file_page(9), folio_contains(9), page_pgoff(9), folio_pos(9), linear_page_delta(9), linear_page_index(9), linear_anon_page_index(9), folio_trylock(9), folio_lock(9), lock_page(9), folio_lock_killable(9), filemap_range_needs_writeback(9), struct readahead_control(9), page_cache_sync_readahead(9), page_cache_async_readahead(9), readahead_folio(9), readahead_pos(9), readahead_length(9), readahead_index(9), readahead_count(9), readahead_batch_length(9), folio_mkwrite_check_truncate(9)

like I said. the whole friend group. iykyk πŸ’€


and that's the page, bestie πŸŽ€ this edition came out of ./include/linux and is dated October 2026 β€” so print it, frame it, put it on your wall. slay βœ¨πŸ’–πŸ¦‹

πŸ“¦ where this page comes from