Linux Kernel Architecture

(Jacob Rumans) #1

Chapter 9: The Extended Filesystem Family


Address SpaceOperations


In Section 9.2.4, the address space operations associated with the Ext2 filesystem are discussed. For the
most part, functions whose names are prefixed withext2_are assigned to the individual function point-
ers. At first glance, it could therefore be assumed that they are all special implementations for the Second
Extended Filesystem.

However, this is not the case. Most of the functions make use of standard implementations of the virtual
filesystem, which uses the function discussed in Section 9.2.4 as an interface to the low-level code. For
example, the implementation ofext2_readpageis as follows:

fs/ext2/inode.c
static int ext2_readpage(struct file *file, struct page *page)
{
return mpage_readpage(page, ext2_get_block);
}

This is simply a transparent front end for thempage_readpagestandard function (introduced in
Chapter 16) whose parameters are a pointer toext2_get_blockand the memory page to be processed.

ext2_writepageis used to write memory pages and is similar in terms of its implementation:

fs/ext2/inode.c
static int ext2_writepage(struct page *page, struct writeback_control *wbc)
{
return block_write_full_page(page, ext2_get_block, wbc);
}

Again, a standard function described in Chapter 16 is used. This function is associated with the low-level
implementation of the Ext2 filesystem usingext2_get_block.

Most other address space functions provided by the Ext2 filesystem are implemented via similar front
ends that useext2_get_blockas a go-between. It is therefore not necessary to discuss additional Ext2-
specific implementations because the functions described in Chapter 8 together with the information on
ext2_get_blockin Section 9.2.4 are all we need to know about address space operations.

9.3 Third Extended Filesystem


The third extension to the Ext filesystem, logically known asExt3,featuresajournalin which actions
performed on the filesystem data are saved. This helps to considerably shorten the run time offsck
following a system crash.^21 Since the underlying filesystem concepts not related to the new journal
mechanism have remained unchanged in the thirdversion of the filesystem, I will discuss only the
new Ext3 capabilities. However, for reasons of space, I will not delve too deeply into their technical
implementation.

The transaction concept originates from the database sector, where it helps guarantee data consistency
if operations are not completed. The same consistency problem (which is not specific to Ext) arises in

(^21) On filesystems with several hundred gigabytes, consistency checks may take a few hours depending on system speed. This down-
time is not acceptable on servers. But even PC users appreciate the fact that consistency checks take just a few seconds rather than
several minutes.

Free download pdf