File system query

Valdis.Kletnieks at Valdis.Kletnieks at
Thu Jun 20 23:01:42 EDT 2013

On Fri, 21 Jun 2013 07:06:37 +0530, Dibyayan Chakraborty said:

> I am obviously one step closer to implementing the journaling in file
> system. But i didn't et the following things.
> What would be the correct sequence of steps in implementing it?

That will depend on how *your* file system implements journalling.
The correct sequence of steps for ext4 to do journaling is different
from how btrfs does its transaction journal.

In general, the tricky part is that after you log to the journal, you
still have to apply the updates to the filesystem - and do so in such a
way that if the system crashes while updating, you can always look at the
filesystem and the journal, and find a way to replay or rollback to put
the filesystem back to a consistent state. And there's *plenty* of corner
cases to deal with. For instance, log a file allocation to the journal, then
update the filesystem - but then die before you can flag the journal entry as
"written to filesystem".  You need to detect that it's a replay of an already
done event, and do something about it.

The *real* fun is trying to distinguish between "written to disk but not
removed from journal" and "90% updated to disk but not removed from journal" :)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 865 bytes
Desc: not available
Url : 

More information about the Kernelnewbies mailing list