jbd2_journal_forget(9)
π jbd2_journal_forget(9) π
okay bestie, so this is a page from the Kernel API Manual β yes, that Kernel API Manual β and we're talking about jbd2_journal_forget(9). come on, let's get into it π
β¨ NAME β¨
jbd2_journal_forget β literally just bforget() but for buffers that might be journaled. that's the whole vibe. π¦
πΈ SYNOPSIS πΈ
int jbd2_journal_forget (handle_t *handle , struct buffer_head *bh );
it returns an int, it takes two things, and yes the spacing is exactly like that, don't @ me π
π ARGUMENTS π
handleβ the transaction handle. the main character of this whole operation, fr.bhβ the bh we're about to 'forget'. quotes around "forget" are the original's, not mine, and honestly? iconic of them. π
π₯ DESCRIPTION π₯
okay so here's the tea π β we can only do the bforget if there are no commits pending against the buffer. no pending commits = you're clear. but if the buffer is dirty in the current running transaction, then we can safely unlink it. slay, lowkey.
and now the plot twist π β bh might not be a journalled buffer at all!! it could be a non-JBD buffer that just came off the hashtable. so like. check for this. do the vibe check. π«Ά this is not me being dramatic, this is the manpage telling you to check.
also, it decrements bh->b_count by one. one. just one. decrement responsibly. π
and the sweetest part?? you're allowed to make this call even if the handle has aborted β because it might be part of the caller's cleanup after an abort. it's giving emotional support function, honestly. π
ngl bestie, if you skip the "is this even a JBD buffer" check, that's on you. the page literally said "Check for this." π
π SEE ALSO π
kernel file ./fs/jbd2/transaction.c, and the whole friend group:
jbd2_journal_start(9)jbd2_journal_start_reserved(9)jbd2_journal_extend(9)jbd2__journal_restart(9)jbd2_journal_lock_updates(9)jbd2_journal_unlock_updates(9)jbd2_journal_get_write_access(9)jbd2_journal_get_create_access(9)jbd2_journal_get_undo_access(9)jbd2_journal_set_triggers(9)jbd2_journal_dirty_metadata(9)jbd2_journal_stop(9)jbd2_journal_try_to_free_buffers(9)jbd2_journal_invalidate_folio(9)
like, the entire roster. read them all, they're all so good. β
and that's the page!! π this little gift came out of ./fs/jbd2 and it's dated October 2026, and yes its own name is jbd2_journal_forget(9) because it's self-referential like that. mwah, bye 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