calc_reserved(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… calc_reserved(9) β€” Kernel API Manual πŸ’…

okay bestie, welcome to the calc_reserved(9) page. This is the Kernel API Manual and we're about to calculate the number of blocks to keep reserved. Stay with me, it's giving big-brain GFS2 energy. 🧠✨


🌸 NAME 🌸

  • calc_reserved β€” Calculate the number of blocks to keep reserved.

✨ SYNOPSIS ✨

here's the exact sig, no cap:

unsigned int calc_reserved (struct gfs2_sbd *sdp );

πŸŽ€ ARGUMENTS πŸŽ€

  • sdp β€” The GFS2 superblock. That's the one.

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so this is complex. fr fr. We need to reserve room for all our currently used metadata blocks β€” e.g. normal file I/O rewriting file time stamps β€” and all our journaled data blocks for journaled files. The journaled-file examples are files in the meta_fs like rindex, or files for which chattr +j was done.

🚨 If we don't reserve enough space, corruption will follow. Not dramatic, just facts. Do not skimp on the reservation, bestie.

We can have metadata blocks and jdata blocks in the same journal. Each type gets its own log descriptor, and for that we need to reserve a block. In fact, each type has the potential for needing more than one log descriptor in cases where we have more blocks than will fit in a log descriptor. Also: metadata journal entries take up half the space of journaled buffer entries.

And we still need to reserve blocks for revoke journal entries, plus one for an overall header for the lot. The way this list keeps growing 😭.

πŸ’– RETURN πŸ’–

the number of blocks reserved. slay.

πŸ”₯ SEE ALSO πŸ”₯

Kernel file ./fs/gfs2/log.c β€” go read, iykyk β€” plus all these iconic functions:


with all the love, your GFS2 bestie πŸ’– Β· source/version: ./fs/gfs2 Β· date: October 2026 Β· manual: calc_reserved(9)

πŸ“¦ where this page comes from