Whamcloud - gitweb
e2fsck: add support for xattrs in external inodes
[tools/e2fsprogs.git] / lib / ext2fs / ext2_fs.h
index 3b01285..cbc230f 100644 (file)
@@ -159,7 +159,7 @@ struct ext2_group_desc
        __u16   bg_block_bitmap_csum_lo;/* crc32c(s_uuid+grp_num+bitmap) LSB */
        __u16   bg_inode_bitmap_csum_lo;/* crc32c(s_uuid+grp_num+bitmap) LSB */
        __u16   bg_itable_unused;       /* Unused inodes count */
-       __u16   bg_checksum;            /* crc16(s_uuid+grouo_num+group_desc)*/
+       __u16   bg_checksum;            /* crc16(s_uuid+group_num+group_desc)*/
 };
 
 /*
@@ -264,6 +264,11 @@ struct ext2_dx_countlimit {
 #define EXT2_DESC_PER_BLOCK(s)         (EXT2_BLOCK_SIZE(s) / EXT2_DESC_SIZE(s))
 #endif
 
+#define EXT2_GROUPS_TO_BLOCKS(s, g)   ((blk64_t) EXT2_BLOCKS_PER_GROUP(s) * \
+                                      (g))
+#define EXT2_GROUPS_TO_CLUSTERS(s, g) ((blk64_t) EXT2_CLUSTERS_PER_GROUP(s) * \
+                                      (g))
+
 /*
  * Constants relative to the data blocks
  */
@@ -300,7 +305,8 @@ struct ext2_dx_countlimit {
 #define EXT4_HUGE_FILE_FL               0x00040000 /* Set to each huge file */
 #define EXT4_EXTENTS_FL                0x00080000 /* Inode uses extents */
 #define EXT4_EA_INODE_FL               0x00200000 /* Inode used for large EA */
-#define EXT4_EOFBLOCKS_FL              0x00400000 /* Blocks allocated beyond EOF */
+/* EXT4_EOFBLOCKS_FL 0x00400000 was here */
+#define FS_NOCOW_FL                    0x00800000 /* Do not cow file */
 #define EXT4_SNAPFILE_FL               0x01000000  /* Inode is a snapshot */
 #define EXT4_SNAPFILE_DELETED_FL       0x04000000  /* Snapshot is being deleted */
 #define EXT4_SNAPFILE_SHRUNK_FL                0x08000000  /* Snapshot shrink has completed */
@@ -455,6 +461,12 @@ struct ext2_inode_large {
 
 #define i_dir_acl      i_size_high
 
+#define EXT2_FITS_IN_INODE(inode, field)             \
+       ((offsetof(struct ext2_inode_large, field) +    \
+        sizeof((inode)->field)) <=                  \
+                        (EXT2_GOOD_OLD_INODE_SIZE +    \
+                         (inode)->i_extra_isize))      \
+
 #if defined(__KERNEL__) || defined(__linux__)
 #define i_reserved1    osd1.linux1.l_i_reserved1
 #define i_frag         osd2.linux2.l_i_frag
@@ -644,7 +656,8 @@ struct ext2_super_block {
        __u32   s_usr_quota_inum;       /* inode number of user quota file */
        __u32   s_grp_quota_inum;       /* inode number of group quota file */
        __u32   s_overhead_blocks;      /* overhead blocks/clusters in fs */
-       __u32   s_reserved[108];        /* Padding to the end of the block */
+       __u32   s_backup_bgs[2];        /* If sparse_super2 enabled */
+       __u32   s_reserved[106];        /* Padding to the end of the block */
        __u32   s_checksum;             /* crc32c(superblock) */
 };
 
@@ -695,6 +708,7 @@ struct ext2_super_block {
 #define EXT2_FEATURE_COMPAT_LAZY_BG            0x0040
 /* #define EXT2_FEATURE_COMPAT_EXCLUDE_INODE   0x0080 not used, legacy */
 #define EXT2_FEATURE_COMPAT_EXCLUDE_BITMAP     0x0100
+#define EXT4_FEATURE_COMPAT_SPARSE_SUPER2      0x0200
 
 
 #define EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER    0x0001
@@ -721,13 +735,18 @@ struct ext2_super_block {
 #define EXT4_FEATURE_INCOMPAT_FLEX_BG          0x0200
 #define EXT4_FEATURE_INCOMPAT_EA_INODE         0x0400
 #define EXT4_FEATURE_INCOMPAT_DIRDATA          0x1000
+/* 0x2000 was EXT4_FEATURE_INCOMPAT_BG_USE_META_CSUM but this was never used */
+#define EXT4_FEATURE_INCOMPAT_LARGEDIR         0x4000 /* >2GB or 3-lvl htree */
+#define EXT4_FEATURE_INCOMPAT_INLINEDATA       0x8000 /* data in inode */
 
 #define EXT2_FEATURE_COMPAT_SUPP       0
 #define EXT2_FEATURE_INCOMPAT_SUPP    (EXT2_FEATURE_INCOMPAT_FILETYPE| \
-                                      EXT4_FEATURE_INCOMPAT_MMP)
+                                      EXT4_FEATURE_INCOMPAT_MMP| \
+                                      EXT4_FEATURE_INCOMPAT_EA_INODE)
 #define EXT2_FEATURE_RO_COMPAT_SUPP    (EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER| \
                                         EXT2_FEATURE_RO_COMPAT_LARGE_FILE| \
                                         EXT4_FEATURE_RO_COMPAT_DIR_NLINK| \
+                                        EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE| \
                                         EXT2_FEATURE_RO_COMPAT_BTREE_DIR)
 
 /*