Linux Kernel Architecture

(Jacob Rumans) #1

Chapter 9: The Extended Filesystem Family


not supported by the Minix filesystem — for example, the length of filenames was still restricted to 14
characters — rather short, but still better than the 8.3 scheme supported by another operating system that
was quite ubiquitous at that time!

This fact promoted the development of theExtended Filesystem, which, although a great improvement
on the Minix filesystem, still had clear deficits in terms of performance and functionality as compared
to commercial filesystems.^2 Only with the development of the second version of this file system, known
unsurprisingly as theSecond Extended Filesystemor Ext2 for short, was an extremely powerful filesystem
available that neither then nor now needed to fear comparison with commercial products. Its design was
influenced primarily by theFast File System(FFS) from the BSD world (described in detail in [MBKQ96]).

The Ext2 filesystem focused on high performance and on the goals summarized below and defined by
the filesystem authors in [CTT]:

❑ Support for variable block sizes to enable the filesystem to cope with anticipated usage (many
big files or many small files).
❑ Fast symbolic links, whose link target is stored in the inode itself (and not in the data area) if the
name of the target is short enough.
❑ Integration of extensions into the design without having to reformat and reload the hard disk to
migrate from the old to the new version.
❑ Minimization of the effect of system crashes by means of a sophisticated strategy of data manip-
ulation on the storage medium. The filesystem can normally be restored to a state in which
auxiliary tools (fsck) are at least able to repair it so that it can be used again. (This does not
exclude the possibility that data are lost.)
❑ Use of special attributes (not found in classicUnixfilesystems) to label files as unchangeable.
These allow important configuration files, for example, to be protected from unintentional
changes — even by the superuser.

Today, these features are standard requirements for any filesystem that is used on production machines.
Many new filesystems that were devised after Ext2 provide much additional functionality. Nevertheless,
the extended filesystem family is still quite apt for a large range of applications. One particular advantage
should not be underestimated: The code for Ext2 is very compact compared with that for more modern
filesystems. Less than 10,000 lines suffice for the implementation, compared with more than 30,000 for
JFS and roughly 90,000 for XFS.

9.2.1 Physical Structure


Various structures, defined as C data types in the kernel, must be created to hold filesystem data — file
contents, representation of the directory hierarchy, and associated administration data such as access
permissions or user and group affiliations, as well as metadata to manage filesystem-internal information.
This is necessary so that data can be read from block devices for analysis. Obviously persistent copies of
these structures need to reside on the hard disk so that data are not lost between working sessions and are
still available the next time the kernel is activated. Because hard disk and RAM requirements differ, there

(^2) Another filesystem of the time that has now fallen into oblivion (and for which kernel support has long been withdrawn) is the Xia
filesystem, an enhancement of the Minix filesystem. The author nevertheless still has fond memories of using this filesystem for one
of his first Linux installations, a choice that did not prove to be very visionary...

Free download pdf