jbd2_journal_forget(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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:

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