4285ch01.fm Draft Document for Review May 4, 2007 11:35 am
16 Linux Performance and Tuning Guidelines
Figure 1-14 VFS concept
1.3.2 Journaling
In a non-journaling file system, when a write is performed to a file system the Linux kernel
makes changes to the file system metadata first and then writes actual user data next. This
operations sometimes causes higher chances of losing data integrity. If the system suddenly
crashes for some reason while the write operation to file system metadata is in process, the
file system consistency may be broken. fsck will fix the inconsistency by checking all the
metadata and recover the consistency at the time of next reboot. But it takes way much time
to be completed when the system has large volume. The system is not operational during this
process.
A Journaling file system solves this problem by writing data to be changed to the area called
the journal area before writing the data to the actual file system. The journal area can be
placed both in the file system itself or out of the file system. The data written to the journal
area is called the journal log. It includes the changes to file system metadata and the actual
file data if supported.
As journaling write journal logs before writing actual user data to the file system, it may cause
performance overhead compared to no-journaling file system. How much performance
overhead is sacrificed to maintain higher data consistency depends on how much information
is written to disk before writing user data. We will discuss this topic in 1.3.4, “Ext3” on
page 18.
Figure 1-15 Journaling concept
VFS
System call
User Process cp
open(), read(), write()
translation for each file system
ext2 ext3 Reiserfs
NFS
XFS JFS
AFS VFAT proc

1. write journal logs

File system

Journal area

2. Make changes to actual
file system
3. delete journal logs

write