alloc_new_reservation(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– alloc_new_reservation(9) πŸ’–

okay so this is a page straight out of the Kernel API Manual bestie, and it's about alloc_new_reservation β€” literally "Allocate a new reservation window." ✨ Sound fancy? It is. Let's get into it 🫢


✨ NAME ✨

alloc_new_reservation β€” Allocate a new reservation window. πŸŽ€


🌸 SYNOPSIS 🌸

int alloc_new_reservation (struct ext2_reserve_window_node *my_rsv ,
ext2_grpblk_t grp_goal , struct super_block *sb , unsigned int group ,
struct buffer_head *bitmap_bh );

πŸ¦‹ ARGUMENTS πŸ¦‹

  • my_rsv β€” the reservation we're currently using. like, the one already in your hand πŸ’…
  • grp_goal β€” the goal block, and it's relative to the start of the group. keep that in mind, it matters later πŸ‘€
  • sb β€” the super block. yes, the whole super block. iconic πŸ‘‘
  • group β€” the group we are trying to allocate in. that's the vibe check zone 🧚
  • bitmap_bh β€” the block group block bitmap. the little map of what's free and what's not πŸ—ΊοΈ

πŸ”₯ DESCRIPTION πŸ”₯

So to make a new reservation, we search part of the filesystem reservation list β€” specifically the list inside the group. Then we try to allocate a new reservation window near grp_goal, or, if grp_goal is negative, at the beginning of the group. 🏁

First we find a reservable space after the goal. Then, from there, we check the bitmap for the first free block after it. If there's no free block all the way until the end of the group? then the whole group is full and we failed 😭 like, nothing we can do, it's giving fully booked.

Otherwise β€” check if that free block is inside the expected reservable space. If so? we succeed. slay πŸŽ‰βœ¨

And if the first free block is outside the reservable space? then we start from that first free block, search for the next available space, and go on. and on. and on. πŸ’€ (just keep going, bestie)

On success, a new reservation will be found and inserted into the list. It contains at least one free block, and it does not overlap with other reservation windows. no overlapping, no drama, we don't do that here πŸ™ˆ


πŸ’œ RETURN πŸ’œ

  • 0 on success πŸ₯³
  • -1 if we failed to find a reservation window in this group πŸ˜”

🌈 SEE ALSO 🌈

Kernel file ./fs/ext2/balloc.c β€” plus this whole squad right here:


okay that's the whole page, no cap, every last detail is here πŸ’…

and for the sign-off: this one lives in ./fs/ext2, dated October 2026, in the Kernel API Manual β€” so if anyone asks where you got your reservation-window lore from, you know exactly what to tell them πŸ«ΆπŸ’– bye bestie, go allocate something cute βœ¨πŸŽ€

πŸ“¦ where this page comes from