2008-08-25 12:05:01

by Hiroyasu OHYAMA

[permalink] [raw]
Subject: Question : ext2 compatibility feature mechanism

From: Hiroyasu Ohyama.

I develop software that write format of ext2 to block device for enjoyment like 'mke2fs'.

To develop this, I've read the book of 'Understanding Linux Kernel', linux kernel document which is Documentation/filesystems/ext2.txt and source code of ext2fs which is 'http://e2fsprogs.sourceforge.net/'.

But I couldn't obtain some infomation about ext2 filesystem.
That is compatibility feature mechanism which is supported by ext2 revision 1.

Of course, the device file that is created by my program could be mounted on linux. But I really want to know these mechanism.
To be more specific, I wnat to know what will happen, if I operate bitmap of super block parameter of s_feature_compat, s_feature_incompat and s_feature_ro_compat.

Could you please give me the documents that is written about ext2 filesystem at length, especially compatibility feature mechanism.

Thank you.


2008-08-25 14:41:44

by Theodore Ts'o

[permalink] [raw]
Subject: Re: Question : ext2 compatibility feature mechanism

On Mon, Aug 25, 2008 at 09:04:48PM +0900, [email protected] wrote:
>
> Could you please give me the documents that is written about ext2
> filesystem at length, especially compatibility feature mechanism.

Please check out the Articles and Publiciations page on the ext4 wiki:

http://ext4.wiki.kernel.org/index.php/Publications

The short version for how the compatibility feature mechanism works is
that there are three bitmasks, compat, rocompat, and incompat. The
ext2/ext3/ext4 filesystem code in the kernel uses the these feature
bitmasks to test for the presence of features it understands, and will
read and write to the filesystem appropriately depending on which
features are enabled.

For bits in the feature bitmasks that the filesystem does not
recognize, bits in the "compat" bitmask are assumed to be changes that
are fully forwards compatible, so an implementation which sees a bit
in the "compat" bitmask which it doesn't understand should still feel
free to mount the filesystem and modify it as necessary. If an
implementation sees a bit in the "rocompat" bitmask that it does not
understand, it is safe to mount the filesystem read/only, but
modifying the filesystem may likely damage the filesystem. And if an
implementation sees a bit in the "incompat" bitmask that it does not
understand, it should reject mounting the filesystem entirely,
read/only or read/write.

E2fsck uses a much more stringent standard, in that if there are any
bits in the bitmask that it does not undersatnd, it will refuse to
touch the filesystem altogether, lest it damage the filesystem and
lose data as it tries to repair it.

Regards,

- Ted