switch_gc_head(9)
π 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
0in case of success β slay, we love a clean win β¨ - it returns
-EAGAINif 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:
data_nodes_cmp(9)sort_nodes(9)move_node(9)move_nodes(9)gc_sync_wbufs(9)ubifs_garbage_collect_leb(9)ubifs_garbage_collect(9)ubifs_gc_start_commit(9)ubifs_gc_end_commit(9)ubifs_destroy_idx_gc(9)ubifs_get_idx_gc_leb(9)
π 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
- 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