aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/ocfs2_fs.h
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ocfs2/ocfs2_fs.h')
-rw-r--r--fs/ocfs2/ocfs2_fs.h88
1 files changed, 85 insertions, 3 deletions
diff --git a/fs/ocfs2/ocfs2_fs.h b/fs/ocfs2/ocfs2_fs.h
index 7ab6e9e5e77c..e4288b446ec0 100644
--- a/fs/ocfs2/ocfs2_fs.h
+++ b/fs/ocfs2/ocfs2_fs.h
@@ -68,6 +68,7 @@
68#define OCFS2_DIR_TRAILER_SIGNATURE "DIRTRL1" 68#define OCFS2_DIR_TRAILER_SIGNATURE "DIRTRL1"
69#define OCFS2_DX_ROOT_SIGNATURE "DXDIR01" 69#define OCFS2_DX_ROOT_SIGNATURE "DXDIR01"
70#define OCFS2_DX_LEAF_SIGNATURE "DXLEAF1" 70#define OCFS2_DX_LEAF_SIGNATURE "DXLEAF1"
71#define OCFS2_REFCOUNT_BLOCK_SIGNATURE "REFCNT1"
71 72
72/* Compatibility flags */ 73/* Compatibility flags */
73#define OCFS2_HAS_COMPAT_FEATURE(sb,mask) \ 74#define OCFS2_HAS_COMPAT_FEATURE(sb,mask) \
@@ -160,6 +161,9 @@
160/* Metadata checksum and error correction */ 161/* Metadata checksum and error correction */
161#define OCFS2_FEATURE_INCOMPAT_META_ECC 0x0800 162#define OCFS2_FEATURE_INCOMPAT_META_ECC 0x0800
162 163
164/* Refcount tree support */
165#define OCFS2_FEATURE_INCOMPAT_REFCOUNT_TREE 0x1000
166
163/* 167/*
164 * backup superblock flag is used to indicate that this volume 168 * backup superblock flag is used to indicate that this volume
165 * has backup superblocks. 169 * has backup superblocks.
@@ -223,6 +227,7 @@
223#define OCFS2_HAS_XATTR_FL (0x0002) 227#define OCFS2_HAS_XATTR_FL (0x0002)
224#define OCFS2_INLINE_XATTR_FL (0x0004) 228#define OCFS2_INLINE_XATTR_FL (0x0004)
225#define OCFS2_INDEXED_DIR_FL (0x0008) 229#define OCFS2_INDEXED_DIR_FL (0x0008)
230#define OCFS2_HAS_REFCOUNT_FL (0x0010)
226 231
227/* Inode attributes, keep in sync with EXT2 */ 232/* Inode attributes, keep in sync with EXT2 */
228#define OCFS2_SECRM_FL (0x00000001) /* Secure deletion */ 233#define OCFS2_SECRM_FL (0x00000001) /* Secure deletion */
@@ -241,8 +246,11 @@
241/* 246/*
242 * Extent record flags (e_node.leaf.flags) 247 * Extent record flags (e_node.leaf.flags)
243 */ 248 */
244#define OCFS2_EXT_UNWRITTEN (0x01) /* Extent is allocated but 249#define OCFS2_EXT_UNWRITTEN (0x01) /* Extent is allocated but
245 * unwritten */ 250 * unwritten */
251#define OCFS2_EXT_REFCOUNTED (0x02) /* Extent is reference
252 * counted in an associated
253 * refcount tree */
246 254
247/* 255/*
248 * ioctl commands 256 * ioctl commands
@@ -717,7 +725,8 @@ struct ocfs2_dinode {
717 __le64 i_xattr_loc; 725 __le64 i_xattr_loc;
718/*80*/ struct ocfs2_block_check i_check; /* Error checking */ 726/*80*/ struct ocfs2_block_check i_check; /* Error checking */
719/*88*/ __le64 i_dx_root; /* Pointer to dir index root block */ 727/*88*/ __le64 i_dx_root; /* Pointer to dir index root block */
720 __le64 i_reserved2[5]; 728/*90*/ __le64 i_refcount_loc;
729 __le64 i_reserved2[4];
721/*B8*/ union { 730/*B8*/ union {
722 __le64 i_pad1; /* Generic way to refer to this 731 __le64 i_pad1; /* Generic way to refer to this
723 64bit union */ 732 64bit union */
@@ -901,6 +910,59 @@ struct ocfs2_group_desc
901/*40*/ __u8 bg_bitmap[0]; 910/*40*/ __u8 bg_bitmap[0];
902}; 911};
903 912
913struct ocfs2_refcount_rec {
914/*00*/ __le64 r_cpos; /* Physical offset, in clusters */
915 __le32 r_clusters; /* Clusters covered by this extent */
916 __le32 r_refcount; /* Reference count of this extent */
917/*10*/
918};
919
920#define OCFS2_REFCOUNT_LEAF_FL (0x00000001)
921#define OCFS2_REFCOUNT_TREE_FL (0x00000002)
922
923struct ocfs2_refcount_list {
924/*00*/ __le16 rl_count; /* Maximum number of entries possible
925 in rl_records */
926 __le16 rl_used; /* Current number of used records */
927 __le32 rl_reserved2;
928 __le64 rl_reserved1; /* Pad to sizeof(ocfs2_refcount_record) */
929/*10*/ struct ocfs2_refcount_rec rl_recs[0]; /* Refcount records */
930};
931
932
933struct ocfs2_refcount_block {
934/*00*/ __u8 rf_signature[8]; /* Signature for verification */
935 __le16 rf_suballoc_slot; /* Slot suballocator this block
936 belongs to */
937 __le16 rf_suballoc_bit; /* Bit offset in suballocator
938 block group */
939 __le32 rf_fs_generation; /* Must match superblock */
940/*10*/ __le64 rf_blkno; /* Offset on disk, in blocks */
941 __le64 rf_parent; /* Parent block, only valid if
942 OCFS2_REFCOUNT_LEAF_FL is set in
943 rf_flags */
944/*20*/ struct ocfs2_block_check rf_check; /* Error checking */
945 __le64 rf_last_eb_blk; /* Pointer to last extent block */
946/*30*/ __le32 rf_count; /* Number of inodes sharing this
947 refcount tree */
948 __le32 rf_flags; /* See the flags above */
949 __le32 rf_clusters; /* clusters covered by refcount tree. */
950 __le32 rf_cpos; /* cluster offset in refcount tree.*/
951/*40*/ __le32 rf_generation; /* generation number. all be the same
952 * for the same refcount tree. */
953 __le32 rf_reserved0;
954 __le64 rf_reserved1[7];
955/*80*/ union {
956 struct ocfs2_refcount_list rf_records; /* List of refcount
957 records */
958 struct ocfs2_extent_list rf_list; /* Extent record list,
959 only valid if
960 OCFS2_REFCOUNT_TREE_FL
961 is set in rf_flags */
962 };
963/* Actual on-disk size is one block */
964};
965
904/* 966/*
905 * On disk extended attribute structure for OCFS2. 967 * On disk extended attribute structure for OCFS2.
906 */ 968 */
@@ -1312,6 +1374,26 @@ static inline u16 ocfs2_xattr_recs_per_xb(struct super_block *sb)
1312 1374
1313 return size / sizeof(struct ocfs2_extent_rec); 1375 return size / sizeof(struct ocfs2_extent_rec);
1314} 1376}
1377
1378static inline u16 ocfs2_extent_recs_per_rb(struct super_block *sb)
1379{
1380 int size;
1381
1382 size = sb->s_blocksize -
1383 offsetof(struct ocfs2_refcount_block, rf_list.l_recs);
1384
1385 return size / sizeof(struct ocfs2_extent_rec);
1386}
1387
1388static inline u16 ocfs2_refcount_recs_per_rb(struct super_block *sb)
1389{
1390 int size;
1391
1392 size = sb->s_blocksize -
1393 offsetof(struct ocfs2_refcount_block, rf_records.rl_recs);
1394
1395 return size / sizeof(struct ocfs2_refcount_rec);
1396}
1315#else 1397#else
1316static inline int ocfs2_fast_symlink_chars(int blocksize) 1398static inline int ocfs2_fast_symlink_chars(int blocksize)
1317{ 1399{