29 #define OCFS2_MAJOR_REV_LEVEL 0
30 #define OCFS2_MINOR_REV_LEVEL 90
43 #define OCFS2_SUPER_BLOCK_BLKNO 2
49 #define OCFS2_MIN_CLUSTERSIZE 4096
50 #define OCFS2_MAX_CLUSTERSIZE 1048576
56 #define OCFS2_MIN_BLOCKSIZE 512
57 #define OCFS2_MAX_BLOCKSIZE OCFS2_MIN_CLUSTERSIZE
60 #define OCFS2_SUPER_MAGIC 0x7461636f
63 #define OCFS2_SUPER_BLOCK_SIGNATURE "OCFSV2"
64 #define OCFS2_INODE_SIGNATURE "INODE01"
65 #define OCFS2_EXTENT_BLOCK_SIGNATURE "EXBLK01"
66 #define OCFS2_GROUP_DESC_SIGNATURE "GROUP01"
67 #define OCFS2_XATTR_BLOCK_SIGNATURE "XATTR01"
68 #define OCFS2_DIR_TRAILER_SIGNATURE "DIRTRL1"
69 #define OCFS2_DX_ROOT_SIGNATURE "DXDIR01"
70 #define OCFS2_DX_LEAF_SIGNATURE "DXLEAF1"
71 #define OCFS2_REFCOUNT_BLOCK_SIGNATURE "REFCNT1"
74 #define OCFS2_HAS_COMPAT_FEATURE(sb,mask) \
75 ( OCFS2_SB(sb)->s_feature_compat & (mask) )
76 #define OCFS2_HAS_RO_COMPAT_FEATURE(sb,mask) \
77 ( OCFS2_SB(sb)->s_feature_ro_compat & (mask) )
78 #define OCFS2_HAS_INCOMPAT_FEATURE(sb,mask) \
79 ( OCFS2_SB(sb)->s_feature_incompat & (mask) )
80 #define OCFS2_SET_COMPAT_FEATURE(sb,mask) \
81 OCFS2_SB(sb)->s_feature_compat |= (mask)
82 #define OCFS2_SET_RO_COMPAT_FEATURE(sb,mask) \
83 OCFS2_SB(sb)->s_feature_ro_compat |= (mask)
84 #define OCFS2_SET_INCOMPAT_FEATURE(sb,mask) \
85 OCFS2_SB(sb)->s_feature_incompat |= (mask)
86 #define OCFS2_CLEAR_COMPAT_FEATURE(sb,mask) \
87 OCFS2_SB(sb)->s_feature_compat &= ~(mask)
88 #define OCFS2_CLEAR_RO_COMPAT_FEATURE(sb,mask) \
89 OCFS2_SB(sb)->s_feature_ro_compat &= ~(mask)
90 #define OCFS2_CLEAR_INCOMPAT_FEATURE(sb,mask) \
91 OCFS2_SB(sb)->s_feature_incompat &= ~(mask)
93 #define OCFS2_FEATURE_COMPAT_SUPP (OCFS2_FEATURE_COMPAT_BACKUP_SB \
94 | OCFS2_FEATURE_COMPAT_JBD2_SB)
95 #define OCFS2_FEATURE_INCOMPAT_SUPP (OCFS2_FEATURE_INCOMPAT_LOCAL_MOUNT \
96 | OCFS2_FEATURE_INCOMPAT_SPARSE_ALLOC \
97 | OCFS2_FEATURE_INCOMPAT_INLINE_DATA \
98 | OCFS2_FEATURE_INCOMPAT_EXTENDED_SLOT_MAP \
99 | OCFS2_FEATURE_INCOMPAT_USERSPACE_STACK \
100 | OCFS2_FEATURE_INCOMPAT_XATTR \
101 | OCFS2_FEATURE_INCOMPAT_META_ECC \
102 | OCFS2_FEATURE_INCOMPAT_INDEXED_DIRS \
103 | OCFS2_FEATURE_INCOMPAT_REFCOUNT_TREE \
104 | OCFS2_FEATURE_INCOMPAT_DISCONTIG_BG \
105 | OCFS2_FEATURE_INCOMPAT_CLUSTERINFO)
106 #define OCFS2_FEATURE_RO_COMPAT_SUPP (OCFS2_FEATURE_RO_COMPAT_UNWRITTEN \
107 | OCFS2_FEATURE_RO_COMPAT_USRQUOTA \
108 | OCFS2_FEATURE_RO_COMPAT_GRPQUOTA)
115 #define OCFS2_FEATURE_INCOMPAT_HEARTBEAT_DEV 0x0002
122 #define OCFS2_FEATURE_INCOMPAT_RESIZE_INPROG 0x0004
125 #define OCFS2_FEATURE_INCOMPAT_LOCAL_MOUNT 0x0008
128 #define OCFS2_FEATURE_INCOMPAT_SPARSE_ALLOC 0x0010
139 #define OCFS2_FEATURE_INCOMPAT_TUNEFS_INPROG 0x0020
142 #define OCFS2_FEATURE_INCOMPAT_INLINE_DATA 0x0040
153 #define OCFS2_FEATURE_INCOMPAT_USERSPACE_STACK 0x0080
156 #define OCFS2_FEATURE_INCOMPAT_EXTENDED_SLOT_MAP 0x100
159 #define OCFS2_FEATURE_INCOMPAT_XATTR 0x0200
162 #define OCFS2_FEATURE_INCOMPAT_INDEXED_DIRS 0x0400
165 #define OCFS2_FEATURE_INCOMPAT_META_ECC 0x0800
168 #define OCFS2_FEATURE_INCOMPAT_REFCOUNT_TREE 0x1000
171 #define OCFS2_FEATURE_INCOMPAT_DISCONTIG_BG 0x2000
178 #define OCFS2_FEATURE_INCOMPAT_CLUSTERINFO 0x4000
184 #define OCFS2_FEATURE_COMPAT_BACKUP_SB 0x0001
189 #define OCFS2_FEATURE_COMPAT_JBD2_SB 0x0002
194 #define OCFS2_FEATURE_RO_COMPAT_UNWRITTEN 0x0001
199 #define OCFS2_FEATURE_RO_COMPAT_USRQUOTA 0x0002
200 #define OCFS2_FEATURE_RO_COMPAT_GRPQUOTA 0x0004
205 #define OCFS2_BACKUP_SB_START 1 << 30
208 #define OCFS2_MAX_BACKUP_SUPERBLOCKS 6
213 #define OCFS2_TUNEFS_INPROG_REMOVE_SLOT 0x0001
218 #define OCFS2_VALID_FL (0x00000001)
219 #define OCFS2_UNUSED2_FL (0x00000002)
220 #define OCFS2_ORPHANED_FL (0x00000004)
221 #define OCFS2_UNUSED3_FL (0x00000008)
223 #define OCFS2_SYSTEM_FL (0x00000010)
224 #define OCFS2_SUPER_BLOCK_FL (0x00000020)
225 #define OCFS2_LOCAL_ALLOC_FL (0x00000040)
226 #define OCFS2_BITMAP_FL (0x00000080)
227 #define OCFS2_JOURNAL_FL (0x00000100)
228 #define OCFS2_HEARTBEAT_FL (0x00000200)
229 #define OCFS2_CHAIN_FL (0x00000400)
230 #define OCFS2_DEALLOC_FL (0x00000800)
231 #define OCFS2_QUOTA_FL (0x00001000)
239 #define OCFS2_INLINE_DATA_FL (0x0001)
240 #define OCFS2_HAS_XATTR_FL (0x0002)
241 #define OCFS2_INLINE_XATTR_FL (0x0004)
242 #define OCFS2_INDEXED_DIR_FL (0x0008)
243 #define OCFS2_HAS_REFCOUNT_FL (0x0010)
246 #define OCFS2_SECRM_FL FS_SECRM_FL
247 #define OCFS2_UNRM_FL FS_UNRM_FL
248 #define OCFS2_COMPR_FL FS_COMPR_FL
249 #define OCFS2_SYNC_FL FS_SYNC_FL
250 #define OCFS2_IMMUTABLE_FL FS_IMMUTABLE_FL
251 #define OCFS2_APPEND_FL FS_APPEND_FL
252 #define OCFS2_NODUMP_FL FS_NODUMP_FL
253 #define OCFS2_NOATIME_FL FS_NOATIME_FL
255 #define OCFS2_DIRTY_FL FS_DIRTY_FL
256 #define OCFS2_COMPRBLK_FL FS_COMPRBLK_FL
257 #define OCFS2_NOCOMP_FL FS_NOCOMP_FL
258 #define OCFS2_ECOMPR_FL FS_ECOMPR_FL
260 #define OCFS2_BTREE_FL FS_BTREE_FL
261 #define OCFS2_INDEX_FL FS_INDEX_FL
262 #define OCFS2_IMAGIC_FL FS_IMAGIC_FL
263 #define OCFS2_JOURNAL_DATA_FL FS_JOURNAL_DATA_FL
264 #define OCFS2_NOTAIL_FL FS_NOTAIL_FL
265 #define OCFS2_DIRSYNC_FL FS_DIRSYNC_FL
266 #define OCFS2_TOPDIR_FL FS_TOPDIR_FL
267 #define OCFS2_RESERVED_FL FS_RESERVED_FL
269 #define OCFS2_FL_VISIBLE FS_FL_USER_VISIBLE
270 #define OCFS2_FL_MODIFIABLE FS_FL_USER_MODIFIABLE
275 #define OCFS2_EXT_UNWRITTEN (0x01)
277 #define OCFS2_EXT_REFCOUNTED (0x02)
284 #define OCFS2_JOURNAL_DIRTY_FL (0x00000001)
289 #define OCFS2_ERROR_FS (0x00000001)
292 #define OCFS2_MAX_FILENAME_LEN 255
295 #define OCFS2_MAX_SLOTS 255
298 #define OCFS2_INVALID_SLOT -1
300 #define OCFS2_VOL_UUID_LEN 16
301 #define OCFS2_MAX_VOL_LABEL_LEN 64
304 #define OCFS2_STACK_LABEL_LEN 4
305 #define OCFS2_CLUSTER_NAME_LEN 16
308 #define OCFS2_CLASSIC_CLUSTER_STACK "o2cb"
311 #define OCFS2_MIN_JOURNAL_SIZE (4 * 1024 * 1024)
317 #define OCFS2_MIN_XATTR_INLINE_SIZE 256
322 #define OCFS2_CLUSTER_O2CB_GLOBAL_HEARTBEAT (0x01)
335 #define OCFS2_FIRST_ONLINE_SYSTEM_INODE SLOT_MAP_SYSTEM_INODE
340 #define OCFS2_LAST_GLOBAL_SYSTEM_INODE GROUP_QUOTA_SYSTEM_INODE
341 #define OCFS2_FIRST_LOCAL_SYSTEM_INODE ORPHAN_DIR_SYSTEM_INODE
350 #define OCFS2_LAST_LOCAL_SYSTEM_INODE LOCAL_GROUP_QUOTA_SYSTEM_INODE
353 #define NUM_GLOBAL_SYSTEM_INODES OCFS2_FIRST_LOCAL_SYSTEM_INODE
354 #define NUM_LOCAL_SYSTEM_INODES \
355 (NUM_SYSTEM_INODES - OCFS2_FIRST_LOCAL_SYSTEM_INODE)
382 #define OCFS2_HB_NONE "heartbeat=none"
383 #define OCFS2_HB_LOCAL "heartbeat=local"
384 #define OCFS2_HB_GLOBAL "heartbeat=global"
390 #define OCFS2_FT_UNKNOWN 0
391 #define OCFS2_FT_REG_FILE 1
392 #define OCFS2_FT_DIR 2
393 #define OCFS2_FT_CHRDEV 3
394 #define OCFS2_FT_BLKDEV 4
395 #define OCFS2_FT_FIFO 5
396 #define OCFS2_FT_SOCK 6
397 #define OCFS2_FT_SYMLINK 7
399 #define OCFS2_FT_MAX 8
406 #define OCFS2_DIR_PAD 4
407 #define OCFS2_DIR_ROUND (OCFS2_DIR_PAD - 1)
408 #define OCFS2_DIR_MEMBER_LEN offsetof(struct ocfs2_dir_entry, name)
409 #define OCFS2_DIR_REC_LEN(name_len) (((name_len) + OCFS2_DIR_MEMBER_LEN + \
412 #define OCFS2_DIR_MIN_REC_LEN OCFS2_DIR_REC_LEN(1)
414 #define OCFS2_LINK_MAX 32000
415 #define OCFS2_DX_LINK_MAX ((1U << 31) - 1U)
416 #define OCFS2_LINKS_HI_SHIFT 16
417 #define OCFS2_DX_ENTRIES_MAX (0xffffffffU)
420 static unsigned char ocfs2_type_by_mode[
S_IFMT >>
S_SHIFT] = {
434 #define OCFS2_RAW_SB(dinode) (&((dinode)->id2.i_super))
835 #define OCFS2_DX_FLAG_INLINE 0x01
902 #define OCFS2_MAX_BG_BITMAP_SIZE 256
956 #define OCFS2_32BIT_POS_MASK (0xffffffffULL)
958 #define OCFS2_REFCOUNT_LEAF_FL (0x00000001)
959 #define OCFS2_REFCOUNT_TREE_FL (0x00000002)
1082 #define OCFS2_XATTR_INDEXED 0x1
1083 #define OCFS2_HASH_SHIFT 5
1084 #define OCFS2_XATTR_ROUND 3
1085 #define OCFS2_XATTR_SIZE(size) (((size) + OCFS2_XATTR_ROUND) & \
1086 ~(OCFS2_XATTR_ROUND))
1088 #define OCFS2_XATTR_BUCKET_SIZE 4096
1089 #define OCFS2_XATTR_MAX_BLOCKS_PER_BUCKET (OCFS2_XATTR_BUCKET_SIZE \
1090 / OCFS2_MIN_BLOCKSIZE)
1121 #define OCFS2_XATTR_ENTRY_LOCAL 0x80
1122 #define OCFS2_XATTR_TYPE_MASK 0x7F
1152 #define OCFS2_GLOBAL_QMAGICS {\
1157 #define OCFS2_GLOBAL_QVERSIONS {\
1166 #define OCFS2_QBLK_RESERVED_SPACE 8
1174 #define OCFS2_GLOBAL_INFO_OFF (sizeof(struct ocfs2_disk_dqheader))
1211 #define OCFS2_LOCAL_QMAGICS {\
1216 #define OCFS2_LOCAL_QVERSIONS {\
1222 #define OLQF_CLEAN 0x0001
1225 #define OCFS2_LOCAL_INFO_OFF (sizeof(struct ocfs2_disk_dqheader))
1270 static inline int ocfs2_fast_symlink_chars(
struct super_block *
sb)
1276 static inline int ocfs2_max_inline_data_with_xattr(
struct super_block *
sb,
1290 static inline int ocfs2_extent_recs_per_inode(
struct super_block *sb)
1300 static inline int ocfs2_extent_recs_per_inode_with_xattr(
1318 static inline int ocfs2_extent_recs_per_dx_root(
struct super_block *sb)
1328 static inline int ocfs2_chain_recs_per_inode(
struct super_block *sb)
1338 static inline u16 ocfs2_extent_recs_per_eb(
struct super_block *sb)
1348 static inline u16 ocfs2_extent_recs_per_gd(
struct super_block *sb)
1358 static inline int ocfs2_dx_entries_per_leaf(
struct super_block *sb)
1368 static inline int ocfs2_dx_entries_per_root(
struct super_block *sb)
1388 static inline int ocfs2_group_bitmap_size(
struct super_block *sb,
1390 u32 feature_incompat)
1408 static inline int ocfs2_truncate_recs_per_inode(
struct super_block *sb)
1423 offset <<= (2 *
index);
1432 static inline u16 ocfs2_xattr_recs_per_xb(
struct super_block *sb)
1438 xb_attrs.
xb_root.xt_list.l_recs);
1443 static inline u16 ocfs2_extent_recs_per_rb(
struct super_block *sb)
1453 static inline u16 ocfs2_refcount_recs_per_rb(
struct super_block *sb)
1469 static inline int ocfs2_fast_symlink_chars(
int blocksize)
1474 static inline int ocfs2_max_inline_data_with_xattr(
int blocksize,
1486 static inline int ocfs2_extent_recs_per_inode(
int blocksize)
1496 static inline int ocfs2_chain_recs_per_inode(
int blocksize)
1506 static inline int ocfs2_extent_recs_per_eb(
int blocksize)
1516 static inline int ocfs2_extent_recs_per_gd(
int blocksize)
1526 static inline int ocfs2_local_alloc_size(
int blocksize)
1536 static inline int ocfs2_group_bitmap_size(
int blocksize,
1556 static inline int ocfs2_truncate_recs_per_inode(
int blocksize)
1566 static inline uint64_t ocfs2_backup_super_blkno(
int blocksize,
int index)
1571 offset <<= (2 *
index);
1572 offset /= blocksize;
1579 static inline int ocfs2_xattr_recs_per_xb(
int blocksize)
1585 xb_attrs.
xb_root.xt_list.l_recs);
1592 static inline int ocfs2_system_inode_is_global(
int type)
1594 return ((type >= 0) &&
1598 static inline int ocfs2_sprintf_system_inode_name(
char *buf,
int len,
1610 ocfs2_system_inodes[type].si_name);
1613 ocfs2_system_inodes[type].si_name,
1635 if (!gd->
bg_list.l_next_free_rec)