switch_gc_head(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… switch_gc_head(9) β€” the kernel API manual, bestie edition

okay so this is switch_gc_head, from section 9 of the manual (kernel API, iykyk). it's a lil function in UBIFS land and honestly it's giving "quietly important." let's get into it 🫢


✨ NAME ✨

switch_gc_head β€” switch the garbage collection journal head. that's it, that's the whole vibe. the GC journal head? switched. πŸ’…


✨ SYNOPSIS ✨

int switch_gc_head (struct ubifs_info *c );

literally one argument, no drama, no cap.


✨ ARGUMENTS ✨

  • c β€” the UBIFS file-system description object. your whole file-system situation lives in here, bestie 🌸

✨ DESCRIPTION ✨

so what this function actually does: it switches the GC head over to the next LEB β€” and that LEB is the one reserved in c->gc_lnum. that's the spot. that's the destination. no detours πŸ’«

then it tells you how it went:

  • it returns 0 in case of success β€” slay, we love a clean win ✨
  • it returns -EAGAIN if a commit is required β€” so like, "not right now, we need a commit first" πŸ™ˆ
  • and it returns other negative error codes in case of failures β€” yeah those happen 😭
ngl, check the return value. -EAGAIN is not a fail, it's a "come back after the commit," and the other negative codes are the actual failures. keep those two vibes separate πŸŽ€

✨ SEE ALSO ✨

the kernel file ./fs/ubifs/gc.c is the main character here πŸ‘‘ and these functions are all in the group chat:


🌈 the sign-off 🌈

this page lives in ./fs/ubifs, and it's dated October 2026 β€” future-coded of it, honestly πŸ¦‹ and the page itself is switch_gc_head(9), which you already knew because i told you up top πŸ’œ

go forth and switch that GC head, bestie. periodt. πŸ’…βœ¨

πŸ“¦ where this page comes from