alloc_new_reservation(9)
π 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 π
0on success π₯³-1if we failed to find a reservation window in this group π
π SEE ALSO π
Kernel file ./fs/ext2/balloc.c β plus this whole squad right here:
__rsv_window_dump(9)goal_in_my_reservation(9)search_reserve_window(9)rsv_window_remove(9)ext2_init_block_alloc_info(9)ext2_discard_reservation(9)ext2_free_blocks(9)bitmap_search_next_usable_block(9)find_next_usable_block(9)ext2_try_to_allocate(9)find_next_reservable_window(9)try_to_extend_reservation(9)ext2_try_to_allocate_with_rsv(9)ext2_has_free_blocks(9)ext2_bg_has_super(9)ext2_bg_num_gdb(9)
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
- 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