gfs2_block_map(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ gfs2_block_map(9) ✨

okay so real talk, this page lives in the Kernel API Manual and it's all about one little function that maps blocks. bestie, let's get into it 🫢


πŸ’… SYNOPSIS

int gfs2_block_map (struct inode *inode , sector_t lblock ,
                    struct buffer_head *bh_map , int create );

like, that's the whole vibe. one function, four args, and it returns an int. slay ✨


πŸŽ€ ARGUMENTS

  • inode β€” the inode, obviously πŸ’β€β™€οΈ the star of the show.
  • lblock β€” the logical block number. like, the block number in logical land, not disk land.
  • bh_map β€” the bh that's getting mapped. this is the buffer head doing the actual work.
  • create β€” true if it's ok to alloc blocks to satisfy the request πŸ‘€ so basically "can I go shopping for new blocks if I need to".

πŸ¦‹ DESCRIPTION

okay so first thing first: the size of the requested mapping is defined in bh_map->b_size. that's where it lives. no cap.

When lblock is not mapped, this function clears buffer_mapped(bh_map) and leaves bh_map->b_size unchanged. so like, it just kind of... unmapped-vibes it. 🫠

But when lblock and successive blocks are mapped β€” up to the requested size β€” it sets buffer_mapped(bh_map) and sets bh_map->b_size to indicate the size of the mapping. so now the buffer knows what it's got. iconic behavior honestly πŸ’…

It also sets buffer_boundary if a read of metadata will be required before the next block can be mapped. that's your little heads-up that you gotta go read some metadata first, no biggie.

And it sets buffer_new if new blocks were allocated. that's a "hey, these blocks are fresh out of the oven" signal πŸ“


πŸ”₯ RETURN

Returns errno. that's it. that's the value.


🌈 SEE ALSO

Kernel file ./fs/gfs2/bmap.c β€” and the whole squad:


okay that's the whole page bestie, go map some blocks πŸ’–

this lil masterpiece comes to you from ./fs/gfs2, dated October 2026, and it's filed under gfs2_block_map(9) β€” mwah 😘 πŸŽ€

πŸ“¦ where this page comes from