Linux Kernel Architecture

(Jacob Rumans) #1

Chapter 9: The Extended Filesystem Family


versions. Examples of this kind of enhancement are the journal introduced in Ext3
(discussed extensively in Section 9.3) and the provision of ACLs (access control lists)to
support finer-grained assignments of permissions than is possible with the classicUnix
Read/Write/Execute system for user/group/others. The full list of all enhancements
known to each kernel version is located inext2_fs.hin the form of pre-processor
definitions namedEXT2_FEATURE_COMPAT_FEATURE.

Kernel 2.6.24 includes the following compatible features:
<ext2_fs.h>

#define EXT2_FEATURE_COMPAT_DIR_PREALLOC 0x0001
#define EXT2_FEATURE_COMPAT_IMAGIC_INODES 0x0002
#define EXT3_FEATURE_COMPAT_HAS_JOURNAL 0x0004
#define EXT2_FEATURE_COMPAT_EXT_ATTR 0x0008
#define EXT2_FEATURE_COMPAT_RESIZE_INO 0x0010
#define EXT2_FEATURE_COMPAT_DIR_INDEX 0x0020
#define EXT2_FEATURE_COMPAT_ANY 0xffffffff

TheEXT2_FEATURE_COMPAT_ANYconstant can be used to test whetheranyfeature of this
category is present.

❑ Read-Only Features— Are enhancements that do not impair read access to a filesystem
when an obsolete version of the filesystem code is used. Write access, however, does
result in errors and inconsistencies in the filesystem. If a Read Only feature is set using
s_feature_ro_compat, the partition can be mounted in Read Only mode, and write access
is prohibited.

One example of a Read Only-compatible enhancement is thesparse superblockfeature,
which saves space by not storing a superblock in every block group of a partition. Because,
in general, the kernel uses only the (still present) superblock copy in the first block
group, there is no difference in terms of read access as modifications would be made to
the remaining — now no longer existent — superblock copies when the filesystem is
unmounted and could therefore overwrite important data.

As for the compatible features, a list of all known variants for the current kernel
version is provided inext2_fs.h. Again, pre-processor variables with the name
EXT2_FEATURE_RO_COMPAT_FEATUREare defined to assign a unique numeric value to each
enhancement or extension.

<ext2_fs.h>
#define EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER 0x0001
#define EXT2_FEATURE_RO_COMPAT_LARGE_FILE 0x0002
#define EXT2_FEATURE_RO_COMPAT_BTREE_DIR 0x0004
#define EXT2_FEATURE_RO_COMPAT_ANY 0xffffffff

❑ Incompatible features(s_incompat_features) — With regard to old versions
render a filesystem unusable if old code is used. A filesystem cannot be mounted
if an enhancement of this kind, which the kernel does not understand, is present.
EXT2_FEATURE_INCOMPAT_FEATUREmacros assign numeric values to the incompatible
enhancements. An example of this kind of enhancement is ‘‘on the fly‘‘ compression that
stores all files in packed form — compressed file contents are meaningless, in both Read
and Write mode, to filesystem code that cannot unpack them.
Free download pdf