Journaling UFS with gjournal.

Eric Anderson anderson at centtech.com
Fri Jun 23 15:20:28 UTC 2006


Pawel Jakub Dawidek wrote:
> Hello.
> 
> For the last few months I have been working on gjournal project.
> To stop confusion right here, I want to note, that this project is not
> related to gjournal project on which Ivan Voras was working on the
> last SoC (2005).
> 
> The lack of journaled file system in FreeBSD was a tendon of achilles
> for many years. We do have many file systems, but none with journaling:
> - ext2fs (journaling is in ext3fs),
> - XFS (read-only),
> - ReiserFS (read-only),
> - HFS+ (read-write, but without journaling),
> - NTFS (read-only).
> 
> GJournal was designed to journal GEOM providers, so it actually works
> below file system layer, but it has hooks which allow to work with
> file systems. In other words, gjournal is not file system-depended,
> it can work probably with any file system with minimum knowledge
> about it. I implemented only UFS support.
> 
> The patches are here:
> 
> 	http://people.freebsd.org/~pjd/patches/gjournal.patch (for HEAD)
> 	http://people.freebsd.org/~pjd/patches/gjournal6.patch (for RELENG_6)
> 
> To patch your sources you need to:
> 
> 	# cd /usr/src
> 	# mkdir sbin/geom/class/journal sys/geom/journal sys/modules/geom/geom_journal
> 	# patch < /path/to/gjournal.patch
> 
> Add 'options UFS_GJOURNAL' to your kernel configuration file and
> recompile kernel and world.
> 
> How it works (in short). You may define one or two providers which
> gjournal will use. If one provider is given, it will be used for both -
> data and journal. If two providers are given, one will be used for data
> and one for journal.
> Every few seconds (you may define how many) journal is terminated and
> marked as consistent and gjournal starts to copy data from it to the
> data provider. In the same time new data are stored in new journal.

I'm not sure this is happening the way you describe exactly.  On my 
laptop, while rsyncing my /home partition to a newly created external 
disk (400G), I see 20MB/s writing to the journaled UFS2 device 
(/dev/label/backup.journal) passing through to the journal device 
(/dev/label/journal), then it switches to no writes to the journaled 
UFS2 device (/dev/label/backup.journal) (my rsync pauses) while the 
journaled  device (/dev/label/backup) writes at 20MB/s for about 3-10 
seconds.

> Let's call the moment in which journal is terminated as "journal switch".
> Journal switch looks as follows:
> 1. Start journal switch if we have timeout or if we run out of cache.
>    Don't perform journal switch if there were no write requests.
> 2. If we have file system, synchronize it.
> 3. Mark file system as clean.
> 4. Block all write requests to the file system.
> 5. Terminate the journal.
> 6. Eventually wait if copying of the previous journal is not yet
>    finished.

Seems like this is the point we are busy in.

> 7. Send BIO_FLUSH request (if the given provider supports it).
> 8. Mark new journal position on the journal provider.
> 9. Unblock write requests.
> 10. Start copying data from the terminated journal to the data provider.

And it seems that 10 is happening earlier on..

Is this all expected behaviour?

Thanks for the great work, and fantastic GEOM tools!

Eric




-- 
------------------------------------------------------------------------
Eric Anderson        Sr. Systems Administrator        Centaur Technology
Anything that works is better than anything that doesn't.
------------------------------------------------------------------------


More information about the freebsd-current mailing list