xref: /openbmc/linux/fs/ocfs2/ocfs2_fs.h (revision 0c044f0b24b9128ba8c297149d88bd81f2e36af3)
1 /* -*- mode: c; c-basic-offset: 8; -*-
2  * vim: noexpandtab sw=8 ts=8 sts=0:
3  *
4  * ocfs2_fs.h
5  *
6  * On-disk structures for OCFS2.
7  *
8  * Copyright (C) 2002, 2004 Oracle.  All rights reserved.
9  *
10  * This program is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU General Public
12  * License, version 2,  as published by the Free Software Foundation.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17  * General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public
20  * License along with this program; if not, write to the
21  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
22  * Boston, MA 021110-1307, USA.
23  */
24 
25 #ifndef _OCFS2_FS_H
26 #define _OCFS2_FS_H
27 
28 /* Version */
29 #define OCFS2_MAJOR_REV_LEVEL		0
30 #define OCFS2_MINOR_REV_LEVEL          	90
31 
32 /*
33  * An OCFS2 volume starts this way:
34  * Sector 0: Valid ocfs1_vol_disk_hdr that cleanly fails to mount OCFS.
35  * Sector 1: Valid ocfs1_vol_label that cleanly fails to mount OCFS.
36  * Block OCFS2_SUPER_BLOCK_BLKNO: OCFS2 superblock.
37  *
38  * All other structures are found from the superblock information.
39  *
40  * OCFS2_SUPER_BLOCK_BLKNO is in blocks, not sectors.  eg, for a
41  * blocksize of 2K, it is 4096 bytes into disk.
42  */
43 #define OCFS2_SUPER_BLOCK_BLKNO		2
44 
45 /*
46  * Cluster size limits. The maximum is kept arbitrarily at 1 MB, and could
47  * grow if needed.
48  */
49 #define OCFS2_MIN_CLUSTERSIZE		4096
50 #define OCFS2_MAX_CLUSTERSIZE		1048576
51 
52 /*
53  * Blocks cannot be bigger than clusters, so the maximum blocksize is the
54  * minimum cluster size.
55  */
56 #define OCFS2_MIN_BLOCKSIZE		512
57 #define OCFS2_MAX_BLOCKSIZE		OCFS2_MIN_CLUSTERSIZE
58 
59 /* Filesystem magic number */
60 #define OCFS2_SUPER_MAGIC		0x7461636f
61 
62 /* Object signatures */
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 
69 /* Compatibility flags */
70 #define OCFS2_HAS_COMPAT_FEATURE(sb,mask)			\
71 	( OCFS2_SB(sb)->s_feature_compat & (mask) )
72 #define OCFS2_HAS_RO_COMPAT_FEATURE(sb,mask)			\
73 	( OCFS2_SB(sb)->s_feature_ro_compat & (mask) )
74 #define OCFS2_HAS_INCOMPAT_FEATURE(sb,mask)			\
75 	( OCFS2_SB(sb)->s_feature_incompat & (mask) )
76 #define OCFS2_SET_COMPAT_FEATURE(sb,mask)			\
77 	OCFS2_SB(sb)->s_feature_compat |= (mask)
78 #define OCFS2_SET_RO_COMPAT_FEATURE(sb,mask)			\
79 	OCFS2_SB(sb)->s_feature_ro_compat |= (mask)
80 #define OCFS2_SET_INCOMPAT_FEATURE(sb,mask)			\
81 	OCFS2_SB(sb)->s_feature_incompat |= (mask)
82 #define OCFS2_CLEAR_COMPAT_FEATURE(sb,mask)			\
83 	OCFS2_SB(sb)->s_feature_compat &= ~(mask)
84 #define OCFS2_CLEAR_RO_COMPAT_FEATURE(sb,mask)			\
85 	OCFS2_SB(sb)->s_feature_ro_compat &= ~(mask)
86 #define OCFS2_CLEAR_INCOMPAT_FEATURE(sb,mask)			\
87 	OCFS2_SB(sb)->s_feature_incompat &= ~(mask)
88 
89 #define OCFS2_FEATURE_COMPAT_SUPP	OCFS2_FEATURE_COMPAT_BACKUP_SB
90 #define OCFS2_FEATURE_INCOMPAT_SUPP	(OCFS2_FEATURE_INCOMPAT_LOCAL_MOUNT \
91 					 | OCFS2_FEATURE_INCOMPAT_SPARSE_ALLOC \
92 					 | OCFS2_FEATURE_INCOMPAT_INLINE_DATA \
93 					 | OCFS2_FEATURE_INCOMPAT_EXTENDED_SLOT_MAP \
94 					 | OCFS2_FEATURE_INCOMPAT_USERSPACE_STACK)
95 #define OCFS2_FEATURE_RO_COMPAT_SUPP	OCFS2_FEATURE_RO_COMPAT_UNWRITTEN
96 
97 /*
98  * Heartbeat-only devices are missing journals and other files.  The
99  * filesystem driver can't load them, but the library can.  Never put
100  * this in OCFS2_FEATURE_INCOMPAT_SUPP, *ever*.
101  */
102 #define OCFS2_FEATURE_INCOMPAT_HEARTBEAT_DEV	0x0002
103 
104 /*
105  * tunefs sets this incompat flag before starting the resize and clears it
106  * at the end. This flag protects users from inadvertently mounting the fs
107  * after an aborted run without fsck-ing.
108  */
109 #define OCFS2_FEATURE_INCOMPAT_RESIZE_INPROG    0x0004
110 
111 /* Used to denote a non-clustered volume */
112 #define OCFS2_FEATURE_INCOMPAT_LOCAL_MOUNT	0x0008
113 
114 /* Support for sparse allocation in b-trees */
115 #define OCFS2_FEATURE_INCOMPAT_SPARSE_ALLOC	0x0010
116 
117 /*
118  * Tunefs sets this incompat flag before starting an operation which
119  * would require cleanup on abort. This is done to protect users from
120  * inadvertently mounting the fs after an aborted run without
121  * fsck-ing.
122  *
123  * s_tunefs_flags on the super block describes precisely which
124  * operations were in progress.
125  */
126 #define OCFS2_FEATURE_INCOMPAT_TUNEFS_INPROG	0x0020
127 
128 /* Support for data packed into inode blocks */
129 #define OCFS2_FEATURE_INCOMPAT_INLINE_DATA	0x0040
130 
131 /* Support for the extended slot map */
132 #define OCFS2_FEATURE_INCOMPAT_EXTENDED_SLOT_MAP 0x100
133 
134 
135 /*
136  * Support for alternate, userspace cluster stacks.  If set, the superblock
137  * field s_cluster_info contains a tag for the alternate stack in use as
138  * well as the name of the cluster being joined.
139  * mount.ocfs2 must pass in a matching stack name.
140  *
141  * If not set, the classic stack will be used.  This is compatbile with
142  * all older versions.
143  */
144 #define OCFS2_FEATURE_INCOMPAT_USERSPACE_STACK	0x0080
145 
146 /*
147  * backup superblock flag is used to indicate that this volume
148  * has backup superblocks.
149  */
150 #define OCFS2_FEATURE_COMPAT_BACKUP_SB		0x0001
151 
152 /*
153  * Unwritten extents support.
154  */
155 #define OCFS2_FEATURE_RO_COMPAT_UNWRITTEN	0x0001
156 
157 /* The byte offset of the first backup block will be 1G.
158  * The following will be 4G, 16G, 64G, 256G and 1T.
159  */
160 #define OCFS2_BACKUP_SB_START			1 << 30
161 
162 /* the max backup superblock nums */
163 #define OCFS2_MAX_BACKUP_SUPERBLOCKS	6
164 
165 /*
166  * Flags on ocfs2_super_block.s_tunefs_flags
167  */
168 #define OCFS2_TUNEFS_INPROG_REMOVE_SLOT		0x0001	/* Removing slots */
169 
170 /*
171  * Flags on ocfs2_dinode.i_flags
172  */
173 #define OCFS2_VALID_FL		(0x00000001)	/* Inode is valid */
174 #define OCFS2_UNUSED2_FL	(0x00000002)
175 #define OCFS2_ORPHANED_FL	(0x00000004)	/* On the orphan list */
176 #define OCFS2_UNUSED3_FL	(0x00000008)
177 /* System inode flags */
178 #define OCFS2_SYSTEM_FL		(0x00000010)	/* System inode */
179 #define OCFS2_SUPER_BLOCK_FL	(0x00000020)	/* Super block */
180 #define OCFS2_LOCAL_ALLOC_FL	(0x00000040)	/* Slot local alloc bitmap */
181 #define OCFS2_BITMAP_FL		(0x00000080)	/* Allocation bitmap */
182 #define OCFS2_JOURNAL_FL	(0x00000100)	/* Slot local journal */
183 #define OCFS2_HEARTBEAT_FL	(0x00000200)	/* Heartbeat area */
184 #define OCFS2_CHAIN_FL		(0x00000400)	/* Chain allocator */
185 #define OCFS2_DEALLOC_FL	(0x00000800)	/* Truncate log */
186 
187 /*
188  * Flags on ocfs2_dinode.i_dyn_features
189  *
190  * These can change much more often than i_flags. When adding flags,
191  * keep in mind that i_dyn_features is only 16 bits wide.
192  */
193 #define OCFS2_INLINE_DATA_FL	(0x0001)	/* Data stored in inode block */
194 #define OCFS2_HAS_XATTR_FL	(0x0002)
195 #define OCFS2_INLINE_XATTR_FL	(0x0004)
196 #define OCFS2_INDEXED_DIR_FL	(0x0008)
197 
198 /* Inode attributes, keep in sync with EXT2 */
199 #define OCFS2_SECRM_FL		(0x00000001)	/* Secure deletion */
200 #define OCFS2_UNRM_FL		(0x00000002)	/* Undelete */
201 #define OCFS2_COMPR_FL		(0x00000004)	/* Compress file */
202 #define OCFS2_SYNC_FL		(0x00000008)	/* Synchronous updates */
203 #define OCFS2_IMMUTABLE_FL	(0x00000010)	/* Immutable file */
204 #define OCFS2_APPEND_FL		(0x00000020)	/* writes to file may only append */
205 #define OCFS2_NODUMP_FL		(0x00000040)	/* do not dump file */
206 #define OCFS2_NOATIME_FL	(0x00000080)	/* do not update atime */
207 #define OCFS2_DIRSYNC_FL	(0x00010000)	/* dirsync behaviour (directories only) */
208 
209 #define OCFS2_FL_VISIBLE	(0x000100FF)	/* User visible flags */
210 #define OCFS2_FL_MODIFIABLE	(0x000100FF)	/* User modifiable flags */
211 
212 /*
213  * Extent record flags (e_node.leaf.flags)
214  */
215 #define OCFS2_EXT_UNWRITTEN	(0x01)	/* Extent is allocated but
216 					 * unwritten */
217 
218 /*
219  * ioctl commands
220  */
221 #define OCFS2_IOC_GETFLAGS	_IOR('f', 1, long)
222 #define OCFS2_IOC_SETFLAGS	_IOW('f', 2, long)
223 #define OCFS2_IOC32_GETFLAGS	_IOR('f', 1, int)
224 #define OCFS2_IOC32_SETFLAGS	_IOW('f', 2, int)
225 
226 /*
227  * Space reservation / allocation / free ioctls and argument structure
228  * are designed to be compatible with XFS.
229  *
230  * ALLOCSP* and FREESP* are not and will never be supported, but are
231  * included here for completeness.
232  */
233 struct ocfs2_space_resv {
234 	__s16		l_type;
235 	__s16		l_whence;
236 	__s64		l_start;
237 	__s64		l_len;		/* len == 0 means until end of file */
238 	__s32		l_sysid;
239 	__u32		l_pid;
240 	__s32		l_pad[4];	/* reserve area			    */
241 };
242 
243 #define OCFS2_IOC_ALLOCSP		_IOW ('X', 10, struct ocfs2_space_resv)
244 #define OCFS2_IOC_FREESP		_IOW ('X', 11, struct ocfs2_space_resv)
245 #define OCFS2_IOC_RESVSP		_IOW ('X', 40, struct ocfs2_space_resv)
246 #define OCFS2_IOC_UNRESVSP	_IOW ('X', 41, struct ocfs2_space_resv)
247 #define OCFS2_IOC_ALLOCSP64	_IOW ('X', 36, struct ocfs2_space_resv)
248 #define OCFS2_IOC_FREESP64	_IOW ('X', 37, struct ocfs2_space_resv)
249 #define OCFS2_IOC_RESVSP64	_IOW ('X', 42, struct ocfs2_space_resv)
250 #define OCFS2_IOC_UNRESVSP64	_IOW ('X', 43, struct ocfs2_space_resv)
251 
252 /* Used to pass group descriptor data when online resize is done */
253 struct ocfs2_new_group_input {
254 	__u64 group;		/* Group descriptor's blkno. */
255 	__u32 clusters;		/* Total number of clusters in this group */
256 	__u32 frees;		/* Total free clusters in this group */
257 	__u16 chain;		/* Chain for this group */
258 	__u16 reserved1;
259 	__u32 reserved2;
260 };
261 
262 #define OCFS2_IOC_GROUP_EXTEND	_IOW('o', 1, int)
263 #define OCFS2_IOC_GROUP_ADD	_IOW('o', 2,struct ocfs2_new_group_input)
264 #define OCFS2_IOC_GROUP_ADD64	_IOW('o', 3,struct ocfs2_new_group_input)
265 
266 /*
267  * Journal Flags (ocfs2_dinode.id1.journal1.i_flags)
268  */
269 #define OCFS2_JOURNAL_DIRTY_FL	(0x00000001)	/* Journal needs recovery */
270 
271 /*
272  * superblock s_state flags
273  */
274 #define OCFS2_ERROR_FS		(0x00000001)	/* FS saw errors */
275 
276 /* Limit of space in ocfs2_dir_entry */
277 #define OCFS2_MAX_FILENAME_LEN		255
278 
279 /* Maximum slots on an ocfs2 file system */
280 #define OCFS2_MAX_SLOTS			255
281 
282 /* Slot map indicator for an empty slot */
283 #define OCFS2_INVALID_SLOT		-1
284 
285 #define OCFS2_VOL_UUID_LEN		16
286 #define OCFS2_MAX_VOL_LABEL_LEN		64
287 
288 /* The alternate, userspace stack fields */
289 #define OCFS2_STACK_LABEL_LEN		4
290 #define OCFS2_CLUSTER_NAME_LEN		16
291 
292 /* Journal limits (in bytes) */
293 #define OCFS2_MIN_JOURNAL_SIZE		(4 * 1024 * 1024)
294 
295 /*
296  * Default local alloc size (in megabytes)
297  *
298  * The value chosen should be such that most allocations, including new
299  * block groups, use local alloc.
300  */
301 #define OCFS2_DEFAULT_LOCAL_ALLOC_SIZE	8
302 
303 /*
304  * Inline extended attribute size (in bytes)
305  * The value chosen should be aligned to 16 byte boundaries.
306  */
307 #define OCFS2_MIN_XATTR_INLINE_SIZE     256
308 
309 struct ocfs2_system_inode_info {
310 	char	*si_name;
311 	int	si_iflags;
312 	int	si_mode;
313 };
314 
315 /* System file index */
316 enum {
317 	BAD_BLOCK_SYSTEM_INODE = 0,
318 	GLOBAL_INODE_ALLOC_SYSTEM_INODE,
319 	SLOT_MAP_SYSTEM_INODE,
320 #define OCFS2_FIRST_ONLINE_SYSTEM_INODE SLOT_MAP_SYSTEM_INODE
321 	HEARTBEAT_SYSTEM_INODE,
322 	GLOBAL_BITMAP_SYSTEM_INODE,
323 #define OCFS2_LAST_GLOBAL_SYSTEM_INODE GLOBAL_BITMAP_SYSTEM_INODE
324 	ORPHAN_DIR_SYSTEM_INODE,
325 	EXTENT_ALLOC_SYSTEM_INODE,
326 	INODE_ALLOC_SYSTEM_INODE,
327 	JOURNAL_SYSTEM_INODE,
328 	LOCAL_ALLOC_SYSTEM_INODE,
329 	TRUNCATE_LOG_SYSTEM_INODE,
330 	NUM_SYSTEM_INODES
331 };
332 
333 static struct ocfs2_system_inode_info ocfs2_system_inodes[NUM_SYSTEM_INODES] = {
334 	/* Global system inodes (single copy) */
335 	/* The first two are only used from userspace mfks/tunefs */
336 	[BAD_BLOCK_SYSTEM_INODE]		= { "bad_blocks", 0, S_IFREG | 0644 },
337 	[GLOBAL_INODE_ALLOC_SYSTEM_INODE] 	= { "global_inode_alloc", OCFS2_BITMAP_FL | OCFS2_CHAIN_FL, S_IFREG | 0644 },
338 
339 	/* These are used by the running filesystem */
340 	[SLOT_MAP_SYSTEM_INODE]			= { "slot_map", 0, S_IFREG | 0644 },
341 	[HEARTBEAT_SYSTEM_INODE]		= { "heartbeat", OCFS2_HEARTBEAT_FL, S_IFREG | 0644 },
342 	[GLOBAL_BITMAP_SYSTEM_INODE]		= { "global_bitmap", 0, S_IFREG | 0644 },
343 
344 	/* Slot-specific system inodes (one copy per slot) */
345 	[ORPHAN_DIR_SYSTEM_INODE]		= { "orphan_dir:%04d", 0, S_IFDIR | 0755 },
346 	[EXTENT_ALLOC_SYSTEM_INODE]		= { "extent_alloc:%04d", OCFS2_BITMAP_FL | OCFS2_CHAIN_FL, S_IFREG | 0644 },
347 	[INODE_ALLOC_SYSTEM_INODE]		= { "inode_alloc:%04d", OCFS2_BITMAP_FL | OCFS2_CHAIN_FL, S_IFREG | 0644 },
348 	[JOURNAL_SYSTEM_INODE]			= { "journal:%04d", OCFS2_JOURNAL_FL, S_IFREG | 0644 },
349 	[LOCAL_ALLOC_SYSTEM_INODE]		= { "local_alloc:%04d", OCFS2_BITMAP_FL | OCFS2_LOCAL_ALLOC_FL, S_IFREG | 0644 },
350 	[TRUNCATE_LOG_SYSTEM_INODE]		= { "truncate_log:%04d", OCFS2_DEALLOC_FL, S_IFREG | 0644 }
351 };
352 
353 /* Parameter passed from mount.ocfs2 to module */
354 #define OCFS2_HB_NONE			"heartbeat=none"
355 #define OCFS2_HB_LOCAL			"heartbeat=local"
356 
357 /*
358  * OCFS2 directory file types.  Only the low 3 bits are used.  The
359  * other bits are reserved for now.
360  */
361 #define OCFS2_FT_UNKNOWN	0
362 #define OCFS2_FT_REG_FILE	1
363 #define OCFS2_FT_DIR		2
364 #define OCFS2_FT_CHRDEV		3
365 #define OCFS2_FT_BLKDEV		4
366 #define OCFS2_FT_FIFO		5
367 #define OCFS2_FT_SOCK		6
368 #define OCFS2_FT_SYMLINK	7
369 
370 #define OCFS2_FT_MAX		8
371 
372 /*
373  * OCFS2_DIR_PAD defines the directory entries boundaries
374  *
375  * NOTE: It must be a multiple of 4
376  */
377 #define OCFS2_DIR_PAD			4
378 #define OCFS2_DIR_ROUND			(OCFS2_DIR_PAD - 1)
379 #define OCFS2_DIR_MEMBER_LEN 		offsetof(struct ocfs2_dir_entry, name)
380 #define OCFS2_DIR_REC_LEN(name_len)	(((name_len) + OCFS2_DIR_MEMBER_LEN + \
381                                           OCFS2_DIR_ROUND) & \
382 					 ~OCFS2_DIR_ROUND)
383 
384 #define OCFS2_LINK_MAX		32000
385 
386 #define S_SHIFT			12
387 static unsigned char ocfs2_type_by_mode[S_IFMT >> S_SHIFT] = {
388 	[S_IFREG >> S_SHIFT]  = OCFS2_FT_REG_FILE,
389 	[S_IFDIR >> S_SHIFT]  = OCFS2_FT_DIR,
390 	[S_IFCHR >> S_SHIFT]  = OCFS2_FT_CHRDEV,
391 	[S_IFBLK >> S_SHIFT]  = OCFS2_FT_BLKDEV,
392 	[S_IFIFO >> S_SHIFT]  = OCFS2_FT_FIFO,
393 	[S_IFSOCK >> S_SHIFT] = OCFS2_FT_SOCK,
394 	[S_IFLNK >> S_SHIFT]  = OCFS2_FT_SYMLINK,
395 };
396 
397 
398 /*
399  * Convenience casts
400  */
401 #define OCFS2_RAW_SB(dinode)		(&((dinode)->id2.i_super))
402 
403 /*
404  * On disk extent record for OCFS2
405  * It describes a range of clusters on disk.
406  *
407  * Length fields are divided into interior and leaf node versions.
408  * This leaves room for a flags field (OCFS2_EXT_*) in the leaf nodes.
409  */
410 struct ocfs2_extent_rec {
411 /*00*/	__le32 e_cpos;		/* Offset into the file, in clusters */
412 	union {
413 		__le32 e_int_clusters; /* Clusters covered by all children */
414 		struct {
415 			__le16 e_leaf_clusters; /* Clusters covered by this
416 						   extent */
417 			__u8 e_reserved1;
418 			__u8 e_flags; /* Extent flags */
419 		};
420 	};
421 	__le64 e_blkno;		/* Physical disk offset, in blocks */
422 /*10*/
423 };
424 
425 struct ocfs2_chain_rec {
426 	__le32 c_free;	/* Number of free bits in this chain. */
427 	__le32 c_total;	/* Number of total bits in this chain */
428 	__le64 c_blkno;	/* Physical disk offset (blocks) of 1st group */
429 };
430 
431 struct ocfs2_truncate_rec {
432 	__le32 t_start;		/* 1st cluster in this log */
433 	__le32 t_clusters;	/* Number of total clusters covered */
434 };
435 
436 /*
437  * On disk extent list for OCFS2 (node in the tree).  Note that this
438  * is contained inside ocfs2_dinode or ocfs2_extent_block, so the
439  * offsets are relative to ocfs2_dinode.id2.i_list or
440  * ocfs2_extent_block.h_list, respectively.
441  */
442 struct ocfs2_extent_list {
443 /*00*/	__le16 l_tree_depth;		/* Extent tree depth from this
444 					   point.  0 means data extents
445 					   hang directly off this
446 					   header (a leaf)
447 					   NOTE: The high 8 bits cannot be
448 					   used - tree_depth is never that big.
449 					*/
450 	__le16 l_count;			/* Number of extent records */
451 	__le16 l_next_free_rec;		/* Next unused extent slot */
452 	__le16 l_reserved1;
453 	__le64 l_reserved2;		/* Pad to
454 					   sizeof(ocfs2_extent_rec) */
455 /*10*/	struct ocfs2_extent_rec l_recs[0];	/* Extent records */
456 };
457 
458 /*
459  * On disk allocation chain list for OCFS2.  Note that this is
460  * contained inside ocfs2_dinode, so the offsets are relative to
461  * ocfs2_dinode.id2.i_chain.
462  */
463 struct ocfs2_chain_list {
464 /*00*/	__le16 cl_cpg;			/* Clusters per Block Group */
465 	__le16 cl_bpc;			/* Bits per cluster */
466 	__le16 cl_count;		/* Total chains in this list */
467 	__le16 cl_next_free_rec;	/* Next unused chain slot */
468 	__le64 cl_reserved1;
469 /*10*/	struct ocfs2_chain_rec cl_recs[0];	/* Chain records */
470 };
471 
472 /*
473  * On disk deallocation log for OCFS2.  Note that this is
474  * contained inside ocfs2_dinode, so the offsets are relative to
475  * ocfs2_dinode.id2.i_dealloc.
476  */
477 struct ocfs2_truncate_log {
478 /*00*/	__le16 tl_count;		/* Total records in this log */
479 	__le16 tl_used;			/* Number of records in use */
480 	__le32 tl_reserved1;
481 /*08*/	struct ocfs2_truncate_rec tl_recs[0];	/* Truncate records */
482 };
483 
484 /*
485  * On disk extent block (indirect block) for OCFS2
486  */
487 struct ocfs2_extent_block
488 {
489 /*00*/	__u8 h_signature[8];		/* Signature for verification */
490 	__le64 h_reserved1;
491 /*10*/	__le16 h_suballoc_slot;		/* Slot suballocator this
492 					   extent_header belongs to */
493 	__le16 h_suballoc_bit;		/* Bit offset in suballocator
494 					   block group */
495 	__le32 h_fs_generation;		/* Must match super block */
496 	__le64 h_blkno;			/* Offset on disk, in blocks */
497 /*20*/	__le64 h_reserved3;
498 	__le64 h_next_leaf_blk;		/* Offset on disk, in blocks,
499 					   of next leaf header pointing
500 					   to data */
501 /*30*/	struct ocfs2_extent_list h_list;	/* Extent record list */
502 /* Actual on-disk size is one block */
503 };
504 
505 /*
506  * On disk slot map for OCFS2.  This defines the contents of the "slot_map"
507  * system file.  A slot is valid if it contains a node number >= 0.  The
508  * value -1 (0xFFFF) is OCFS2_INVALID_SLOT.  This marks a slot empty.
509  */
510 struct ocfs2_slot_map {
511 /*00*/	__le16 sm_slots[0];
512 /*
513  * Actual on-disk size is one block.  OCFS2_MAX_SLOTS is 255,
514  * 255 * sizeof(__le16) == 512B, within the 512B block minimum blocksize.
515  */
516 };
517 
518 struct ocfs2_extended_slot {
519 /*00*/	__u8	es_valid;
520 	__u8	es_reserved1[3];
521 	__le32	es_node_num;
522 /*10*/
523 };
524 
525 /*
526  * The extended slot map, used when OCFS2_FEATURE_INCOMPAT_EXTENDED_SLOT_MAP
527  * is set.  It separates out the valid marker from the node number, and
528  * has room to grow.  Unlike the old slot map, this format is defined by
529  * i_size.
530  */
531 struct ocfs2_slot_map_extended {
532 /*00*/	struct ocfs2_extended_slot se_slots[0];
533 /*
534  * Actual size is i_size of the slot_map system file.  It should
535  * match s_max_slots * sizeof(struct ocfs2_extended_slot)
536  */
537 };
538 
539 struct ocfs2_cluster_info {
540 /*00*/	__u8   ci_stack[OCFS2_STACK_LABEL_LEN];
541 	__le32 ci_reserved;
542 /*08*/	__u8   ci_cluster[OCFS2_CLUSTER_NAME_LEN];
543 /*18*/
544 };
545 
546 /*
547  * On disk superblock for OCFS2
548  * Note that it is contained inside an ocfs2_dinode, so all offsets
549  * are relative to the start of ocfs2_dinode.id2.
550  */
551 struct ocfs2_super_block {
552 /*00*/	__le16 s_major_rev_level;
553 	__le16 s_minor_rev_level;
554 	__le16 s_mnt_count;
555 	__le16 s_max_mnt_count;
556 	__le16 s_state;			/* File system state */
557 	__le16 s_errors;			/* Behaviour when detecting errors */
558 	__le32 s_checkinterval;		/* Max time between checks */
559 /*10*/	__le64 s_lastcheck;		/* Time of last check */
560 	__le32 s_creator_os;		/* OS */
561 	__le32 s_feature_compat;		/* Compatible feature set */
562 /*20*/	__le32 s_feature_incompat;	/* Incompatible feature set */
563 	__le32 s_feature_ro_compat;	/* Readonly-compatible feature set */
564 	__le64 s_root_blkno;		/* Offset, in blocks, of root directory
565 					   dinode */
566 /*30*/	__le64 s_system_dir_blkno;	/* Offset, in blocks, of system
567 					   directory dinode */
568 	__le32 s_blocksize_bits;		/* Blocksize for this fs */
569 	__le32 s_clustersize_bits;	/* Clustersize for this fs */
570 /*40*/	__le16 s_max_slots;		/* Max number of simultaneous mounts
571 					   before tunefs required */
572 	__le16 s_tunefs_flag;
573 	__le32 s_uuid_hash;		/* hash value of uuid */
574 	__le64 s_first_cluster_group;	/* Block offset of 1st cluster
575 					 * group header */
576 /*50*/	__u8  s_label[OCFS2_MAX_VOL_LABEL_LEN];	/* Label for mounting, etc. */
577 /*90*/	__u8  s_uuid[OCFS2_VOL_UUID_LEN];	/* 128-bit uuid */
578 /*A0*/  struct ocfs2_cluster_info s_cluster_info; /* Selected userspace
579 						     stack.  Only valid
580 						     with INCOMPAT flag. */
581 /*B8*/  __le64 s_reserved2[17];		/* Fill out superblock */
582 /*140*/
583 
584 	/*
585 	 * NOTE: As stated above, all offsets are relative to
586 	 * ocfs2_dinode.id2, which is at 0xC0 in the inode.
587 	 * 0xC0 + 0x140 = 0x200 or 512 bytes.  A superblock must fit within
588 	 * our smallest blocksize, which is 512 bytes.  To ensure this,
589 	 * we reserve the space in s_reserved2.  Anything past s_reserved2
590 	 * will not be available on the smallest blocksize.
591 	 */
592 };
593 
594 /*
595  * Local allocation bitmap for OCFS2 slots
596  * Note that it exists inside an ocfs2_dinode, so all offsets are
597  * relative to the start of ocfs2_dinode.id2.
598  */
599 struct ocfs2_local_alloc
600 {
601 /*00*/	__le32 la_bm_off;	/* Starting bit offset in main bitmap */
602 	__le16 la_size;		/* Size of included bitmap, in bytes */
603 	__le16 la_reserved1;
604 	__le64 la_reserved2;
605 /*10*/	__u8   la_bitmap[0];
606 };
607 
608 /*
609  * Data-in-inode header. This is only used if i_dyn_features has
610  * OCFS2_INLINE_DATA_FL set.
611  */
612 struct ocfs2_inline_data
613 {
614 /*00*/	__le16	id_count;	/* Number of bytes that can be used
615 				 * for data, starting at id_data */
616 	__le16	id_reserved0;
617 	__le32	id_reserved1;
618 	__u8	id_data[0];	/* Start of user data */
619 };
620 
621 /*
622  * On disk inode for OCFS2
623  */
624 struct ocfs2_dinode {
625 /*00*/	__u8 i_signature[8];		/* Signature for validation */
626 	__le32 i_generation;		/* Generation number */
627 	__le16 i_suballoc_slot;		/* Slot suballocator this inode
628 					   belongs to */
629 	__le16 i_suballoc_bit;		/* Bit offset in suballocator
630 					   block group */
631 /*10*/	__le16 i_reserved0;
632 	__le16 i_xattr_inline_size;
633 	__le32 i_clusters;		/* Cluster count */
634 	__le32 i_uid;			/* Owner UID */
635 	__le32 i_gid;			/* Owning GID */
636 /*20*/	__le64 i_size;			/* Size in bytes */
637 	__le16 i_mode;			/* File mode */
638 	__le16 i_links_count;		/* Links count */
639 	__le32 i_flags;			/* File flags */
640 /*30*/	__le64 i_atime;			/* Access time */
641 	__le64 i_ctime;			/* Creation time */
642 /*40*/	__le64 i_mtime;			/* Modification time */
643 	__le64 i_dtime;			/* Deletion time */
644 /*50*/	__le64 i_blkno;			/* Offset on disk, in blocks */
645 	__le64 i_last_eb_blk;		/* Pointer to last extent
646 					   block */
647 /*60*/	__le32 i_fs_generation;		/* Generation per fs-instance */
648 	__le32 i_atime_nsec;
649 	__le32 i_ctime_nsec;
650 	__le32 i_mtime_nsec;
651 /*70*/	__le32 i_attr;
652 	__le16 i_orphaned_slot;		/* Only valid when OCFS2_ORPHANED_FL
653 					   was set in i_flags */
654 	__le16 i_dyn_features;
655 	__le64 i_xattr_loc;
656 /*80*/	__le64 i_reserved2[7];
657 /*B8*/	union {
658 		__le64 i_pad1;		/* Generic way to refer to this
659 					   64bit union */
660 		struct {
661 			__le64 i_rdev;	/* Device number */
662 		} dev1;
663 		struct {		/* Info for bitmap system
664 					   inodes */
665 			__le32 i_used;	/* Bits (ie, clusters) used  */
666 			__le32 i_total;	/* Total bits (clusters)
667 					   available */
668 		} bitmap1;
669 		struct {		/* Info for journal system
670 					   inodes */
671 			__le32 ij_flags;	/* Mounted, version, etc. */
672 			__le32 ij_recovery_generation; /* Incremented when the
673 							  journal is recovered
674 							  after an unclean
675 							  shutdown */
676 		} journal1;
677 	} id1;				/* Inode type dependant 1 */
678 /*C0*/	union {
679 		struct ocfs2_super_block	i_super;
680 		struct ocfs2_local_alloc	i_lab;
681 		struct ocfs2_chain_list		i_chain;
682 		struct ocfs2_extent_list	i_list;
683 		struct ocfs2_truncate_log	i_dealloc;
684 		struct ocfs2_inline_data	i_data;
685 		__u8               		i_symlink[0];
686 	} id2;
687 /* Actual on-disk size is one block */
688 };
689 
690 /*
691  * On-disk directory entry structure for OCFS2
692  *
693  * Packed as this structure could be accessed unaligned on 64-bit platforms
694  */
695 struct ocfs2_dir_entry {
696 /*00*/	__le64   inode;                  /* Inode number */
697 	__le16   rec_len;                /* Directory entry length */
698 	__u8    name_len;               /* Name length */
699 	__u8    file_type;
700 /*0C*/	char    name[OCFS2_MAX_FILENAME_LEN];   /* File name */
701 /* Actual on-disk length specified by rec_len */
702 } __attribute__ ((packed));
703 
704 /*
705  * On disk allocator group structure for OCFS2
706  */
707 struct ocfs2_group_desc
708 {
709 /*00*/	__u8    bg_signature[8];        /* Signature for validation */
710 	__le16   bg_size;                /* Size of included bitmap in
711 					   bytes. */
712 	__le16   bg_bits;                /* Bits represented by this
713 					   group. */
714 	__le16	bg_free_bits_count;     /* Free bits count */
715 	__le16   bg_chain;               /* What chain I am in. */
716 /*10*/	__le32   bg_generation;
717 	__le32	bg_reserved1;
718 	__le64   bg_next_group;          /* Next group in my list, in
719 					   blocks */
720 /*20*/	__le64   bg_parent_dinode;       /* dinode which owns me, in
721 					   blocks */
722 	__le64   bg_blkno;               /* Offset on disk, in blocks */
723 /*30*/	__le64   bg_reserved2[2];
724 /*40*/	__u8    bg_bitmap[0];
725 };
726 
727 /*
728  * On disk extended attribute structure for OCFS2.
729  */
730 
731 /*
732  * ocfs2_xattr_entry indicates one extend attribute.
733  *
734  * Note that it can be stored in inode, one block or one xattr bucket.
735  */
736 struct ocfs2_xattr_entry {
737 	__le32	xe_name_hash;    /* hash value of xattr prefix+suffix. */
738 	__le16	xe_name_offset;  /* byte offset from the 1st etnry in the local
739 				    local xattr storage(inode, xattr block or
740 				    xattr bucket). */
741 	__u8	xe_name_len;	 /* xattr name len, does't include prefix. */
742 	__u8	xe_type;         /* the low 7 bits indicates the name prefix's
743 				  * type and the highest 1 bits indicate whether
744 				  * the EA is stored in the local storage. */
745 	__le64	xe_value_size;	 /* real xattr value length. */
746 };
747 
748 /*
749  * On disk structure for xattr header.
750  *
751  * One ocfs2_xattr_header describes how many ocfs2_xattr_entry records in
752  * the local xattr storage.
753  */
754 struct ocfs2_xattr_header {
755 	__le16	xh_count;                       /* contains the count of how
756 						   many records are in the
757 						   local xattr storage. */
758 	__le16	xh_free_start;                  /* current offset for storing
759 						   xattr. */
760 	__le16	xh_name_value_len;              /* total length of name/value
761 						   length in this bucket. */
762 	__le16	xh_num_buckets;                 /* bucket nums in one extent
763 						   record, only valid in the
764 						   first bucket. */
765 	__le64  xh_csum;
766 	struct ocfs2_xattr_entry xh_entries[0]; /* xattr entry list. */
767 };
768 
769 /*
770  * On disk structure for xattr value root.
771  *
772  * It is used when one extended attribute's size is larger, and we will save it
773  * in an outside cluster. It will stored in a b-tree like file content.
774  */
775 struct ocfs2_xattr_value_root {
776 /*00*/	__le32	xr_clusters;              /* clusters covered by xattr value. */
777 	__le32	xr_reserved0;
778 	__le64	xr_last_eb_blk;           /* Pointer to last extent block */
779 /*10*/	struct ocfs2_extent_list xr_list; /* Extent record list */
780 };
781 
782 /*
783  * On disk structure for xattr tree root.
784  *
785  * It is used when there are too many extended attributes for one file. These
786  * attributes will be organized and stored in an indexed-btree.
787  */
788 struct ocfs2_xattr_tree_root {
789 /*00*/	__le32	xt_clusters;              /* clusters covered by xattr. */
790 	__le32	xt_reserved0;
791 	__le64	xt_last_eb_blk;           /* Pointer to last extent block */
792 /*10*/	struct ocfs2_extent_list xt_list; /* Extent record list */
793 };
794 
795 #define OCFS2_XATTR_INDEXED	0x1
796 #define OCFS2_HASH_SHIFT	5
797 #define OCFS2_XATTR_ROUND	3
798 #define OCFS2_XATTR_SIZE(size)	(((size) + OCFS2_XATTR_ROUND) & \
799 				~(OCFS2_XATTR_ROUND))
800 
801 #define OCFS2_XATTR_BUCKET_SIZE			4096
802 #define OCFS2_XATTR_MAX_BLOCKS_PER_BUCKET 	(OCFS2_XATTR_BUCKET_SIZE \
803 						 / OCFS2_MIN_BLOCKSIZE)
804 
805 /*
806  * On disk structure for xattr block.
807  */
808 struct ocfs2_xattr_block {
809 /*00*/	__u8	xb_signature[8];     /* Signature for verification */
810 	__le16	xb_suballoc_slot;    /* Slot suballocator this
811 					block belongs to. */
812 	__le16	xb_suballoc_bit;     /* Bit offset in suballocator
813 					block group */
814 	__le32	xb_fs_generation;    /* Must match super block */
815 /*10*/	__le64	xb_blkno;            /* Offset on disk, in blocks */
816 	__le64	xb_csum;
817 /*20*/	__le16	xb_flags;            /* Indicates whether this block contains
818 					real xattr or a xattr tree. */
819 	__le16	xb_reserved0;
820 	__le32  xb_reserved1;
821 	__le64	xb_reserved2;
822 /*30*/	union {
823 		struct ocfs2_xattr_header xb_header; /* xattr header if this
824 							block contains xattr */
825 		struct ocfs2_xattr_tree_root xb_root;/* xattr tree root if this
826 							block cotains xattr
827 							tree. */
828 	} xb_attrs;
829 };
830 
831 #define OCFS2_XATTR_ENTRY_LOCAL		0x80
832 #define OCFS2_XATTR_TYPE_MASK		0x7F
833 static inline void ocfs2_xattr_set_local(struct ocfs2_xattr_entry *xe,
834 					 int local)
835 {
836 	if (local)
837 		xe->xe_type |= OCFS2_XATTR_ENTRY_LOCAL;
838 	else
839 		xe->xe_type &= ~OCFS2_XATTR_ENTRY_LOCAL;
840 }
841 
842 static inline int ocfs2_xattr_is_local(struct ocfs2_xattr_entry *xe)
843 {
844 	return xe->xe_type & OCFS2_XATTR_ENTRY_LOCAL;
845 }
846 
847 static inline void ocfs2_xattr_set_type(struct ocfs2_xattr_entry *xe, int type)
848 {
849 	xe->xe_type |= type & OCFS2_XATTR_TYPE_MASK;
850 }
851 
852 static inline int ocfs2_xattr_get_type(struct ocfs2_xattr_entry *xe)
853 {
854 	return xe->xe_type & OCFS2_XATTR_TYPE_MASK;
855 }
856 
857 #ifdef __KERNEL__
858 static inline int ocfs2_fast_symlink_chars(struct super_block *sb)
859 {
860 	return  sb->s_blocksize -
861 		 offsetof(struct ocfs2_dinode, id2.i_symlink);
862 }
863 
864 static inline int ocfs2_max_inline_data(struct super_block *sb)
865 {
866 	return sb->s_blocksize -
867 		offsetof(struct ocfs2_dinode, id2.i_data.id_data);
868 }
869 
870 static inline int ocfs2_max_inline_data_with_xattr(struct super_block *sb,
871 						   struct ocfs2_dinode *di)
872 {
873 	unsigned int xattrsize = le16_to_cpu(di->i_xattr_inline_size);
874 
875 	if (le16_to_cpu(di->i_dyn_features) & OCFS2_INLINE_XATTR_FL)
876 		return sb->s_blocksize -
877 			offsetof(struct ocfs2_dinode, id2.i_data.id_data) -
878 			xattrsize;
879 	else
880 		return sb->s_blocksize -
881 			offsetof(struct ocfs2_dinode, id2.i_data.id_data);
882 }
883 
884 static inline int ocfs2_extent_recs_per_inode(struct super_block *sb)
885 {
886 	int size;
887 
888 	size = sb->s_blocksize -
889 		offsetof(struct ocfs2_dinode, id2.i_list.l_recs);
890 
891 	return size / sizeof(struct ocfs2_extent_rec);
892 }
893 
894 static inline int ocfs2_extent_recs_per_inode_with_xattr(
895 						struct super_block *sb,
896 						struct ocfs2_dinode *di)
897 {
898 	int size;
899 	unsigned int xattrsize = le16_to_cpu(di->i_xattr_inline_size);
900 
901 	if (le16_to_cpu(di->i_dyn_features) & OCFS2_INLINE_XATTR_FL)
902 		size = sb->s_blocksize -
903 			offsetof(struct ocfs2_dinode, id2.i_list.l_recs) -
904 			xattrsize;
905 	else
906 		size = sb->s_blocksize -
907 			offsetof(struct ocfs2_dinode, id2.i_list.l_recs);
908 
909 	return size / sizeof(struct ocfs2_extent_rec);
910 }
911 
912 static inline int ocfs2_chain_recs_per_inode(struct super_block *sb)
913 {
914 	int size;
915 
916 	size = sb->s_blocksize -
917 		offsetof(struct ocfs2_dinode, id2.i_chain.cl_recs);
918 
919 	return size / sizeof(struct ocfs2_chain_rec);
920 }
921 
922 static inline u16 ocfs2_extent_recs_per_eb(struct super_block *sb)
923 {
924 	int size;
925 
926 	size = sb->s_blocksize -
927 		offsetof(struct ocfs2_extent_block, h_list.l_recs);
928 
929 	return size / sizeof(struct ocfs2_extent_rec);
930 }
931 
932 static inline u16 ocfs2_local_alloc_size(struct super_block *sb)
933 {
934 	u16 size;
935 
936 	size = sb->s_blocksize -
937 		offsetof(struct ocfs2_dinode, id2.i_lab.la_bitmap);
938 
939 	return size;
940 }
941 
942 static inline int ocfs2_group_bitmap_size(struct super_block *sb)
943 {
944 	int size;
945 
946 	size = sb->s_blocksize -
947 		offsetof(struct ocfs2_group_desc, bg_bitmap);
948 
949 	return size;
950 }
951 
952 static inline int ocfs2_truncate_recs_per_inode(struct super_block *sb)
953 {
954 	int size;
955 
956 	size = sb->s_blocksize -
957 		offsetof(struct ocfs2_dinode, id2.i_dealloc.tl_recs);
958 
959 	return size / sizeof(struct ocfs2_truncate_rec);
960 }
961 
962 static inline u64 ocfs2_backup_super_blkno(struct super_block *sb, int index)
963 {
964 	u64 offset = OCFS2_BACKUP_SB_START;
965 
966 	if (index >= 0 && index < OCFS2_MAX_BACKUP_SUPERBLOCKS) {
967 		offset <<= (2 * index);
968 		offset >>= sb->s_blocksize_bits;
969 		return offset;
970 	}
971 
972 	return 0;
973 
974 }
975 
976 static inline u16 ocfs2_xattr_recs_per_xb(struct super_block *sb)
977 {
978 	int size;
979 
980 	size = sb->s_blocksize -
981 		offsetof(struct ocfs2_xattr_block,
982 			 xb_attrs.xb_root.xt_list.l_recs);
983 
984 	return size / sizeof(struct ocfs2_extent_rec);
985 }
986 #else
987 static inline int ocfs2_fast_symlink_chars(int blocksize)
988 {
989 	return blocksize - offsetof(struct ocfs2_dinode, id2.i_symlink);
990 }
991 
992 static inline int ocfs2_max_inline_data(int blocksize)
993 {
994 	return blocksize - offsetof(struct ocfs2_dinode, id2.i_data.id_data);
995 }
996 
997 static inline int ocfs2_extent_recs_per_inode(int blocksize)
998 {
999 	int size;
1000 
1001 	size = blocksize -
1002 		offsetof(struct ocfs2_dinode, id2.i_list.l_recs);
1003 
1004 	return size / sizeof(struct ocfs2_extent_rec);
1005 }
1006 
1007 static inline int ocfs2_chain_recs_per_inode(int blocksize)
1008 {
1009 	int size;
1010 
1011 	size = blocksize -
1012 		offsetof(struct ocfs2_dinode, id2.i_chain.cl_recs);
1013 
1014 	return size / sizeof(struct ocfs2_chain_rec);
1015 }
1016 
1017 static inline int ocfs2_extent_recs_per_eb(int blocksize)
1018 {
1019 	int size;
1020 
1021 	size = blocksize -
1022 		offsetof(struct ocfs2_extent_block, h_list.l_recs);
1023 
1024 	return size / sizeof(struct ocfs2_extent_rec);
1025 }
1026 
1027 static inline int ocfs2_local_alloc_size(int blocksize)
1028 {
1029 	int size;
1030 
1031 	size = blocksize -
1032 		offsetof(struct ocfs2_dinode, id2.i_lab.la_bitmap);
1033 
1034 	return size;
1035 }
1036 
1037 static inline int ocfs2_group_bitmap_size(int blocksize)
1038 {
1039 	int size;
1040 
1041 	size = blocksize -
1042 		offsetof(struct ocfs2_group_desc, bg_bitmap);
1043 
1044 	return size;
1045 }
1046 
1047 static inline int ocfs2_truncate_recs_per_inode(int blocksize)
1048 {
1049 	int size;
1050 
1051 	size = blocksize -
1052 		offsetof(struct ocfs2_dinode, id2.i_dealloc.tl_recs);
1053 
1054 	return size / sizeof(struct ocfs2_truncate_rec);
1055 }
1056 
1057 static inline uint64_t ocfs2_backup_super_blkno(int blocksize, int index)
1058 {
1059 	uint64_t offset = OCFS2_BACKUP_SB_START;
1060 
1061 	if (index >= 0 && index < OCFS2_MAX_BACKUP_SUPERBLOCKS) {
1062 		offset <<= (2 * index);
1063 		offset /= blocksize;
1064 		return offset;
1065 	}
1066 
1067 	return 0;
1068 }
1069 
1070 static inline int ocfs2_xattr_recs_per_xb(int blocksize)
1071 {
1072 	int size;
1073 
1074 	size = blocksize -
1075 		offsetof(struct ocfs2_xattr_block,
1076 			 xb_attrs.xb_root.xt_list.l_recs);
1077 
1078 	return size / sizeof(struct ocfs2_extent_rec);
1079 }
1080 #endif  /* __KERNEL__ */
1081 
1082 
1083 static inline int ocfs2_system_inode_is_global(int type)
1084 {
1085 	return ((type >= 0) &&
1086 		(type <= OCFS2_LAST_GLOBAL_SYSTEM_INODE));
1087 }
1088 
1089 static inline int ocfs2_sprintf_system_inode_name(char *buf, int len,
1090 						  int type, int slot)
1091 {
1092 	int chars;
1093 
1094         /*
1095          * Global system inodes can only have one copy.  Everything
1096          * after OCFS2_LAST_GLOBAL_SYSTEM_INODE in the system inode
1097          * list has a copy per slot.
1098          */
1099 	if (type <= OCFS2_LAST_GLOBAL_SYSTEM_INODE)
1100 		chars = snprintf(buf, len, "%s",
1101 				 ocfs2_system_inodes[type].si_name);
1102 	else
1103 		chars = snprintf(buf, len,
1104 				 ocfs2_system_inodes[type].si_name,
1105 				 slot);
1106 
1107 	return chars;
1108 }
1109 
1110 static inline void ocfs2_set_de_type(struct ocfs2_dir_entry *de,
1111 				    umode_t mode)
1112 {
1113 	de->file_type = ocfs2_type_by_mode[(mode & S_IFMT)>>S_SHIFT];
1114 }
1115 
1116 #endif  /* _OCFS2_FS_H */
1117 
1118