[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: ext3_free_data()



Hi,

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?

Cheers,
 Stephen




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]