Linux Kernel Architecture

(Jacob Rumans) #1

Chapter 9: The Extended Filesystem Family


The kernel includes a layer called ajournaling block device(JBD) layer to handle journals and associated
operations. Although this layer can be used on different filesystems, currently it is used only by Ext3. All
other journaling filesystems such as ReiserFS, XFS, and JFS have their own mechanisms. In the sections
below, therefore, JBD and Ext3 are regarded as a single unit.

Log Records, Handles,and Transactions


Transactions are not a monolithic structure used to implement the transaction concept. Owing to the
structure of filesystems (and also for performance reasons), it is necessary to break a transaction down
into smaller units, as shown in Figure 9-22.

Handle Handle Handle

Transaction
Log Record

Figure 9-22: Interaction of transactions, log records, and handles.

❑ Log recordsare the smallest units that can be logged. Each represents an individual update to a
block.
❑ (Atomic) handlesgroup together several log records on the system level. For example, if a write
request is issued using thewritesystem call, all log records involved in this operation are
grouped into a handle.
❑ Transactionsare groupings of several handles that ensure better performance.

9.3.2 Data Structures


Whereas transactions include data with system-wide validity, each handle is always associated with a
specific process. For this reason, the familiar task structure discussed in Chapter 2 includes an element
that points to the current process handle:

<sched.h>
struct task_struct {
...
/* journaling file system info */
void *journal_info;
...
}

The JBD layer automatically assumes responsibility for converting thevoidpointer to a pointer to
handle_t.Thejournal_current_handleauxiliary function is used to read the active handle of the
current process.
Free download pdf