Re: [PATCH] Change ll_rw_block() calls in JBD

From: Stephen C. Tweedie
Date: Thu May 18 2006 - 18:24:53 EST


Hi,

On Thu, 2006-05-18 at 17:11 +0200, Zoltan Menyhart wrote:

> > + was_dirty = buffer_dirty(bh);
>
> Why do not we use "buffer_jbddirty()"?

jbddirty is what we use for metadata that we don't want to get written
to disk yet.

For journaling to work, we must ensure that the transaction's metadata
gets written to and committed in the journal before it is allowed to be
written back to main backing store. If we don't, and writeback occurs
early, then on a crash we can't rollback to the previous transaction.

So when we mark metadata as dirty we set the jbddirty flag but do *not*
set the normal dirty flag; so until the buffer is journaled, it is not
eligible for normal writeback.

This whole mechanism is only useful for metadata (plus data if we're in
data=journal mode.) For normal ordered data writes, we never use
jbddirty because there's just no problem if the data is written before
the transaction completes.

--Stephen


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/