Whamcloud - gitweb
Reserve the EXT4_FEATURE_INCOMPAT_DIRDATA feature flag
authorAndreas Dilger <adilger@sun.com>
Wed, 2 Jun 2010 02:21:42 +0000 (22:21 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Wed, 2 Jun 2010 14:41:54 +0000 (10:41 -0400)
Reserve the EXT4_FEATURE_INCOMPAT_DIRDATA feature flag for adding
extra file data in ext2_dir_entry_2 entries.

This changes the on-disk layout in the following way.

Firstly, the ext2_dir_entry_2 file_type field now has a mask: that
limits the "filetype" information to the low 4 bits of this field.
Since these values are sequentially assigned, this allows for up to 7
more filetypes to be assigned.  When reading the "filetype" field, the
high 4 bits should be masked off when converting to DT_* filetypes for
userspace.

The high 4 bits of "filetype" are used as a bitmask to register up to
4 different "extended" directory entry fields.  Extended data fields
are packed without alignment into the directory entry after the "name"
field in order of increasing bitmask value, for each field where bit
is set.  In order to avoid the need to "understand" each of the
extended fields, the first byte of each extended data field holds the
size of that data field (including the size itself), so they can be
skipped if not understood.  For fields that change the semantics of
the filesystem it is expected that a separate ROCOMPAT or INCOMPAT
field is registered.

There is a single dirent data type defined currently, for Lustre:
which holds a 128-bit file identifier.  It is expected that if there
are 64-bit inode values that this will be assigned the 0x20 value.

Should a need ever arise to use all 4 of the extended dirent data
fields, it would be possible to keep the last bit (0x80) for use as a
multiplexor that stores a 1-byte aggregate data size, then a series of
"<u8_size><u8_type><data>" records in the last extended data record.
It is not expected that this will actually be needed in the lifetime
of ext4.

Signed-off-by: Andreas Dilger <adilger@sun.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lib/ext2fs/ext2_fs.h

index 12d8ead..cb21318 100644 (file)
@@ -647,6 +647,7 @@ struct ext2_super_block {
 #define EXT4_FEATURE_INCOMPAT_MMP              0x0100
 #define EXT4_FEATURE_INCOMPAT_FLEX_BG          0x0200
 #define EXT4_FEATURE_INCOMPAT_EA_INODE         0x0400
+#define EXT4_FEATURE_INCOMPAT_DIRDATA          0x1000
 
 
 #define EXT2_FEATURE_COMPAT_SUPP       0