__gfs2_log_reserve(9)
π __gfs2_log_reserve β the Kernel API Manual, but make it make sense π
okay bestie, so this is a page out of the Kernel API Manual (Linux kernel docs, we love her) and it's all about __gfs2_log_reserve β the little function that goes "yeah sure, you can have some log space, hold on" πΈ
β¨ NAME β¨
__gfs2_log_reserve β Make a log reservation. That's it, that's the whole job. A reservation. For the log. Slay π
π¦ SYNOPSIS π¦
void __gfs2_log_reserve (struct gfs2_sbd *sdp , unsigned int blks ,
unsigned int taboo_blks );
it returns void, so likeβ¦ it gives you nothing back. it just does the thing. main character energy tbh π
π ARGUMENTS π
sdpβ The GFS2 superblock. the big boss struct, the one everything hangs off of π«Άblksβ The number of blocks to reserve. this is how much you're asking for. be reasonable.taboo_blksβ The number of blocks to leave free. the taboo blocks, the untouchables, the ones you do not spend π
β DESCRIPTION β
so here's the vibe check: taboo_blks is set to 0 for logd, and it's set to GFS2_LOG_FLUSH_MIN_BLOCKS for all other processes. why? because when the log is almost full, logd still needs to be able to call gfs2_log_flush one more time without blocking β and that flush advances the tail and frees up more log space for everyone. it's giving teamwork πβ¨
we no longer flush the log here, ngl. instead we wake up logd and let it do that for us. and to avoid the thundering herd π (yes that's the real term, iconic) and to make sure we deal fairly with queued waiters, we use an exclusive wait.
which means: when we get woken with enough journal space to grab our reservation, we then need to wake the next waiter on the list. pass it on, bestie π literally paying it forward but for kernel locks.
π₯ SEE ALSO π₯
- Kernel file
./fs/gfs2/log.c gfs2_struct2blk(9)gfs2_remove_from_ail(9)gfs2_ail1_start_one(9)gfs2_ail1_flush(9)gfs2_ail1_start(9)gfs2_ail1_empty_one(9)gfs2_ail1_empty(9)gfs2_log_is_empty(9)gfs2_log_release_revokes(9)gfs2_log_release(9)__gfs2_log_try_reserve(9)gfs2_log_try_reserve(9)gfs2_log_reserve(9)log_distance(9)calc_reserved(9)gfs2_flush_revokes(9)gfs2_write_log_header(9)log_write_header(9)gfs2_ail_drain(9)empty_ail1_list(9)gfs2_trans_drain(9)__gfs2_log_flush(9)gfs2_merge_trans(9)gfs2_log_commit(9)gfs2_log_shutdown(9)gfs2_logd(9)
like, that's the whole friend group right there π go read all of them, iykyk π
lowkey a reminder: this page lives under./fs/gfs2in the kernel tree, from October 2026, and it's version-tagged__gfs2_log_reserve(9)β so if you're citing it, that's the receipt π§Ύπ
mwah, go reserve some log blocks responsibly, bestie ππ§π
π¦ 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