Add support for a new inode flag, which is to be used
for indicating the top of directory hierarchies for the
Orlov block allocator.

diff --git a/lib/e2p/pf.c b/lib/e2p/pf.c
index a540c73..5edd690 100644
--- a/lib/e2p/pf.c
+++ b/lib/e2p/pf.c
@@ -40,6 +40,7 @@
 	{ EXT2_ECOMPR_FL, "E", "Compression_Error" },
 	{ EXT3_JOURNAL_DATA_FL, "j", "Journaled_Data" },
 	{ EXT2_NOTAIL_FL, "t", "No_Tailmerging" },
+	{ EXT2_TOPDIR_FL, "T", "Top_of_Directory_Hierarchies" },
 	{ 0, NULL, NULL }
 };
 
diff --git a/lib/ext2fs/ext2_fs.h b/lib/ext2fs/ext2_fs.h
index 7cd679d..4f32466 100644
--- a/lib/ext2fs/ext2_fs.h
+++ b/lib/ext2fs/ext2_fs.h
@@ -232,9 +232,10 @@
 #define EXT3_JOURNAL_DATA_FL		0x00004000 /* file data should be journaled */
 #define EXT2_NOTAIL_FL			0x00008000 /* file tail should not be merged */
 #define EXT2_DIRSYNC_FL 		0x00010000 /* Synchronous directory modifications */
+#define EXT2_TOPDIR_FL			0x00020000 /* Top of directory hierarchies*/
 #define EXT2_RESERVED_FL		0x80000000 /* reserved for ext2 lib */
 
-#define EXT2_FL_USER_VISIBLE		0x0001DFFF /* User visible flags */
+#define EXT2_FL_USER_VISIBLE		0x0003DFFF /* User visible flags */
 #define EXT2_FL_USER_MODIFIABLE		0x000080FF /* User modifiable flags */
 
 /*
diff --git a/misc/chattr.1.in b/misc/chattr.1.in
index 218a291..1e17bd8 100644
--- a/misc/chattr.1.in
+++ b/misc/chattr.1.in
@@ -19,7 +19,7 @@
 .B chattr
 changes the file attributes on a Linux second extended file system.
 .PP
-The format of a symbolic mode is +-=[ASacDdistu].
+The format of a symbolic mode is +-=[ASacDdisTtu].
 .PP
 The operator `+' causes the selected attributes to be added to the
 existing attributes of the files; `-' causes them to be removed; and
@@ -28,7 +28,8 @@
 The letters `ASacDdijsu' select the new attributes for the files: 
 don't update atime (A), synchronous updates (S), synchronous directory
 updates (D), append only (a), compressed (c), no dump (d), immutable (i),
-data journalling (j), secure deletion (s), and undeletable (u).
+data journalling (j), secure deletion (s), top of directory hierarchy
+(T), no tail-merging (t), and undeletable (u).
 .SH OPTIONS
 .TP
 .B \-R
@@ -85,6 +86,10 @@
 the changes are written synchronously on the disk; this is equivalent to
 the `sync' mount option applied to a subset of the files.
 .PP
+A directory with the 'T' attribute will be deemed to be the top of 
+directory hierarchies for the purposes of the Orlov block allocator
+(which is used in newer kernels).
+.PP
 A file with the 't' attribute will not have a partial block fragment at
 the of the file merged with other files (for those filesystems which
 support tail-merging).  This is necessary for applications such as LILO 
diff --git a/misc/chattr.c b/misc/chattr.c
index 467e6ba..4ff1564 100644
--- a/misc/chattr.c
+++ b/misc/chattr.c
@@ -98,6 +98,7 @@
 	{ EXT2_SECRM_FL, 's' },
 	{ EXT2_UNRM_FL, 'u' },
 	{ EXT2_NOTAIL_FL, 't' },
+	{ EXT2_TOPDIR_FL, 'T' },
 	{ 0, 0 }
 };