Patchwork [RFC,v2,1/9] ext4: Adding itree feature and inode flags

login
register
mail settings
Submitter Radek Pazdera
Date May 13, 2013, 3:42 p.m.
Message ID <1368459730-3405-2-git-send-email-rpazdera@redhat.com>
Download mbox | patch
Permalink /patch/243452/
State Changes Requested
Headers show

Comments

Radek Pazdera - May 13, 2013, 3:42 p.m.
This commit adds two new flags for the itree. A new read-only file
system feature flag:

    EXT4_FEATURE_RO_COMPAT_ITREE    0x1000

And an inode flag to indicate that a directory has itree:

    EXT4_ITREE_FL = 0x10000000
    EXT4_INODE_ITREE = 29

Also a macro for checking these flags on a directory was added.

Signed-off-by: Radek Pazdera <rpazdera@redhat.com>
---
 fs/ext4/ext4.h | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

Patch

diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index 5aae3d1..9512702 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -388,6 +388,7 @@  struct flex_groups {
 #define EXT4_EA_INODE_FL	        0x00200000 /* Inode used for large EA */
 #define EXT4_EOFBLOCKS_FL		0x00400000 /* Blocks allocated beyond EOF */
 #define EXT4_INLINE_DATA_FL		0x10000000 /* Inode has inline data. */
+#define EXT4_ITREE_FL			0x20000000 /* Directory has itree */
 #define EXT4_RESERVED_FL		0x80000000 /* reserved for ext4 lib */
 
 #define EXT4_FL_USER_VISIBLE		0x004BDFFF /* User visible flags */
@@ -445,6 +446,7 @@  enum {
 	EXT4_INODE_EA_INODE	= 21,	/* Inode used for large EA */
 	EXT4_INODE_EOFBLOCKS	= 22,	/* Blocks allocated beyond EOF */
 	EXT4_INODE_INLINE_DATA	= 28,	/* Data in inode. */
+	EXT4_INODE_ITREE	= 29,	/* Directory has itree */
 	EXT4_INODE_RESERVED	= 31,	/* reserved for ext4 lib */
 };
 
@@ -489,6 +491,7 @@  static inline void ext4_check_flag_values(void)
 	CHECK_FLAG_VALUE(EA_INODE);
 	CHECK_FLAG_VALUE(EOFBLOCKS);
 	CHECK_FLAG_VALUE(INLINE_DATA);
+	CHECK_FLAG_VALUE(ITREE);
 	CHECK_FLAG_VALUE(RESERVED);
 }
 
@@ -1481,6 +1484,7 @@  static inline void ext4_clear_state_flags(struct ext4_inode_info *ei)
  * GDT_CSUM bits are mutually exclusive.
  */
 #define EXT4_FEATURE_RO_COMPAT_METADATA_CSUM	0x0400
+#define EXT4_FEATURE_RO_COMPAT_ITREE		0x1000
 
 #define EXT4_FEATURE_INCOMPAT_COMPRESSION	0x0001
 #define EXT4_FEATURE_INCOMPAT_FILETYPE		0x0002
@@ -1530,7 +1534,8 @@  static inline void ext4_clear_state_flags(struct ext4_inode_info *ei)
 					 EXT4_FEATURE_RO_COMPAT_HUGE_FILE |\
 					 EXT4_FEATURE_RO_COMPAT_BIGALLOC |\
 					 EXT4_FEATURE_RO_COMPAT_METADATA_CSUM|\
-					 EXT4_FEATURE_RO_COMPAT_QUOTA)
+					 EXT4_FEATURE_RO_COMPAT_QUOTA|\
+					 EXT4_FEATURE_RO_COMPAT_ITREE)
 
 /*
  * Default values for user and/or group using reserved blocks
@@ -1688,6 +1693,11 @@  static inline __le16 ext4_rec_len_to_disk(unsigned len, unsigned blocksize)
 #define EXT4_DIR_LINK_MAX(dir) (!is_dx(dir) && (dir)->i_nlink >= EXT4_LINK_MAX)
 #define EXT4_DIR_LINK_EMPTY(dir) ((dir)->i_nlink == 2 || (dir)->i_nlink == 1)
 
+#define dx_itree(dir) (is_dx(dir) && \
+		       EXT4_HAS_RO_COMPAT_FEATURE(dir->i_sb, \
+					EXT4_FEATURE_RO_COMPAT_ITREE) && \
+		       ext4_test_inode_flag((dir), EXT4_INODE_ITREE))
+
 /* Legal values for the dx_root hash_version field: */
 
 #define DX_HASH_LEGACY		0