]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - fs/ocfs2/ocfs2_fs.h
ocfs2: Add JBD2 compat feature bit.
[linux-2.6-omap-h63xx.git] / fs / ocfs2 / ocfs2_fs.h
index 98e1f8bba0e105d7a16331fa2c1b15da88ace6bc..5e0c0d0aef7dcbcf1c9baae7b108cc47bce1f9cf 100644 (file)
 #define OCFS2_CLEAR_INCOMPAT_FEATURE(sb,mask)                  \
        OCFS2_SB(sb)->s_feature_incompat &= ~(mask)
 
-#define OCFS2_FEATURE_COMPAT_SUPP      OCFS2_FEATURE_COMPAT_BACKUP_SB
+#define OCFS2_FEATURE_COMPAT_SUPP      (OCFS2_FEATURE_COMPAT_BACKUP_SB \
+                                        | OCFS2_FEATURE_COMPAT_JBD2_SB)
 #define OCFS2_FEATURE_INCOMPAT_SUPP    (OCFS2_FEATURE_INCOMPAT_LOCAL_MOUNT \
                                         | OCFS2_FEATURE_INCOMPAT_SPARSE_ALLOC \
                                         | OCFS2_FEATURE_INCOMPAT_INLINE_DATA \
                                         | OCFS2_FEATURE_INCOMPAT_EXTENDED_SLOT_MAP \
-                                        | OCFS2_FEATURE_INCOMPAT_USERSPACE_STACK)
+                                        | OCFS2_FEATURE_INCOMPAT_USERSPACE_STACK \
+                                        | OCFS2_FEATURE_INCOMPAT_XATTR)
 #define OCFS2_FEATURE_RO_COMPAT_SUPP   OCFS2_FEATURE_RO_COMPAT_UNWRITTEN
 
 /*
 /* Support for data packed into inode blocks */
 #define OCFS2_FEATURE_INCOMPAT_INLINE_DATA     0x0040
 
-/* Support for the extended slot map */
-#define OCFS2_FEATURE_INCOMPAT_EXTENDED_SLOT_MAP 0x100
-
-
 /*
  * Support for alternate, userspace cluster stacks.  If set, the superblock
  * field s_cluster_info contains a tag for the alternate stack in use as
  */
 #define OCFS2_FEATURE_INCOMPAT_USERSPACE_STACK 0x0080
 
+/* Support for the extended slot map */
+#define OCFS2_FEATURE_INCOMPAT_EXTENDED_SLOT_MAP 0x100
+
+/* Support for extended attributes */
+#define OCFS2_FEATURE_INCOMPAT_XATTR           0x0200
+
 /*
  * backup superblock flag is used to indicate that this volume
  * has backup superblocks.
  */
 #define OCFS2_FEATURE_COMPAT_BACKUP_SB         0x0001
 
+/*
+ * The filesystem will correctly handle journal feature bits.
+ */
+#define OCFS2_FEATURE_COMPAT_JBD2_SB           0x0002
+
 /*
  * Unwritten extents support.
  */
@@ -578,7 +587,11 @@ struct ocfs2_super_block {
 /*A0*/  struct ocfs2_cluster_info s_cluster_info; /* Selected userspace
                                                     stack.  Only valid
                                                     with INCOMPAT flag. */
-/*B8*/  __le64 s_reserved2[17];                /* Fill out superblock */
+/*B8*/ __le16 s_xattr_inline_size;     /* extended attribute inline size
+                                          for this fs*/
+       __le16 s_reserved0;
+       __le32 s_reserved1;
+/*C0*/  __le64 s_reserved2[16];                /* Fill out superblock */
 /*140*/
 
        /*
@@ -735,12 +748,12 @@ struct ocfs2_group_desc
  */
 struct ocfs2_xattr_entry {
        __le32  xe_name_hash;    /* hash value of xattr prefix+suffix. */
-       __le16  xe_name_offset;  /* byte offset from the 1st etnry in the local
+       __le16  xe_name_offset;  /* byte offset from the 1st entry in the
                                    local xattr storage(inode, xattr block or
                                    xattr bucket). */
        __u8    xe_name_len;     /* xattr name len, does't include prefix. */
-       __u8    xe_type;         /* the low 7 bits indicates the name prefix's
-                                 * type and the highest 1 bits indicate whether
+       __u8    xe_type;         /* the low 7 bits indicate the name prefix
+                                 * type and the highest bit indicates whether
                                  * the EA is stored in the local storage. */
        __le64  xe_value_size;   /* real xattr value length. */
 };
@@ -755,8 +768,14 @@ struct ocfs2_xattr_header {
        __le16  xh_count;                       /* contains the count of how
                                                   many records are in the
                                                   local xattr storage. */
-       __le16  xh_reserved1;
-       __le32  xh_reserved2;
+       __le16  xh_free_start;                  /* current offset for storing
+                                                  xattr. */
+       __le16  xh_name_value_len;              /* total length of name/value
+                                                  length in this bucket. */
+       __le16  xh_num_buckets;                 /* Number of xattr buckets
+                                                  in this extent record,
+                                                  only valid in the first
+                                                  bucket. */
        __le64  xh_csum;
        struct ocfs2_xattr_entry xh_entries[0]; /* xattr entry list. */
 };
@@ -764,8 +783,8 @@ struct ocfs2_xattr_header {
 /*
  * On disk structure for xattr value root.
  *
- * It is used when one extended attribute's size is larger, and we will save it
- * in an outside cluster. It will stored in a b-tree like file content.
+ * When an xattr's value is large enough, it is stored in an external
+ * b-tree like file data.  The xattr value root points to this structure.
  */
 struct ocfs2_xattr_value_root {
 /*00*/ __le32  xr_clusters;              /* clusters covered by xattr value. */
@@ -793,6 +812,10 @@ struct ocfs2_xattr_tree_root {
 #define OCFS2_XATTR_SIZE(size) (((size) + OCFS2_XATTR_ROUND) & \
                                ~(OCFS2_XATTR_ROUND))
 
+#define OCFS2_XATTR_BUCKET_SIZE                        4096
+#define OCFS2_XATTR_MAX_BLOCKS_PER_BUCKET      (OCFS2_XATTR_BUCKET_SIZE \
+                                                / OCFS2_MIN_BLOCKSIZE)
+
 /*
  * On disk structure for xattr block.
  */
@@ -963,6 +986,17 @@ static inline u64 ocfs2_backup_super_blkno(struct super_block *sb, int index)
        return 0;
 
 }
+
+static inline u16 ocfs2_xattr_recs_per_xb(struct super_block *sb)
+{
+       int size;
+
+       size = sb->s_blocksize -
+               offsetof(struct ocfs2_xattr_block,
+                        xb_attrs.xb_root.xt_list.l_recs);
+
+       return size / sizeof(struct ocfs2_extent_rec);
+}
 #else
 static inline int ocfs2_fast_symlink_chars(int blocksize)
 {
@@ -1046,6 +1080,17 @@ static inline uint64_t ocfs2_backup_super_blkno(int blocksize, int index)
 
        return 0;
 }
+
+static inline int ocfs2_xattr_recs_per_xb(int blocksize)
+{
+       int size;
+
+       size = blocksize -
+               offsetof(struct ocfs2_xattr_block,
+                        xb_attrs.xb_root.xt_list.l_recs);
+
+       return size / sizeof(struct ocfs2_extent_rec);
+}
 #endif  /* __KERNEL__ */