Stephen C. Tweedie
sct at redhat.com
Thu Apr 15 11:12:34 UTC 2004
On Thu, 2004-04-01 at 10:40, Scorpion Yang wrote:
> why is there a window between statements "err =
> ext3_journal_get_write_access(handle, this_bh);" and
> "ext3_journal_dirty_metadata(handle, this_bh);" ?
That's the whole point of the journaling mechanism. To modify a block
of metadata on the ext3 filesystem, you need to get write access first,
then change the buffer, then queue the changes for the journal. There
*has* to be a window between getting the write access and committing it,
because that's the window where the buffer is allowed to be changed!
The issue is that ext3 tries to do zero-copy writing of metadata to the
journal whenever possible. So, a given buffer_head at some point in
time might actually be waiting to be written to the journal. To
maintain journal integrity, we cannot touch that data --- so we need to
do a "get_write_access()" first so that the jbd layer can copy out the
data that's destined for the journal. The caller can then safely modify
the primary contents of the buffer_head.
> In my test, there is an error in journal_dirty_metadata: jh is null
In what context?
More information about the Ext3-users