>> Has anybody done any work on a journalling file system for Linux?
>> I am trying to implement a (simple) JFS at the kernel level.
>> If anybody has any pointers or tips, I'd be most grateful for them.
Yes, the NT filesystem. It has reached a useable (?) read-only
stage. I would not call it a simple JFS though. Microsoft now
uses a log file, Unicode, inodes, B-trees, free block bitmaps,
and somewhat packed blocklists. NTFS is nothing like the FAT crap.
Quote:>> I plan to have ide.c keep a log of its writes, and then when the
>> system is severely comprimised (pull the plug), it will restart
>> and work backwards through the log until it finds a viable state.
NTFS does that. (though not the Linux driver)
> To get the file system back to a known state you need to
> be able to recover the state of the disk block before they
> were overwritten.
> With databases (at least the one I was familiar with) there are
> two logs, a transaction log and a before image log and every so
> often the database with force an all quiet where there were no
> outstanding transcations and mark this in the logs.
NT does something like that. The Linux NTFS code could get gross.
> To recover from a failure the database would run back through
> the before image log applying them to the database back to the
> last all quiet, this would produce a consistant database and you
> could then apply the transaction log forward from the all quiet.
> If you wanted to apply this to a file system you'd need to either
> has a before image log or write updates to different places on the
> disk and remember where the old versions where.
NTFS uses an "infinite log" in the middle of the disk. I guess you
could call it a circular array. Log entries wrap around from one
end of the log to the other. On a 96 MB disk, the log file is 1 MB.
Quote:> All quiets culd be done by puting a logical barrier into the buffer
> cache so that all blocks dirtied before the barrier was put in were
> written out before any blocks dirtied after it, this would provide
> a consistant point for the file system.
NT would just keep running until the log runs out. Then it stops
all new filesystem operations and _rolls_ _back_ everything on
disk that could not be completed. Then the log file is cleared,
and the filesystem operations start again. I guess that would be
your "all quiet", retroactively.
Quote:> Don't know how pratical all this would be, you ceratinly have
> the problem of what happens when you run out of space.
The NT method would require severe hacks to the Linux VFS and
page cache I think. Perhaps we could calculate the maximum
required number of log file entries needed to complete the
current transactions. Then the "all quiet" could be done without
needing to roll back partially completed transactions.
You seem to understand the issue. Want to help? The mailing list
Put "subscribe linux-ntfs" in the body.
acahalan at cs.uml.edu (no junk mail please - I will hunt you down)