WAPBL(4) NetBSD Kernel Interfaces Manual WAPBL(4)
NAME
WAPBL -- Write Ahead Physical Block Logging file system journaling
SYNOPSIS
options WAPBL
options WAPBL_DEBUG
options WAPBL_DEBUG_SERIALIZE
DESCRIPTION
The WAPBL driver provides meta-data journaling for file systems. In par-
ticular, it is used with the fast file system (FFS) to provide rapid file
system consistency checking after a system outage. It also provides bet-
ter general-use performance over regular FFS.
WAPBL currently maintains its journal in one of two locations:
- After the file system
The journal is placed in the same partition as the file system,
but between the file system and the end of the partition.
- Within the file system
The journal is allocated as a special contiguous file within the
file system. The journal file is not visible via normal file
system access.
A new journal is created automatically when a file system is mounted via
mount(8) with the -o log option. If no journal size has been specified
with tunefs(8), then the size of the journal will be based on 1MB of
journal per 1GB of file system, to a maximum journal size of 64MB.
If there is adequate space between the end of the the file system and the
end of the partition, then unless the journal size has been specified
with tunefs(8) then the journal will be created after the file system.
To obtain space between the file system and the end of the partition the
size of the partition can be adjusted using disklabel(8). Care must be
taken not to damage existing data on existing partitions, but this method
will work well if, for example, a swap partition can be shrunk in order
to accommodate the journal after the file system on a partition before
the swap partition.
For a new file system,
newfs -s -64m /dev/rwd0a
can be used to leave space for a 64MB journal at the end of /dev/rwd0a.
To specify the size of the journal within the file system tunefs(8) can
be used as follows:
tunefs -l 64m /dev/rwd0a
to indicate that a journal of size 64MB on the file system on /dev/rwd0a
should be created the next time that file system is mounted. This must
be done before the file system is mounted with the ``-o log'' option.
For existing file systems and general use, however, simply using
mount -o log /dev/rwd0a /mnt
will be sufficient to create an appropriate journal within the file sys-
tem. Running
tunefs -l 0 /dev/rwd0a
will schedule the log for removal on the next read-write mount, and run-
ning
tunefs -l 0 /dev/rwd0a
followed by
mount -o log /dev/rwd0a /mnt
will remove the log and then re-create it with the default size. This
method can also be used to grow or shrink the size of the journal.
With the journal, fsck(8) is no longer required at system boot. If the
system has been shutdown in an unclean fashion then the journal will be
replayed when the file system is mounted. fsck(8) can still be used to
force a consistency check of the file system should that be desired.
WAPBL(8) has a number of debugging options. The option
options WAPBL_DEBUG
turns on general debugging. The option
options WAPBL_DEBUG_SERIALIZE
forces the serialization of all IO. This is currently be used to help
alleviate a performance issue seen on multi-core machines, where multiple
simultaneous extractions of tar-files can cause degenerate performance.
SEE ALSO
config(1), fsck(8), newfs(8), mount(8), umount(8)
CAVEATS
An unreplayed WAPBL journal (eg after a crash or power failure) may cause
problems if the file system is then used with an older kernel or userland
what isn't WAPBL aware.
An older fsck(8) that isn't WAPBL aware will not be able to deal with an
in-filesystem log.
WAPBL requires the super block to be in the UFS2 format. Older FFSv1
file systems will need to be updated to the newer super block layout with
the -c option to fsck_ffs(8).
fsync(2) causes the journal to be committed to disk, resulting in non-
negligible performance issues. This can have an impact on database soft-
ware and other software that calls fsync(2) often.
File system snapshots (fss(4)) currently do not work with WAPBL.
There are some pending issues with high metadata-rate workloads (like
multiple simultaneous tar-file extractions) resulting in degenerate file
system performance. The current work-around is to use
options WAPBL_DEBUG_SERIALIZE
as mentioned above.
In-file system log allocation should be done on a relatively quiet file
system. The error path for log allocation failures could result in a
``dangling inode'' issue, requiring an fsck(8) to fix.
If the file system is full or close to full then making a journal can
fail.
HISTORY
WAPBL was originally written by Darrin B. Jewell while at Wasabi Systems
Inc. Wasabi Systems contributed the code to NetBSD and was integrated by
Simon Burge, Antti Kantee, Andy Doran, and Greg Oster.
WAPBL first appeared in NetBSD 5.0.
NetBSD 5.0 July 21, 2008 NetBSD 5.0
