Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300    1) /* SPDX-License-Identifier: GPL-2.0-only */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300    2) /* -*- mode: c; c-basic-offset: 8; -*-
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300    3)  * vim: noexpandtab sw=8 ts=8 sts=0:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300    4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300    5)  * ocfs2_fs.h
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300    6)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300    7)  * On-disk structures for OCFS2.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300    8)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300    9)  * Copyright (C) 2002, 2004 Oracle.  All rights reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   10)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   11) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   12) #ifndef _OCFS2_FS_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   13) #define _OCFS2_FS_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   14) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   15) #include <linux/magic.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   16) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   17) /* Version */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   18) #define OCFS2_MAJOR_REV_LEVEL		0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   19) #define OCFS2_MINOR_REV_LEVEL          	90
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   20) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   21) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   22)  * An OCFS2 volume starts this way:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   23)  * Sector 0: Valid ocfs1_vol_disk_hdr that cleanly fails to mount OCFS.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   24)  * Sector 1: Valid ocfs1_vol_label that cleanly fails to mount OCFS.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   25)  * Block OCFS2_SUPER_BLOCK_BLKNO: OCFS2 superblock.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   26)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   27)  * All other structures are found from the superblock information.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   28)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   29)  * OCFS2_SUPER_BLOCK_BLKNO is in blocks, not sectors.  eg, for a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   30)  * blocksize of 2K, it is 4096 bytes into disk.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   31)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   32) #define OCFS2_SUPER_BLOCK_BLKNO		2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   33) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   34) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   35)  * Cluster size limits. The maximum is kept arbitrarily at 1 MB, and could
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   36)  * grow if needed.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   37)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   38) #define OCFS2_MIN_CLUSTERSIZE		4096
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   39) #define OCFS2_MAX_CLUSTERSIZE		1048576
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   40) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   41) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   42)  * Blocks cannot be bigger than clusters, so the maximum blocksize is the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   43)  * minimum cluster size.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   44)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   45) #define OCFS2_MIN_BLOCKSIZE		512
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   46) #define OCFS2_MAX_BLOCKSIZE		OCFS2_MIN_CLUSTERSIZE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   47) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   48) /* Object signatures */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   49) #define OCFS2_SUPER_BLOCK_SIGNATURE	"OCFSV2"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   50) #define OCFS2_INODE_SIGNATURE		"INODE01"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   51) #define OCFS2_EXTENT_BLOCK_SIGNATURE	"EXBLK01"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   52) #define OCFS2_GROUP_DESC_SIGNATURE      "GROUP01"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   53) #define OCFS2_XATTR_BLOCK_SIGNATURE	"XATTR01"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   54) #define OCFS2_DIR_TRAILER_SIGNATURE	"DIRTRL1"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   55) #define OCFS2_DX_ROOT_SIGNATURE		"DXDIR01"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   56) #define OCFS2_DX_LEAF_SIGNATURE		"DXLEAF1"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   57) #define OCFS2_REFCOUNT_BLOCK_SIGNATURE	"REFCNT1"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   58) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   59) /* Compatibility flags */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   60) #define OCFS2_HAS_COMPAT_FEATURE(sb,mask)			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   61) 	( OCFS2_SB(sb)->s_feature_compat & (mask) )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   62) #define OCFS2_HAS_RO_COMPAT_FEATURE(sb,mask)			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   63) 	( OCFS2_SB(sb)->s_feature_ro_compat & (mask) )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   64) #define OCFS2_HAS_INCOMPAT_FEATURE(sb,mask)			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   65) 	( OCFS2_SB(sb)->s_feature_incompat & (mask) )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   66) #define OCFS2_SET_COMPAT_FEATURE(sb,mask)			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   67) 	OCFS2_SB(sb)->s_feature_compat |= (mask)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   68) #define OCFS2_SET_RO_COMPAT_FEATURE(sb,mask)			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   69) 	OCFS2_SB(sb)->s_feature_ro_compat |= (mask)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   70) #define OCFS2_SET_INCOMPAT_FEATURE(sb,mask)			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   71) 	OCFS2_SB(sb)->s_feature_incompat |= (mask)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   72) #define OCFS2_CLEAR_COMPAT_FEATURE(sb,mask)			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   73) 	OCFS2_SB(sb)->s_feature_compat &= ~(mask)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   74) #define OCFS2_CLEAR_RO_COMPAT_FEATURE(sb,mask)			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   75) 	OCFS2_SB(sb)->s_feature_ro_compat &= ~(mask)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   76) #define OCFS2_CLEAR_INCOMPAT_FEATURE(sb,mask)			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   77) 	OCFS2_SB(sb)->s_feature_incompat &= ~(mask)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   78) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   79) #define OCFS2_FEATURE_COMPAT_SUPP	(OCFS2_FEATURE_COMPAT_BACKUP_SB	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   80) 					 | OCFS2_FEATURE_COMPAT_JBD2_SB)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   81) #define OCFS2_FEATURE_INCOMPAT_SUPP	(OCFS2_FEATURE_INCOMPAT_LOCAL_MOUNT \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   82) 					 | OCFS2_FEATURE_INCOMPAT_SPARSE_ALLOC \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   83) 					 | OCFS2_FEATURE_INCOMPAT_INLINE_DATA \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   84) 					 | OCFS2_FEATURE_INCOMPAT_EXTENDED_SLOT_MAP \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   85) 					 | OCFS2_FEATURE_INCOMPAT_USERSPACE_STACK \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   86) 					 | OCFS2_FEATURE_INCOMPAT_XATTR \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   87) 					 | OCFS2_FEATURE_INCOMPAT_META_ECC \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   88) 					 | OCFS2_FEATURE_INCOMPAT_INDEXED_DIRS \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   89) 					 | OCFS2_FEATURE_INCOMPAT_REFCOUNT_TREE \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   90) 					 | OCFS2_FEATURE_INCOMPAT_DISCONTIG_BG	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   91) 					 | OCFS2_FEATURE_INCOMPAT_CLUSTERINFO \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   92) 					 | OCFS2_FEATURE_INCOMPAT_APPEND_DIO)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   93) #define OCFS2_FEATURE_RO_COMPAT_SUPP	(OCFS2_FEATURE_RO_COMPAT_UNWRITTEN \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   94) 					 | OCFS2_FEATURE_RO_COMPAT_USRQUOTA \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   95) 					 | OCFS2_FEATURE_RO_COMPAT_GRPQUOTA)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   96) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   97) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   98)  * Heartbeat-only devices are missing journals and other files.  The
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   99)  * filesystem driver can't load them, but the library can.  Never put
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  100)  * this in OCFS2_FEATURE_INCOMPAT_SUPP, *ever*.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  101)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  102) #define OCFS2_FEATURE_INCOMPAT_HEARTBEAT_DEV	0x0002
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  103) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  104) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  105)  * tunefs sets this incompat flag before starting the resize and clears it
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  106)  * at the end. This flag protects users from inadvertently mounting the fs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  107)  * after an aborted run without fsck-ing.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  108)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  109) #define OCFS2_FEATURE_INCOMPAT_RESIZE_INPROG    0x0004
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  110) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  111) /* Used to denote a non-clustered volume */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  112) #define OCFS2_FEATURE_INCOMPAT_LOCAL_MOUNT	0x0008
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  113) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  114) /* Support for sparse allocation in b-trees */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  115) #define OCFS2_FEATURE_INCOMPAT_SPARSE_ALLOC	0x0010
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  116) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  117) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  118)  * Tunefs sets this incompat flag before starting an operation which
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  119)  * would require cleanup on abort. This is done to protect users from
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  120)  * inadvertently mounting the fs after an aborted run without
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  121)  * fsck-ing.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  122)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  123)  * s_tunefs_flags on the super block describes precisely which
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  124)  * operations were in progress.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  125)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  126) #define OCFS2_FEATURE_INCOMPAT_TUNEFS_INPROG	0x0020
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  127) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  128) /* Support for data packed into inode blocks */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  129) #define OCFS2_FEATURE_INCOMPAT_INLINE_DATA	0x0040
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  130) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  131) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  132)  * Support for alternate, userspace cluster stacks.  If set, the superblock
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  133)  * field s_cluster_info contains a tag for the alternate stack in use as
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  134)  * well as the name of the cluster being joined.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  135)  * mount.ocfs2 must pass in a matching stack name.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  136)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  137)  * If not set, the classic stack will be used.  This is compatbile with
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  138)  * all older versions.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  139)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  140) #define OCFS2_FEATURE_INCOMPAT_USERSPACE_STACK	0x0080
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  141) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  142) /* Support for the extended slot map */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  143) #define OCFS2_FEATURE_INCOMPAT_EXTENDED_SLOT_MAP 0x100
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  144) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  145) /* Support for extended attributes */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  146) #define OCFS2_FEATURE_INCOMPAT_XATTR		0x0200
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  147) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  148) /* Support for indexed directores */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  149) #define OCFS2_FEATURE_INCOMPAT_INDEXED_DIRS	0x0400
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  150) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  151) /* Metadata checksum and error correction */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  152) #define OCFS2_FEATURE_INCOMPAT_META_ECC		0x0800
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  153) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  154) /* Refcount tree support */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  155) #define OCFS2_FEATURE_INCOMPAT_REFCOUNT_TREE	0x1000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  156) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  157) /* Discontiguous block groups */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  158) #define OCFS2_FEATURE_INCOMPAT_DISCONTIG_BG	0x2000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  159) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  160) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  161)  * Incompat bit to indicate useable clusterinfo with stackflags for all
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  162)  * cluster stacks (userspace adnd o2cb). If this bit is set,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  163)  * INCOMPAT_USERSPACE_STACK becomes superfluous and thus should not be set.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  164)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  165) #define OCFS2_FEATURE_INCOMPAT_CLUSTERINFO	0x4000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  166) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  167) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  168)  * Append Direct IO support
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  169)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  170) #define OCFS2_FEATURE_INCOMPAT_APPEND_DIO	0x8000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  171) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  172) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  173)  * backup superblock flag is used to indicate that this volume
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  174)  * has backup superblocks.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  175)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  176) #define OCFS2_FEATURE_COMPAT_BACKUP_SB		0x0001
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  177) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  178) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  179)  * The filesystem will correctly handle journal feature bits.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  180)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  181) #define OCFS2_FEATURE_COMPAT_JBD2_SB		0x0002
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  182) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  183) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  184)  * Unwritten extents support.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  185)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  186) #define OCFS2_FEATURE_RO_COMPAT_UNWRITTEN	0x0001
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  187) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  188) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  189)  * Maintain quota information for this filesystem
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  190)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  191) #define OCFS2_FEATURE_RO_COMPAT_USRQUOTA	0x0002
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  192) #define OCFS2_FEATURE_RO_COMPAT_GRPQUOTA	0x0004
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  193) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  194) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  195) /* The byte offset of the first backup block will be 1G.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  196)  * The following will be 4G, 16G, 64G, 256G and 1T.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  197)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  198) #define OCFS2_BACKUP_SB_START			1 << 30
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  199) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  200) /* the max backup superblock nums */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  201) #define OCFS2_MAX_BACKUP_SUPERBLOCKS	6
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  202) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  203) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  204)  * Flags on ocfs2_super_block.s_tunefs_flags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  205)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  206) #define OCFS2_TUNEFS_INPROG_REMOVE_SLOT		0x0001	/* Removing slots */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  207) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  208) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  209)  * Flags on ocfs2_dinode.i_flags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  210)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  211) #define OCFS2_VALID_FL		(0x00000001)	/* Inode is valid */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  212) #define OCFS2_UNUSED2_FL	(0x00000002)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  213) #define OCFS2_ORPHANED_FL	(0x00000004)	/* On the orphan list */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  214) #define OCFS2_UNUSED3_FL	(0x00000008)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  215) /* System inode flags */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  216) #define OCFS2_SYSTEM_FL		(0x00000010)	/* System inode */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  217) #define OCFS2_SUPER_BLOCK_FL	(0x00000020)	/* Super block */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  218) #define OCFS2_LOCAL_ALLOC_FL	(0x00000040)	/* Slot local alloc bitmap */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  219) #define OCFS2_BITMAP_FL		(0x00000080)	/* Allocation bitmap */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  220) #define OCFS2_JOURNAL_FL	(0x00000100)	/* Slot local journal */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  221) #define OCFS2_HEARTBEAT_FL	(0x00000200)	/* Heartbeat area */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  222) #define OCFS2_CHAIN_FL		(0x00000400)	/* Chain allocator */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  223) #define OCFS2_DEALLOC_FL	(0x00000800)	/* Truncate log */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  224) #define OCFS2_QUOTA_FL		(0x00001000)	/* Quota file */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  225) #define OCFS2_DIO_ORPHANED_FL	(0X00002000)	/* On the orphan list especially
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  226) 						 * for dio */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  227) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  228) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  229)  * Flags on ocfs2_dinode.i_dyn_features
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  230)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  231)  * These can change much more often than i_flags. When adding flags,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  232)  * keep in mind that i_dyn_features is only 16 bits wide.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  233)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  234) #define OCFS2_INLINE_DATA_FL	(0x0001)	/* Data stored in inode block */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  235) #define OCFS2_HAS_XATTR_FL	(0x0002)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  236) #define OCFS2_INLINE_XATTR_FL	(0x0004)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  237) #define OCFS2_INDEXED_DIR_FL	(0x0008)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  238) #define OCFS2_HAS_REFCOUNT_FL   (0x0010)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  239) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  240) /* Inode attributes, keep in sync with EXT2 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  241) #define OCFS2_SECRM_FL			FS_SECRM_FL	/* Secure deletion */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  242) #define OCFS2_UNRM_FL			FS_UNRM_FL	/* Undelete */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  243) #define OCFS2_COMPR_FL			FS_COMPR_FL	/* Compress file */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  244) #define OCFS2_SYNC_FL			FS_SYNC_FL	/* Synchronous updates */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  245) #define OCFS2_IMMUTABLE_FL		FS_IMMUTABLE_FL	/* Immutable file */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  246) #define OCFS2_APPEND_FL			FS_APPEND_FL	/* writes to file may only append */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  247) #define OCFS2_NODUMP_FL			FS_NODUMP_FL	/* do not dump file */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  248) #define OCFS2_NOATIME_FL		FS_NOATIME_FL	/* do not update atime */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  249) /* Reserved for compression usage... */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  250) #define OCFS2_DIRTY_FL			FS_DIRTY_FL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  251) #define OCFS2_COMPRBLK_FL		FS_COMPRBLK_FL	/* One or more compressed clusters */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  252) #define OCFS2_NOCOMP_FL			FS_NOCOMP_FL	/* Don't compress */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  253) #define OCFS2_ECOMPR_FL			FS_ECOMPR_FL	/* Compression error */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  254) /* End compression flags --- maybe not all used */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  255) #define OCFS2_BTREE_FL			FS_BTREE_FL	/* btree format dir */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  256) #define OCFS2_INDEX_FL			FS_INDEX_FL	/* hash-indexed directory */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  257) #define OCFS2_IMAGIC_FL			FS_IMAGIC_FL	/* AFS directory */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  258) #define OCFS2_JOURNAL_DATA_FL		FS_JOURNAL_DATA_FL /* Reserved for ext3 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  259) #define OCFS2_NOTAIL_FL			FS_NOTAIL_FL	/* file tail should not be merged */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  260) #define OCFS2_DIRSYNC_FL		FS_DIRSYNC_FL	/* dirsync behaviour (directories only) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  261) #define OCFS2_TOPDIR_FL			FS_TOPDIR_FL	/* Top of directory hierarchies*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  262) #define OCFS2_RESERVED_FL		FS_RESERVED_FL	/* reserved for ext2 lib */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  263) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  264) #define OCFS2_FL_VISIBLE		FS_FL_USER_VISIBLE	/* User visible flags */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  265) #define OCFS2_FL_MODIFIABLE		FS_FL_USER_MODIFIABLE	/* User modifiable flags */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  266) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  267) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  268)  * Extent record flags (e_node.leaf.flags)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  269)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  270) #define OCFS2_EXT_UNWRITTEN		(0x01)	/* Extent is allocated but
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  271) 						 * unwritten */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  272) #define OCFS2_EXT_REFCOUNTED		(0x02)  /* Extent is reference
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  273) 						 * counted in an associated
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  274) 						 * refcount tree */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  275) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  276) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  277)  * Journal Flags (ocfs2_dinode.id1.journal1.i_flags)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  278)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  279) #define OCFS2_JOURNAL_DIRTY_FL	(0x00000001)	/* Journal needs recovery */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  280) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  281) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  282)  * superblock s_state flags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  283)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  284) #define OCFS2_ERROR_FS		(0x00000001)	/* FS saw errors */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  285) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  286) /* Limit of space in ocfs2_dir_entry */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  287) #define OCFS2_MAX_FILENAME_LEN		255
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  288) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  289) /* Maximum slots on an ocfs2 file system */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  290) #define OCFS2_MAX_SLOTS			255
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  291) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  292) /* Slot map indicator for an empty slot */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  293) #define OCFS2_INVALID_SLOT		((u16)-1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  294) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  295) #define OCFS2_VOL_UUID_LEN		16
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  296) #define OCFS2_MAX_VOL_LABEL_LEN		64
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  297) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  298) /* The cluster stack fields */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  299) #define OCFS2_STACK_LABEL_LEN		4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  300) #define OCFS2_CLUSTER_NAME_LEN		16
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  301) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  302) /* Classic (historically speaking) cluster stack */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  303) #define OCFS2_CLASSIC_CLUSTER_STACK	"o2cb"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  304) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  305) /* Journal limits (in bytes) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  306) #define OCFS2_MIN_JOURNAL_SIZE		(4 * 1024 * 1024)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  307) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  308) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  309)  * Inline extended attribute size (in bytes)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  310)  * The value chosen should be aligned to 16 byte boundaries.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  311)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  312) #define OCFS2_MIN_XATTR_INLINE_SIZE     256
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  313) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  314) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  315)  * Cluster info flags (ocfs2_cluster_info.ci_stackflags)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  316)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  317) #define OCFS2_CLUSTER_O2CB_GLOBAL_HEARTBEAT	(0x01)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  318) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  319) struct ocfs2_system_inode_info {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  320) 	char	*si_name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  321) 	int	si_iflags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  322) 	int	si_mode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  323) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  324) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  325) /* System file index */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  326) enum {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  327) 	BAD_BLOCK_SYSTEM_INODE = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  328) 	GLOBAL_INODE_ALLOC_SYSTEM_INODE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  329) #define OCFS2_FIRST_ONLINE_SYSTEM_INODE GLOBAL_INODE_ALLOC_SYSTEM_INODE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  330) 	SLOT_MAP_SYSTEM_INODE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  331) 	HEARTBEAT_SYSTEM_INODE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  332) 	GLOBAL_BITMAP_SYSTEM_INODE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  333) 	USER_QUOTA_SYSTEM_INODE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  334) 	GROUP_QUOTA_SYSTEM_INODE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  335) #define OCFS2_LAST_GLOBAL_SYSTEM_INODE GROUP_QUOTA_SYSTEM_INODE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  336) #define OCFS2_FIRST_LOCAL_SYSTEM_INODE ORPHAN_DIR_SYSTEM_INODE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  337) 	ORPHAN_DIR_SYSTEM_INODE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  338) 	EXTENT_ALLOC_SYSTEM_INODE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  339) 	INODE_ALLOC_SYSTEM_INODE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  340) 	JOURNAL_SYSTEM_INODE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  341) 	LOCAL_ALLOC_SYSTEM_INODE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  342) 	TRUNCATE_LOG_SYSTEM_INODE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  343) 	LOCAL_USER_QUOTA_SYSTEM_INODE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  344) 	LOCAL_GROUP_QUOTA_SYSTEM_INODE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  345) #define OCFS2_LAST_LOCAL_SYSTEM_INODE LOCAL_GROUP_QUOTA_SYSTEM_INODE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  346) 	NUM_SYSTEM_INODES
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  347) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  348) #define NUM_GLOBAL_SYSTEM_INODES OCFS2_FIRST_LOCAL_SYSTEM_INODE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  349) #define NUM_LOCAL_SYSTEM_INODES	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  350) 		(NUM_SYSTEM_INODES - OCFS2_FIRST_LOCAL_SYSTEM_INODE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  351) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  352) static struct ocfs2_system_inode_info ocfs2_system_inodes[NUM_SYSTEM_INODES] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  353) 	/* Global system inodes (single copy) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  354) 	/* The first two are only used from userspace mfks/tunefs */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  355) 	[BAD_BLOCK_SYSTEM_INODE]		= { "bad_blocks", 0, S_IFREG | 0644 },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  356) 	[GLOBAL_INODE_ALLOC_SYSTEM_INODE] 	= { "global_inode_alloc", OCFS2_BITMAP_FL | OCFS2_CHAIN_FL, S_IFREG | 0644 },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  357) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  358) 	/* These are used by the running filesystem */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  359) 	[SLOT_MAP_SYSTEM_INODE]			= { "slot_map", 0, S_IFREG | 0644 },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  360) 	[HEARTBEAT_SYSTEM_INODE]		= { "heartbeat", OCFS2_HEARTBEAT_FL, S_IFREG | 0644 },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  361) 	[GLOBAL_BITMAP_SYSTEM_INODE]		= { "global_bitmap", 0, S_IFREG | 0644 },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  362) 	[USER_QUOTA_SYSTEM_INODE]		= { "aquota.user", OCFS2_QUOTA_FL, S_IFREG | 0644 },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  363) 	[GROUP_QUOTA_SYSTEM_INODE]		= { "aquota.group", OCFS2_QUOTA_FL, S_IFREG | 0644 },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  364) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  365) 	/* Slot-specific system inodes (one copy per slot) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  366) 	[ORPHAN_DIR_SYSTEM_INODE]		= { "orphan_dir:%04d", 0, S_IFDIR | 0755 },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  367) 	[EXTENT_ALLOC_SYSTEM_INODE]		= { "extent_alloc:%04d", OCFS2_BITMAP_FL | OCFS2_CHAIN_FL, S_IFREG | 0644 },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  368) 	[INODE_ALLOC_SYSTEM_INODE]		= { "inode_alloc:%04d", OCFS2_BITMAP_FL | OCFS2_CHAIN_FL, S_IFREG | 0644 },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  369) 	[JOURNAL_SYSTEM_INODE]			= { "journal:%04d", OCFS2_JOURNAL_FL, S_IFREG | 0644 },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  370) 	[LOCAL_ALLOC_SYSTEM_INODE]		= { "local_alloc:%04d", OCFS2_BITMAP_FL | OCFS2_LOCAL_ALLOC_FL, S_IFREG | 0644 },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  371) 	[TRUNCATE_LOG_SYSTEM_INODE]		= { "truncate_log:%04d", OCFS2_DEALLOC_FL, S_IFREG | 0644 },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  372) 	[LOCAL_USER_QUOTA_SYSTEM_INODE]		= { "aquota.user:%04d", OCFS2_QUOTA_FL, S_IFREG | 0644 },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  373) 	[LOCAL_GROUP_QUOTA_SYSTEM_INODE]	= { "aquota.group:%04d", OCFS2_QUOTA_FL, S_IFREG | 0644 },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  374) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  375) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  376) /* Parameter passed from mount.ocfs2 to module */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  377) #define OCFS2_HB_NONE			"heartbeat=none"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  378) #define OCFS2_HB_LOCAL			"heartbeat=local"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  379) #define OCFS2_HB_GLOBAL			"heartbeat=global"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  380) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  381) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  382)  * OCFS2_DIR_PAD defines the directory entries boundaries
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  383)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  384)  * NOTE: It must be a multiple of 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  385)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  386) #define OCFS2_DIR_PAD			4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  387) #define OCFS2_DIR_ROUND			(OCFS2_DIR_PAD - 1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  388) #define OCFS2_DIR_MEMBER_LEN 		offsetof(struct ocfs2_dir_entry, name)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  389) #define OCFS2_DIR_REC_LEN(name_len)	(((name_len) + OCFS2_DIR_MEMBER_LEN + \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  390)                                           OCFS2_DIR_ROUND) & \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  391) 					 ~OCFS2_DIR_ROUND)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  392) #define OCFS2_DIR_MIN_REC_LEN	OCFS2_DIR_REC_LEN(1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  393) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  394) #define OCFS2_LINK_MAX		32000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  395) #define	OCFS2_DX_LINK_MAX	((1U << 31) - 1U)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  396) #define	OCFS2_LINKS_HI_SHIFT	16
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  397) #define	OCFS2_DX_ENTRIES_MAX	(0xffffffffU)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  398) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  399) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  400) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  401)  * Convenience casts
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  402)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  403) #define OCFS2_RAW_SB(dinode)		(&((dinode)->id2.i_super))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  404) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  405) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  406)  * Block checking structure.  This is used in metadata to validate the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  407)  * contents.  If OCFS2_FEATURE_INCOMPAT_META_ECC is not set, it is all
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  408)  * zeros.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  409)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  410) struct ocfs2_block_check {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  411) /*00*/	__le32 bc_crc32e;	/* 802.3 Ethernet II CRC32 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  412) 	__le16 bc_ecc;		/* Single-error-correction parity vector.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  413) 				   This is a simple Hamming code dependent
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  414) 				   on the blocksize.  OCFS2's maximum
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  415) 				   blocksize, 4K, requires 16 parity bits,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  416) 				   so we fit in __le16. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  417) 	__le16 bc_reserved1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  418) /*08*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  419) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  420) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  421) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  422)  * On disk extent record for OCFS2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  423)  * It describes a range of clusters on disk.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  424)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  425)  * Length fields are divided into interior and leaf node versions.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  426)  * This leaves room for a flags field (OCFS2_EXT_*) in the leaf nodes.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  427)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  428) struct ocfs2_extent_rec {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  429) /*00*/	__le32 e_cpos;		/* Offset into the file, in clusters */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  430) 	union {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  431) 		__le32 e_int_clusters; /* Clusters covered by all children */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  432) 		struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  433) 			__le16 e_leaf_clusters; /* Clusters covered by this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  434) 						   extent */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  435) 			__u8 e_reserved1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  436) 			__u8 e_flags; /* Extent flags */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  437) 		};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  438) 	};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  439) 	__le64 e_blkno;		/* Physical disk offset, in blocks */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  440) /*10*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  441) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  442) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  443) struct ocfs2_chain_rec {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  444) 	__le32 c_free;	/* Number of free bits in this chain. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  445) 	__le32 c_total;	/* Number of total bits in this chain */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  446) 	__le64 c_blkno;	/* Physical disk offset (blocks) of 1st group */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  447) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  448) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  449) struct ocfs2_truncate_rec {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  450) 	__le32 t_start;		/* 1st cluster in this log */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  451) 	__le32 t_clusters;	/* Number of total clusters covered */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  452) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  453) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  454) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  455)  * On disk extent list for OCFS2 (node in the tree).  Note that this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  456)  * is contained inside ocfs2_dinode or ocfs2_extent_block, so the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  457)  * offsets are relative to ocfs2_dinode.id2.i_list or
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  458)  * ocfs2_extent_block.h_list, respectively.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  459)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  460) struct ocfs2_extent_list {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  461) /*00*/	__le16 l_tree_depth;		/* Extent tree depth from this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  462) 					   point.  0 means data extents
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  463) 					   hang directly off this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  464) 					   header (a leaf)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  465) 					   NOTE: The high 8 bits cannot be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  466) 					   used - tree_depth is never that big.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  467) 					*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  468) 	__le16 l_count;			/* Number of extent records */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  469) 	__le16 l_next_free_rec;		/* Next unused extent slot */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  470) 	__le16 l_reserved1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  471) 	__le64 l_reserved2;		/* Pad to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  472) 					   sizeof(ocfs2_extent_rec) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  473) /*10*/	struct ocfs2_extent_rec l_recs[];	/* Extent records */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  474) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  475) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  476) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  477)  * On disk allocation chain list for OCFS2.  Note that this is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  478)  * contained inside ocfs2_dinode, so the offsets are relative to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  479)  * ocfs2_dinode.id2.i_chain.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  480)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  481) struct ocfs2_chain_list {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  482) /*00*/	__le16 cl_cpg;			/* Clusters per Block Group */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  483) 	__le16 cl_bpc;			/* Bits per cluster */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  484) 	__le16 cl_count;		/* Total chains in this list */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  485) 	__le16 cl_next_free_rec;	/* Next unused chain slot */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  486) 	__le64 cl_reserved1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  487) /*10*/	struct ocfs2_chain_rec cl_recs[];	/* Chain records */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  488) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  489) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  490) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  491)  * On disk deallocation log for OCFS2.  Note that this is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  492)  * contained inside ocfs2_dinode, so the offsets are relative to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  493)  * ocfs2_dinode.id2.i_dealloc.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  494)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  495) struct ocfs2_truncate_log {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  496) /*00*/	__le16 tl_count;		/* Total records in this log */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  497) 	__le16 tl_used;			/* Number of records in use */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  498) 	__le32 tl_reserved1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  499) /*08*/	struct ocfs2_truncate_rec tl_recs[];	/* Truncate records */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  500) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  501) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  502) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  503)  * On disk extent block (indirect block) for OCFS2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  504)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  505) struct ocfs2_extent_block
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  506) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  507) /*00*/	__u8 h_signature[8];		/* Signature for verification */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  508) 	struct ocfs2_block_check h_check;	/* Error checking */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  509) /*10*/	__le16 h_suballoc_slot;		/* Slot suballocator this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  510) 					   extent_header belongs to */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  511) 	__le16 h_suballoc_bit;		/* Bit offset in suballocator
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  512) 					   block group */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  513) 	__le32 h_fs_generation;		/* Must match super block */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  514) 	__le64 h_blkno;			/* Offset on disk, in blocks */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  515) /*20*/	__le64 h_suballoc_loc;		/* Suballocator block group this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  516) 					   eb belongs to.  Only valid
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  517) 					   if allocated from a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  518) 					   discontiguous block group */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  519) 	__le64 h_next_leaf_blk;		/* Offset on disk, in blocks,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  520) 					   of next leaf header pointing
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  521) 					   to data */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  522) /*30*/	struct ocfs2_extent_list h_list;	/* Extent record list */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  523) /* Actual on-disk size is one block */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  524) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  525) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  526) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  527)  * On disk slot map for OCFS2.  This defines the contents of the "slot_map"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  528)  * system file.  A slot is valid if it contains a node number >= 0.  The
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  529)  * value -1 (0xFFFF) is OCFS2_INVALID_SLOT.  This marks a slot empty.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  530)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  531) struct ocfs2_slot_map {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  532) /*00*/	__le16 sm_slots[0];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  533) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  534)  * Actual on-disk size is one block.  OCFS2_MAX_SLOTS is 255,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  535)  * 255 * sizeof(__le16) == 512B, within the 512B block minimum blocksize.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  536)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  537) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  538) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  539) struct ocfs2_extended_slot {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  540) /*00*/	__u8	es_valid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  541) 	__u8	es_reserved1[3];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  542) 	__le32	es_node_num;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  543) /*08*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  544) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  545) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  546) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  547)  * The extended slot map, used when OCFS2_FEATURE_INCOMPAT_EXTENDED_SLOT_MAP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  548)  * is set.  It separates out the valid marker from the node number, and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  549)  * has room to grow.  Unlike the old slot map, this format is defined by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  550)  * i_size.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  551)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  552) struct ocfs2_slot_map_extended {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  553) /*00*/	struct ocfs2_extended_slot se_slots[0];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  554) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  555)  * Actual size is i_size of the slot_map system file.  It should
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  556)  * match s_max_slots * sizeof(struct ocfs2_extended_slot)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  557)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  558) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  559) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  560) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  561)  * ci_stackflags is only valid if the incompat bit
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  562)  * OCFS2_FEATURE_INCOMPAT_CLUSTERINFO is set.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  563)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  564) struct ocfs2_cluster_info {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  565) /*00*/	__u8   ci_stack[OCFS2_STACK_LABEL_LEN];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  566) 	union {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  567) 		__le32 ci_reserved;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  568) 		struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  569) 			__u8 ci_stackflags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  570) 			__u8 ci_reserved1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  571) 			__u8 ci_reserved2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  572) 			__u8 ci_reserved3;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  573) 		};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  574) 	};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  575) /*08*/	__u8   ci_cluster[OCFS2_CLUSTER_NAME_LEN];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  576) /*18*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  577) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  578) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  579) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  580)  * On disk superblock for OCFS2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  581)  * Note that it is contained inside an ocfs2_dinode, so all offsets
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  582)  * are relative to the start of ocfs2_dinode.id2.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  583)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  584) struct ocfs2_super_block {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  585) /*00*/	__le16 s_major_rev_level;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  586) 	__le16 s_minor_rev_level;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  587) 	__le16 s_mnt_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  588) 	__le16 s_max_mnt_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  589) 	__le16 s_state;			/* File system state */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  590) 	__le16 s_errors;			/* Behaviour when detecting errors */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  591) 	__le32 s_checkinterval;		/* Max time between checks */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  592) /*10*/	__le64 s_lastcheck;		/* Time of last check */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  593) 	__le32 s_creator_os;		/* OS */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  594) 	__le32 s_feature_compat;		/* Compatible feature set */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  595) /*20*/	__le32 s_feature_incompat;	/* Incompatible feature set */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  596) 	__le32 s_feature_ro_compat;	/* Readonly-compatible feature set */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  597) 	__le64 s_root_blkno;		/* Offset, in blocks, of root directory
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  598) 					   dinode */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  599) /*30*/	__le64 s_system_dir_blkno;	/* Offset, in blocks, of system
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  600) 					   directory dinode */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  601) 	__le32 s_blocksize_bits;		/* Blocksize for this fs */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  602) 	__le32 s_clustersize_bits;	/* Clustersize for this fs */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  603) /*40*/	__le16 s_max_slots;		/* Max number of simultaneous mounts
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  604) 					   before tunefs required */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  605) 	__le16 s_tunefs_flag;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  606) 	__le32 s_uuid_hash;		/* hash value of uuid */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  607) 	__le64 s_first_cluster_group;	/* Block offset of 1st cluster
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  608) 					 * group header */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  609) /*50*/	__u8  s_label[OCFS2_MAX_VOL_LABEL_LEN];	/* Label for mounting, etc. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  610) /*90*/	__u8  s_uuid[OCFS2_VOL_UUID_LEN];	/* 128-bit uuid */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  611) /*A0*/  struct ocfs2_cluster_info s_cluster_info; /* Only valid if either
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  612) 						     userspace or clusterinfo
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  613) 						     INCOMPAT flag set. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  614) /*B8*/	__le16 s_xattr_inline_size;	/* extended attribute inline size
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  615) 					   for this fs*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  616) 	__le16 s_reserved0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  617) 	__le32 s_dx_seed[3];		/* seed[0-2] for dx dir hash.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  618) 					 * s_uuid_hash serves as seed[3]. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  619) /*C0*/  __le64 s_reserved2[15];		/* Fill out superblock */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  620) /*140*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  621) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  622) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  623) 	 * NOTE: As stated above, all offsets are relative to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  624) 	 * ocfs2_dinode.id2, which is at 0xC0 in the inode.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  625) 	 * 0xC0 + 0x140 = 0x200 or 512 bytes.  A superblock must fit within
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  626) 	 * our smallest blocksize, which is 512 bytes.  To ensure this,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  627) 	 * we reserve the space in s_reserved2.  Anything past s_reserved2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  628) 	 * will not be available on the smallest blocksize.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  629) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  630) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  631) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  632) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  633)  * Local allocation bitmap for OCFS2 slots
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  634)  * Note that it exists inside an ocfs2_dinode, so all offsets are
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  635)  * relative to the start of ocfs2_dinode.id2.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  636)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  637) struct ocfs2_local_alloc
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  638) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  639) /*00*/	__le32 la_bm_off;	/* Starting bit offset in main bitmap */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  640) 	__le16 la_size;		/* Size of included bitmap, in bytes */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  641) 	__le16 la_reserved1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  642) 	__le64 la_reserved2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  643) /*10*/	__u8   la_bitmap[];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  644) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  645) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  646) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  647)  * Data-in-inode header. This is only used if i_dyn_features has
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  648)  * OCFS2_INLINE_DATA_FL set.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  649)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  650) struct ocfs2_inline_data
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  651) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  652) /*00*/	__le16	id_count;	/* Number of bytes that can be used
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  653) 				 * for data, starting at id_data */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  654) 	__le16	id_reserved0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  655) 	__le32	id_reserved1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  656) 	__u8	id_data[];	/* Start of user data */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  657) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  658) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  659) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  660)  * On disk inode for OCFS2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  661)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  662) struct ocfs2_dinode {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  663) /*00*/	__u8 i_signature[8];		/* Signature for validation */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  664) 	__le32 i_generation;		/* Generation number */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  665) 	__le16 i_suballoc_slot;		/* Slot suballocator this inode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  666) 					   belongs to */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  667) 	__le16 i_suballoc_bit;		/* Bit offset in suballocator
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  668) 					   block group */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  669) /*10*/	__le16 i_links_count_hi;	/* High 16 bits of links count */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  670) 	__le16 i_xattr_inline_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  671) 	__le32 i_clusters;		/* Cluster count */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  672) 	__le32 i_uid;			/* Owner UID */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  673) 	__le32 i_gid;			/* Owning GID */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  674) /*20*/	__le64 i_size;			/* Size in bytes */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  675) 	__le16 i_mode;			/* File mode */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  676) 	__le16 i_links_count;		/* Links count */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  677) 	__le32 i_flags;			/* File flags */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  678) /*30*/	__le64 i_atime;			/* Access time */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  679) 	__le64 i_ctime;			/* Creation time */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  680) /*40*/	__le64 i_mtime;			/* Modification time */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  681) 	__le64 i_dtime;			/* Deletion time */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  682) /*50*/	__le64 i_blkno;			/* Offset on disk, in blocks */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  683) 	__le64 i_last_eb_blk;		/* Pointer to last extent
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  684) 					   block */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  685) /*60*/	__le32 i_fs_generation;		/* Generation per fs-instance */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  686) 	__le32 i_atime_nsec;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  687) 	__le32 i_ctime_nsec;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  688) 	__le32 i_mtime_nsec;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  689) /*70*/	__le32 i_attr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  690) 	__le16 i_orphaned_slot;		/* Only valid when OCFS2_ORPHANED_FL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  691) 					   was set in i_flags */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  692) 	__le16 i_dyn_features;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  693) 	__le64 i_xattr_loc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  694) /*80*/	struct ocfs2_block_check i_check;	/* Error checking */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  695) /*88*/	__le64 i_dx_root;		/* Pointer to dir index root block */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  696) /*90*/	__le64 i_refcount_loc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  697) 	__le64 i_suballoc_loc;		/* Suballocator block group this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  698) 					   inode belongs to.  Only valid
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  699) 					   if allocated from a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  700) 					   discontiguous block group */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  701) /*A0*/	__le16 i_dio_orphaned_slot;	/* only used for append dio write */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  702) 	__le16 i_reserved1[3];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  703) 	__le64 i_reserved2[2];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  704) /*B8*/	union {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  705) 		__le64 i_pad1;		/* Generic way to refer to this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  706) 					   64bit union */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  707) 		struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  708) 			__le64 i_rdev;	/* Device number */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  709) 		} dev1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  710) 		struct {		/* Info for bitmap system
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  711) 					   inodes */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  712) 			__le32 i_used;	/* Bits (ie, clusters) used  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  713) 			__le32 i_total;	/* Total bits (clusters)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  714) 					   available */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  715) 		} bitmap1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  716) 		struct {		/* Info for journal system
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  717) 					   inodes */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  718) 			__le32 ij_flags;	/* Mounted, version, etc. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  719) 			__le32 ij_recovery_generation; /* Incremented when the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  720) 							  journal is recovered
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  721) 							  after an unclean
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  722) 							  shutdown */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  723) 		} journal1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  724) 	} id1;				/* Inode type dependent 1 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  725) /*C0*/	union {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  726) 		struct ocfs2_super_block	i_super;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  727) 		struct ocfs2_local_alloc	i_lab;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  728) 		struct ocfs2_chain_list		i_chain;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  729) 		struct ocfs2_extent_list	i_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  730) 		struct ocfs2_truncate_log	i_dealloc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  731) 		struct ocfs2_inline_data	i_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  732) 		__u8               		i_symlink[0];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  733) 	} id2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  734) /* Actual on-disk size is one block */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  735) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  736) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  737) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  738)  * On-disk directory entry structure for OCFS2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  739)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  740)  * Packed as this structure could be accessed unaligned on 64-bit platforms
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  741)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  742) struct ocfs2_dir_entry {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  743) /*00*/	__le64   inode;                  /* Inode number */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  744) 	__le16   rec_len;                /* Directory entry length */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  745) 	__u8    name_len;               /* Name length */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  746) 	__u8    file_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  747) /*0C*/	char    name[OCFS2_MAX_FILENAME_LEN];   /* File name */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  748) /* Actual on-disk length specified by rec_len */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  749) } __attribute__ ((packed));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  750) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  751) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  752)  * Per-block record for the unindexed directory btree. This is carefully
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  753)  * crafted so that the rec_len and name_len records of an ocfs2_dir_entry are
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  754)  * mirrored. That way, the directory manipulation code needs a minimal amount
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  755)  * of update.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  756)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  757)  * NOTE: Keep this structure aligned to a multiple of 4 bytes.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  758)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  759) struct ocfs2_dir_block_trailer {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  760) /*00*/	__le64		db_compat_inode;	/* Always zero. Was inode */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  761) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  762) 	__le16		db_compat_rec_len;	/* Backwards compatible with
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  763) 						 * ocfs2_dir_entry. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  764) 	__u8		db_compat_name_len;	/* Always zero. Was name_len */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  765) 	__u8		db_reserved0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  766) 	__le16		db_reserved1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  767) 	__le16		db_free_rec_len;	/* Size of largest empty hole
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  768) 						 * in this block. (unused) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  769) /*10*/	__u8		db_signature[8];	/* Signature for verification */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  770) 	__le64		db_reserved2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  771) /*20*/	__le64		db_free_next;		/* Next block in list (unused) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  772) 	__le64		db_blkno;		/* Offset on disk, in blocks */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  773) /*30*/	__le64		db_parent_dinode;	/* dinode which owns me, in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  774) 						   blocks */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  775) 	struct ocfs2_block_check db_check;	/* Error checking */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  776) /*40*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  777) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  778) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  779)  /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  780)  * A directory entry in the indexed tree. We don't store the full name here,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  781)  * but instead provide a pointer to the full dirent in the unindexed tree.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  782)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  783)  * We also store name_len here so as to reduce the number of leaf blocks we
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  784)  * need to search in case of collisions.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  785)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  786) struct ocfs2_dx_entry {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  787) 	__le32		dx_major_hash;	/* Used to find logical
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  788) 					 * cluster in index */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  789) 	__le32		dx_minor_hash;	/* Lower bits used to find
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  790) 					 * block in cluster */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  791) 	__le64		dx_dirent_blk;	/* Physical block in unindexed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  792) 					 * tree holding this dirent. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  793) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  794) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  795) struct ocfs2_dx_entry_list {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  796) 	__le32		de_reserved;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  797) 	__le16		de_count;	/* Maximum number of entries
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  798) 					 * possible in de_entries */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  799) 	__le16		de_num_used;	/* Current number of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  800) 					 * de_entries entries */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  801) 	struct	ocfs2_dx_entry		de_entries[];	/* Indexed dir entries
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  802) 							 * in a packed array of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  803) 							 * length de_num_used */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  804) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  805) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  806) #define OCFS2_DX_FLAG_INLINE	0x01
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  807) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  808) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  809)  * A directory indexing block. Each indexed directory has one of these,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  810)  * pointed to by ocfs2_dinode.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  811)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  812)  * This block stores an indexed btree root, and a set of free space
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  813)  * start-of-list pointers.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  814)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  815) struct ocfs2_dx_root_block {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  816) 	__u8		dr_signature[8];	/* Signature for verification */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  817) 	struct ocfs2_block_check dr_check;	/* Error checking */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  818) 	__le16		dr_suballoc_slot;	/* Slot suballocator this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  819) 						 * block belongs to. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  820) 	__le16		dr_suballoc_bit;	/* Bit offset in suballocator
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  821) 						 * block group */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  822) 	__le32		dr_fs_generation;	/* Must match super block */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  823) 	__le64		dr_blkno;		/* Offset on disk, in blocks */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  824) 	__le64		dr_last_eb_blk;		/* Pointer to last
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  825) 						 * extent block */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  826) 	__le32		dr_clusters;		/* Clusters allocated
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  827) 						 * to the indexed tree. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  828) 	__u8		dr_flags;		/* OCFS2_DX_FLAG_* flags */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  829) 	__u8		dr_reserved0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  830) 	__le16		dr_reserved1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  831) 	__le64		dr_dir_blkno;		/* Pointer to parent inode */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  832) 	__le32		dr_num_entries;		/* Total number of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  833) 						 * names stored in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  834) 						 * this directory.*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  835) 	__le32		dr_reserved2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  836) 	__le64		dr_free_blk;		/* Pointer to head of free
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  837) 						 * unindexed block list. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  838) 	__le64		dr_suballoc_loc;	/* Suballocator block group
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  839) 						   this root belongs to.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  840) 						   Only valid if allocated
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  841) 						   from a discontiguous
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  842) 						   block group */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  843) 	__le64		dr_reserved3[14];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  844) 	union {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  845) 		struct ocfs2_extent_list dr_list; /* Keep this aligned to 128
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  846) 						   * bits for maximum space
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  847) 						   * efficiency. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  848) 		struct ocfs2_dx_entry_list dr_entries; /* In-root-block list of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  849) 							* entries. We grow out
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  850) 							* to extents if this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  851) 							* gets too big. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  852) 	};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  853) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  854) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  855) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  856)  * The header of a leaf block in the indexed tree.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  857)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  858) struct ocfs2_dx_leaf {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  859) 	__u8		dl_signature[8];/* Signature for verification */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  860) 	struct ocfs2_block_check dl_check;	/* Error checking */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  861) 	__le64		dl_blkno;	/* Offset on disk, in blocks */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  862) 	__le32		dl_fs_generation;/* Must match super block */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  863) 	__le32		dl_reserved0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  864) 	__le64		dl_reserved1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  865) 	struct ocfs2_dx_entry_list	dl_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  866) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  867) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  868) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  869)  * Largest bitmap for a block (suballocator) group in bytes.  This limit
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  870)  * does not affect cluster groups (global allocator).  Cluster group
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  871)  * bitmaps run to the end of the block.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  872)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  873) #define OCFS2_MAX_BG_BITMAP_SIZE	256
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  874) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  875) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  876)  * On disk allocator group structure for OCFS2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  877)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  878) struct ocfs2_group_desc
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  879) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  880) /*00*/	__u8    bg_signature[8];        /* Signature for validation */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  881) 	__le16   bg_size;                /* Size of included bitmap in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  882) 					   bytes. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  883) 	__le16   bg_bits;                /* Bits represented by this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  884) 					   group. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  885) 	__le16	bg_free_bits_count;     /* Free bits count */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  886) 	__le16   bg_chain;               /* What chain I am in. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  887) /*10*/	__le32   bg_generation;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  888) 	__le32	bg_reserved1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  889) 	__le64   bg_next_group;          /* Next group in my list, in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  890) 					   blocks */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  891) /*20*/	__le64   bg_parent_dinode;       /* dinode which owns me, in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  892) 					   blocks */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  893) 	__le64   bg_blkno;               /* Offset on disk, in blocks */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  894) /*30*/	struct ocfs2_block_check bg_check;	/* Error checking */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  895) 	__le64   bg_reserved2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  896) /*40*/	union {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  897) 		__u8    bg_bitmap[0];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  898) 		struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  899) 			/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  900) 			 * Block groups may be discontiguous when
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  901) 			 * OCFS2_FEATURE_INCOMPAT_DISCONTIG_BG is set.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  902) 			 * The extents of a discontiguous block group are
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  903) 			 * stored in bg_list.  It is a flat list.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  904) 			 * l_tree_depth must always be zero.  A
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  905) 			 * discontiguous group is signified by a non-zero
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  906) 			 * bg_list->l_next_free_rec.  Only block groups
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  907) 			 * can be discontiguous; Cluster groups cannot.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  908) 			 * We've never made a block group with more than
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  909) 			 * 2048 blocks (256 bytes of bg_bitmap).  This
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  910) 			 * codifies that limit so that we can fit bg_list.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  911) 			 * bg_size of a discontiguous block group will
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  912) 			 * be 256 to match bg_bitmap_filler.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  913) 			 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  914) 			__u8 bg_bitmap_filler[OCFS2_MAX_BG_BITMAP_SIZE];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  915) /*140*/			struct ocfs2_extent_list bg_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  916) 		};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  917) 	};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  918) /* Actual on-disk size is one block */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  919) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  920) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  921) struct ocfs2_refcount_rec {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  922) /*00*/	__le64 r_cpos;		/* Physical offset, in clusters */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  923) 	__le32 r_clusters;	/* Clusters covered by this extent */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  924) 	__le32 r_refcount;	/* Reference count of this extent */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  925) /*10*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  926) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  927) #define OCFS2_32BIT_POS_MASK		(0xffffffffULL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  928) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  929) #define OCFS2_REFCOUNT_LEAF_FL          (0x00000001)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  930) #define OCFS2_REFCOUNT_TREE_FL          (0x00000002)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  931) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  932) struct ocfs2_refcount_list {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  933) /*00*/	__le16 rl_count;	/* Maximum number of entries possible
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  934) 				   in rl_records */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  935) 	__le16 rl_used;		/* Current number of used records */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  936) 	__le32 rl_reserved2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  937) 	__le64 rl_reserved1;	/* Pad to sizeof(ocfs2_refcount_record) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  938) /*10*/	struct ocfs2_refcount_rec rl_recs[];	/* Refcount records */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  939) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  940) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  941) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  942) struct ocfs2_refcount_block {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  943) /*00*/	__u8 rf_signature[8];		/* Signature for verification */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  944) 	__le16 rf_suballoc_slot;	/* Slot suballocator this block
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  945) 					   belongs to */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  946) 	__le16 rf_suballoc_bit;		/* Bit offset in suballocator
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  947) 					   block group */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  948) 	__le32 rf_fs_generation;	/* Must match superblock */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  949) /*10*/	__le64 rf_blkno;		/* Offset on disk, in blocks */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  950) 	__le64 rf_parent;		/* Parent block, only valid if
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  951) 					   OCFS2_REFCOUNT_LEAF_FL is set in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  952) 					   rf_flags */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  953) /*20*/	struct ocfs2_block_check rf_check;	/* Error checking */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  954) 	__le64 rf_last_eb_blk;		/* Pointer to last extent block */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  955) /*30*/	__le32 rf_count;		/* Number of inodes sharing this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  956) 					   refcount tree */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  957) 	__le32 rf_flags;		/* See the flags above */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  958) 	__le32 rf_clusters;		/* clusters covered by refcount tree. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  959) 	__le32 rf_cpos;			/* cluster offset in refcount tree.*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  960) /*40*/	__le32 rf_generation;		/* generation number. all be the same
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  961) 					 * for the same refcount tree. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  962) 	__le32 rf_reserved0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  963) 	__le64 rf_suballoc_loc;		/* Suballocator block group this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  964) 					   refcount block belongs to. Only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  965) 					   valid if allocated from a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  966) 					   discontiguous block group */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  967) /*50*/	__le64 rf_reserved1[6];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  968) /*80*/	union {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  969) 		struct ocfs2_refcount_list rf_records;  /* List of refcount
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  970) 							  records */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  971) 		struct ocfs2_extent_list rf_list;	/* Extent record list,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  972) 							only valid if
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  973) 							OCFS2_REFCOUNT_TREE_FL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  974) 							is set in rf_flags */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  975) 	};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  976) /* Actual on-disk size is one block */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  977) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  978) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  979) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  980)  * On disk extended attribute structure for OCFS2.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  981)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  982) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  983) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  984)  * ocfs2_xattr_entry indicates one extend attribute.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  985)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  986)  * Note that it can be stored in inode, one block or one xattr bucket.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  987)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  988) struct ocfs2_xattr_entry {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  989) 	__le32	xe_name_hash;    /* hash value of xattr prefix+suffix. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  990) 	__le16	xe_name_offset;  /* byte offset from the 1st entry in the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  991) 				    local xattr storage(inode, xattr block or
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  992) 				    xattr bucket). */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  993) 	__u8	xe_name_len;	 /* xattr name len, doesn't include prefix. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  994) 	__u8	xe_type;         /* the low 7 bits indicate the name prefix
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  995) 				  * type and the highest bit indicates whether
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  996) 				  * the EA is stored in the local storage. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  997) 	__le64	xe_value_size;	 /* real xattr value length. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  998) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  999) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1000) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1001)  * On disk structure for xattr header.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1002)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1003)  * One ocfs2_xattr_header describes how many ocfs2_xattr_entry records in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1004)  * the local xattr storage.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1005)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1006) struct ocfs2_xattr_header {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1007) 	__le16	xh_count;                       /* contains the count of how
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1008) 						   many records are in the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1009) 						   local xattr storage. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1010) 	__le16	xh_free_start;                  /* current offset for storing
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1011) 						   xattr. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1012) 	__le16	xh_name_value_len;              /* total length of name/value
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1013) 						   length in this bucket. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1014) 	__le16	xh_num_buckets;                 /* Number of xattr buckets
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1015) 						   in this extent record,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1016) 						   only valid in the first
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1017) 						   bucket. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1018) 	struct ocfs2_block_check xh_check;	/* Error checking
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1019) 						   (Note, this is only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1020) 						    used for xattr
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1021) 						    buckets.  A block uses
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1022) 						    xb_check and sets
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1023) 						    this field to zero.) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1024) 	struct ocfs2_xattr_entry xh_entries[]; /* xattr entry list. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1025) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1026) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1027) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1028)  * On disk structure for xattr value root.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1029)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1030)  * When an xattr's value is large enough, it is stored in an external
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1031)  * b-tree like file data.  The xattr value root points to this structure.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1032)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1033) struct ocfs2_xattr_value_root {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1034) /*00*/	__le32	xr_clusters;              /* clusters covered by xattr value. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1035) 	__le32	xr_reserved0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1036) 	__le64	xr_last_eb_blk;           /* Pointer to last extent block */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1037) /*10*/	struct ocfs2_extent_list xr_list; /* Extent record list */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1038) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1039) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1040) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1041)  * On disk structure for xattr tree root.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1042)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1043)  * It is used when there are too many extended attributes for one file. These
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1044)  * attributes will be organized and stored in an indexed-btree.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1045)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1046) struct ocfs2_xattr_tree_root {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1047) /*00*/	__le32	xt_clusters;              /* clusters covered by xattr. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1048) 	__le32	xt_reserved0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1049) 	__le64	xt_last_eb_blk;           /* Pointer to last extent block */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1050) /*10*/	struct ocfs2_extent_list xt_list; /* Extent record list */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1051) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1052) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1053) #define OCFS2_XATTR_INDEXED	0x1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1054) #define OCFS2_HASH_SHIFT	5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1055) #define OCFS2_XATTR_ROUND	3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1056) #define OCFS2_XATTR_SIZE(size)	(((size) + OCFS2_XATTR_ROUND) & \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1057) 				~(OCFS2_XATTR_ROUND))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1058) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1059) #define OCFS2_XATTR_BUCKET_SIZE			4096
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1060) #define OCFS2_XATTR_MAX_BLOCKS_PER_BUCKET 	(OCFS2_XATTR_BUCKET_SIZE \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1061) 						 / OCFS2_MIN_BLOCKSIZE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1062) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1063) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1064)  * On disk structure for xattr block.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1065)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1066) struct ocfs2_xattr_block {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1067) /*00*/	__u8	xb_signature[8];     /* Signature for verification */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1068) 	__le16	xb_suballoc_slot;    /* Slot suballocator this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1069) 					block belongs to. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1070) 	__le16	xb_suballoc_bit;     /* Bit offset in suballocator
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1071) 					block group */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1072) 	__le32	xb_fs_generation;    /* Must match super block */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1073) /*10*/	__le64	xb_blkno;            /* Offset on disk, in blocks */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1074) 	struct ocfs2_block_check xb_check;	/* Error checking */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1075) /*20*/	__le16	xb_flags;            /* Indicates whether this block contains
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1076) 					real xattr or a xattr tree. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1077) 	__le16	xb_reserved0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1078) 	__le32  xb_reserved1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1079) 	__le64	xb_suballoc_loc;	/* Suballocator block group this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1080) 					   xattr block belongs to. Only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1081) 					   valid if allocated from a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1082) 					   discontiguous block group */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1083) /*30*/	union {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1084) 		struct ocfs2_xattr_header xb_header; /* xattr header if this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1085) 							block contains xattr */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1086) 		struct ocfs2_xattr_tree_root xb_root;/* xattr tree root if this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1087) 							block cotains xattr
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1088) 							tree. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1089) 	} xb_attrs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1090) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1091) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1092) #define OCFS2_XATTR_ENTRY_LOCAL		0x80
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1093) #define OCFS2_XATTR_TYPE_MASK		0x7F
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1094) static inline void ocfs2_xattr_set_local(struct ocfs2_xattr_entry *xe,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1095) 					 int local)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1096) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1097) 	if (local)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1098) 		xe->xe_type |= OCFS2_XATTR_ENTRY_LOCAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1099) 	else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1100) 		xe->xe_type &= ~OCFS2_XATTR_ENTRY_LOCAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1101) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1102) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1103) static inline int ocfs2_xattr_is_local(struct ocfs2_xattr_entry *xe)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1104) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1105) 	return xe->xe_type & OCFS2_XATTR_ENTRY_LOCAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1106) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1107) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1108) static inline void ocfs2_xattr_set_type(struct ocfs2_xattr_entry *xe, int type)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1109) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1110) 	xe->xe_type |= type & OCFS2_XATTR_TYPE_MASK;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1111) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1112) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1113) static inline int ocfs2_xattr_get_type(struct ocfs2_xattr_entry *xe)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1114) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1115) 	return xe->xe_type & OCFS2_XATTR_TYPE_MASK;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1116) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1117) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1118) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1119)  *  On disk structures for global quota file
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1120)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1121) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1122) /* Magic numbers and known versions for global quota files */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1123) #define OCFS2_GLOBAL_QMAGICS {\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1124) 	0x0cf52470, /* USRQUOTA */ \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1125) 	0x0cf52471  /* GRPQUOTA */ \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1126) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1127) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1128) #define OCFS2_GLOBAL_QVERSIONS {\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1129) 	0, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1130) 	0, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1131) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1132) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1133) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1134) /* Each block of each quota file has a certain fixed number of bytes reserved
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1135)  * for OCFS2 internal use at its end. OCFS2 can use it for things like
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1136)  * checksums, etc. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1137) #define OCFS2_QBLK_RESERVED_SPACE 8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1138) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1139) /* Generic header of all quota files */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1140) struct ocfs2_disk_dqheader {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1141) 	__le32 dqh_magic;	/* Magic number identifying file */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1142) 	__le32 dqh_version;	/* Quota format version */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1143) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1144) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1145) #define OCFS2_GLOBAL_INFO_OFF (sizeof(struct ocfs2_disk_dqheader))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1146) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1147) /* Information header of global quota file (immediately follows the generic
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1148)  * header) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1149) struct ocfs2_global_disk_dqinfo {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1150) /*00*/	__le32 dqi_bgrace;	/* Grace time for space softlimit excess */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1151) 	__le32 dqi_igrace;	/* Grace time for inode softlimit excess */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1152) 	__le32 dqi_syncms;	/* Time after which we sync local changes to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1153) 				 * global quota file */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1154) 	__le32 dqi_blocks;	/* Number of blocks in quota file */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1155) /*10*/	__le32 dqi_free_blk;	/* First free block in quota file */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1156) 	__le32 dqi_free_entry;	/* First block with free dquot entry in quota
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1157) 				 * file */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1158) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1159) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1160) /* Structure with global user / group information. We reserve some space
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1161)  * for future use. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1162) struct ocfs2_global_disk_dqblk {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1163) /*00*/	__le32 dqb_id;          /* ID the structure belongs to */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1164) 	__le32 dqb_use_count;   /* Number of nodes having reference to this structure */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1165) 	__le64 dqb_ihardlimit;  /* absolute limit on allocated inodes */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1166) /*10*/	__le64 dqb_isoftlimit;  /* preferred inode limit */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1167) 	__le64 dqb_curinodes;   /* current # allocated inodes */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1168) /*20*/	__le64 dqb_bhardlimit;  /* absolute limit on disk space */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1169) 	__le64 dqb_bsoftlimit;  /* preferred limit on disk space */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1170) /*30*/	__le64 dqb_curspace;    /* current space occupied */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1171) 	__le64 dqb_btime;       /* time limit for excessive disk use */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1172) /*40*/	__le64 dqb_itime;       /* time limit for excessive inode use */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1173) 	__le64 dqb_pad1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1174) /*50*/	__le64 dqb_pad2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1175) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1176) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1177) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1178)  *  On-disk structures for local quota file
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1179)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1180) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1181) /* Magic numbers and known versions for local quota files */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1182) #define OCFS2_LOCAL_QMAGICS {\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1183) 	0x0cf524c0, /* USRQUOTA */ \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1184) 	0x0cf524c1  /* GRPQUOTA */ \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1185) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1186) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1187) #define OCFS2_LOCAL_QVERSIONS {\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1188) 	0, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1189) 	0, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1190) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1191) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1192) /* Quota flags in dqinfo header */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1193) #define OLQF_CLEAN	0x0001	/* Quota file is empty (this should be after\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1194) 				 * quota has been cleanly turned off) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1195) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1196) #define OCFS2_LOCAL_INFO_OFF (sizeof(struct ocfs2_disk_dqheader))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1197) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1198) /* Information header of local quota file (immediately follows the generic
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1199)  * header) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1200) struct ocfs2_local_disk_dqinfo {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1201) 	__le32 dqi_flags;	/* Flags for quota file */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1202) 	__le32 dqi_chunks;	/* Number of chunks of quota structures
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1203) 				 * with a bitmap */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1204) 	__le32 dqi_blocks;	/* Number of blocks allocated for quota file */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1205) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1206) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1207) /* Header of one chunk of a quota file */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1208) struct ocfs2_local_disk_chunk {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1209) 	__le32 dqc_free;	/* Number of free entries in the bitmap */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1210) 	__u8 dqc_bitmap[];	/* Bitmap of entries in the corresponding
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1211) 				 * chunk of quota file */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1212) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1213) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1214) /* One entry in local quota file */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1215) struct ocfs2_local_disk_dqblk {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1216) /*00*/	__le64 dqb_id;		/* id this quota applies to */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1217) 	__le64 dqb_spacemod;	/* Change in the amount of used space */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1218) /*10*/	__le64 dqb_inodemod;	/* Change in the amount of used inodes */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1219) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1220) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1221) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1222) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1223)  * The quota trailer lives at the end of each quota block.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1224)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1225) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1226) struct ocfs2_disk_dqtrailer {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1227) /*00*/	struct ocfs2_block_check dq_check;	/* Error checking */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1228) /*08*/	/* Cannot be larger than OCFS2_QBLK_RESERVED_SPACE */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1229) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1230) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1231) static inline struct ocfs2_disk_dqtrailer *ocfs2_block_dqtrailer(int blocksize,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1232) 								 void *buf)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1233) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1234) 	char *ptr = buf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1235) 	ptr += blocksize - OCFS2_QBLK_RESERVED_SPACE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1236) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1237) 	return (struct ocfs2_disk_dqtrailer *)ptr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1238) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1239) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1240) #ifdef __KERNEL__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1241) static inline int ocfs2_fast_symlink_chars(struct super_block *sb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1242) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1243) 	return  sb->s_blocksize -
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1244) 		 offsetof(struct ocfs2_dinode, id2.i_symlink);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1245) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1246) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1247) static inline int ocfs2_max_inline_data_with_xattr(struct super_block *sb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1248) 						   struct ocfs2_dinode *di)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1249) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1250) 	unsigned int xattrsize = le16_to_cpu(di->i_xattr_inline_size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1251) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1252) 	if (le16_to_cpu(di->i_dyn_features) & OCFS2_INLINE_XATTR_FL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1253) 		return sb->s_blocksize -
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1254) 			offsetof(struct ocfs2_dinode, id2.i_data.id_data) -
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1255) 			xattrsize;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1256) 	else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1257) 		return sb->s_blocksize -
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1258) 			offsetof(struct ocfs2_dinode, id2.i_data.id_data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1259) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1260) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1261) static inline int ocfs2_extent_recs_per_inode(struct super_block *sb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1262) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1263) 	int size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1264) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1265) 	size = sb->s_blocksize -
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1266) 		offsetof(struct ocfs2_dinode, id2.i_list.l_recs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1267) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1268) 	return size / sizeof(struct ocfs2_extent_rec);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1269) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1270) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1271) static inline int ocfs2_extent_recs_per_inode_with_xattr(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1272) 						struct super_block *sb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1273) 						struct ocfs2_dinode *di)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1274) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1275) 	int size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1276) 	unsigned int xattrsize = le16_to_cpu(di->i_xattr_inline_size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1277) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1278) 	if (le16_to_cpu(di->i_dyn_features) & OCFS2_INLINE_XATTR_FL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1279) 		size = sb->s_blocksize -
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1280) 			offsetof(struct ocfs2_dinode, id2.i_list.l_recs) -
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1281) 			xattrsize;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1282) 	else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1283) 		size = sb->s_blocksize -
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1284) 			offsetof(struct ocfs2_dinode, id2.i_list.l_recs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1285) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1286) 	return size / sizeof(struct ocfs2_extent_rec);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1287) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1288) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1289) static inline int ocfs2_extent_recs_per_dx_root(struct super_block *sb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1290) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1291) 	int size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1292) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1293) 	size = sb->s_blocksize -
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1294) 		offsetof(struct ocfs2_dx_root_block, dr_list.l_recs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1295) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1296) 	return size / sizeof(struct ocfs2_extent_rec);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1297) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1298) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1299) static inline int ocfs2_chain_recs_per_inode(struct super_block *sb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1300) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1301) 	int size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1302) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1303) 	size = sb->s_blocksize -
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1304) 		offsetof(struct ocfs2_dinode, id2.i_chain.cl_recs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1305) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1306) 	return size / sizeof(struct ocfs2_chain_rec);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1307) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1308) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1309) static inline u16 ocfs2_extent_recs_per_eb(struct super_block *sb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1310) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1311) 	int size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1312) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1313) 	size = sb->s_blocksize -
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1314) 		offsetof(struct ocfs2_extent_block, h_list.l_recs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1315) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1316) 	return size / sizeof(struct ocfs2_extent_rec);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1317) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1318) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1319) static inline u16 ocfs2_extent_recs_per_gd(struct super_block *sb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1320) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1321) 	int size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1322) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1323) 	size = sb->s_blocksize -
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1324) 		offsetof(struct ocfs2_group_desc, bg_list.l_recs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1325) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1326) 	return size / sizeof(struct ocfs2_extent_rec);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1327) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1328) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1329) static inline int ocfs2_dx_entries_per_leaf(struct super_block *sb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1330) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1331) 	int size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1332) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1333) 	size = sb->s_blocksize -
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1334) 		offsetof(struct ocfs2_dx_leaf, dl_list.de_entries);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1335) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1336) 	return size / sizeof(struct ocfs2_dx_entry);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1337) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1338) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1339) static inline int ocfs2_dx_entries_per_root(struct super_block *sb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1340) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1341) 	int size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1342) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1343) 	size = sb->s_blocksize -
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1344) 		offsetof(struct ocfs2_dx_root_block, dr_entries.de_entries);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1345) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1346) 	return size / sizeof(struct ocfs2_dx_entry);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1347) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1348) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1349) static inline u16 ocfs2_local_alloc_size(struct super_block *sb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1350) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1351) 	u16 size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1352) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1353) 	size = sb->s_blocksize -
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1354) 		offsetof(struct ocfs2_dinode, id2.i_lab.la_bitmap);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1355) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1356) 	return size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1357) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1358) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1359) static inline int ocfs2_group_bitmap_size(struct super_block *sb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1360) 					  int suballocator,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1361) 					  u32 feature_incompat)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1362) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1363) 	int size = sb->s_blocksize -
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1364) 		offsetof(struct ocfs2_group_desc, bg_bitmap);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1365) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1366) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1367) 	 * The cluster allocator uses the entire block.  Suballocators have
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1368) 	 * never used more than OCFS2_MAX_BG_BITMAP_SIZE.  Unfortunately, older
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1369) 	 * code expects bg_size set to the maximum.  Thus we must keep
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1370) 	 * bg_size as-is unless discontig_bg is enabled.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1371) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1372) 	if (suballocator &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1373) 	    (feature_incompat & OCFS2_FEATURE_INCOMPAT_DISCONTIG_BG))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1374) 		size = OCFS2_MAX_BG_BITMAP_SIZE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1375) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1376) 	return size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1377) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1378) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1379) static inline int ocfs2_truncate_recs_per_inode(struct super_block *sb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1380) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1381) 	int size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1382) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1383) 	size = sb->s_blocksize -
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1384) 		offsetof(struct ocfs2_dinode, id2.i_dealloc.tl_recs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1385) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1386) 	return size / sizeof(struct ocfs2_truncate_rec);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1387) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1388) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1389) static inline u64 ocfs2_backup_super_blkno(struct super_block *sb, int index)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1390) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1391) 	u64 offset = OCFS2_BACKUP_SB_START;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1392) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1393) 	if (index >= 0 && index < OCFS2_MAX_BACKUP_SUPERBLOCKS) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1394) 		offset <<= (2 * index);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1395) 		offset >>= sb->s_blocksize_bits;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1396) 		return offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1397) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1398) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1399) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1400) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1401) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1402) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1403) static inline u16 ocfs2_xattr_recs_per_xb(struct super_block *sb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1404) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1405) 	int size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1406) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1407) 	size = sb->s_blocksize -
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1408) 		offsetof(struct ocfs2_xattr_block,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1409) 			 xb_attrs.xb_root.xt_list.l_recs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1410) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1411) 	return size / sizeof(struct ocfs2_extent_rec);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1412) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1413) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1414) static inline u16 ocfs2_extent_recs_per_rb(struct super_block *sb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1415) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1416) 	int size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1417) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1418) 	size = sb->s_blocksize -
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1419) 		offsetof(struct ocfs2_refcount_block, rf_list.l_recs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1420) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1421) 	return size / sizeof(struct ocfs2_extent_rec);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1422) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1423) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1424) static inline u16 ocfs2_refcount_recs_per_rb(struct super_block *sb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1425) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1426) 	int size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1427) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1428) 	size = sb->s_blocksize -
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1429) 		offsetof(struct ocfs2_refcount_block, rf_records.rl_recs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1430) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1431) 	return size / sizeof(struct ocfs2_refcount_rec);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1432) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1433) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1434) static inline u32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1435) ocfs2_get_ref_rec_low_cpos(const struct ocfs2_refcount_rec *rec)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1436) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1437) 	return le64_to_cpu(rec->r_cpos) & OCFS2_32BIT_POS_MASK;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1438) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1439) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1440) static inline int ocfs2_fast_symlink_chars(int blocksize)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1441) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1442) 	return blocksize - offsetof(struct ocfs2_dinode, id2.i_symlink);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1443) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1444) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1445) static inline int ocfs2_max_inline_data_with_xattr(int blocksize,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1446) 						   struct ocfs2_dinode *di)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1447) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1448) 	if (di && (di->i_dyn_features & OCFS2_INLINE_XATTR_FL))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1449) 		return blocksize -
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1450) 			offsetof(struct ocfs2_dinode, id2.i_data.id_data) -
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1451) 			di->i_xattr_inline_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1452) 	else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1453) 		return blocksize -
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1454) 			offsetof(struct ocfs2_dinode, id2.i_data.id_data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1455) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1456) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1457) static inline int ocfs2_extent_recs_per_inode(int blocksize)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1458) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1459) 	int size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1460) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1461) 	size = blocksize -
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1462) 		offsetof(struct ocfs2_dinode, id2.i_list.l_recs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1463) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1464) 	return size / sizeof(struct ocfs2_extent_rec);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1465) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1466) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1467) static inline int ocfs2_chain_recs_per_inode(int blocksize)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1468) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1469) 	int size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1470) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1471) 	size = blocksize -
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1472) 		offsetof(struct ocfs2_dinode, id2.i_chain.cl_recs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1473) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1474) 	return size / sizeof(struct ocfs2_chain_rec);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1475) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1476) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1477) static inline int ocfs2_extent_recs_per_eb(int blocksize)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1478) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1479) 	int size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1480) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1481) 	size = blocksize -
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1482) 		offsetof(struct ocfs2_extent_block, h_list.l_recs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1483) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1484) 	return size / sizeof(struct ocfs2_extent_rec);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1485) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1486) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1487) static inline int ocfs2_extent_recs_per_gd(int blocksize)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1488) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1489) 	int size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1490) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1491) 	size = blocksize -
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1492) 		offsetof(struct ocfs2_group_desc, bg_list.l_recs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1493) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1494) 	return size / sizeof(struct ocfs2_extent_rec);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1495) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1496) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1497) static inline int ocfs2_local_alloc_size(int blocksize)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1498) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1499) 	int size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1500) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1501) 	size = blocksize -
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1502) 		offsetof(struct ocfs2_dinode, id2.i_lab.la_bitmap);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1503) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1504) 	return size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1505) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1506) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1507) static inline int ocfs2_group_bitmap_size(int blocksize,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1508) 					  int suballocator,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1509) 					  uint32_t feature_incompat)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1510) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1511) 	int size = sb->s_blocksize -
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1512) 		offsetof(struct ocfs2_group_desc, bg_bitmap);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1513) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1514) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1515) 	 * The cluster allocator uses the entire block.  Suballocators have
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1516) 	 * never used more than OCFS2_MAX_BG_BITMAP_SIZE.  Unfortunately, older
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1517) 	 * code expects bg_size set to the maximum.  Thus we must keep
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1518) 	 * bg_size as-is unless discontig_bg is enabled.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1519) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1520) 	if (suballocator &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1521) 	    (feature_incompat & OCFS2_FEATURE_INCOMPAT_DISCONTIG_BG))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1522) 		size = OCFS2_MAX_BG_BITMAP_SIZE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1523) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1524) 	return size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1525) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1526) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1527) static inline int ocfs2_truncate_recs_per_inode(int blocksize)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1528) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1529) 	int size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1530) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1531) 	size = blocksize -
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1532) 		offsetof(struct ocfs2_dinode, id2.i_dealloc.tl_recs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1533) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1534) 	return size / sizeof(struct ocfs2_truncate_rec);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1535) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1536) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1537) static inline uint64_t ocfs2_backup_super_blkno(int blocksize, int index)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1538) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1539) 	uint64_t offset = OCFS2_BACKUP_SB_START;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1540) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1541) 	if (index >= 0 && index < OCFS2_MAX_BACKUP_SUPERBLOCKS) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1542) 		offset <<= (2 * index);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1543) 		offset /= blocksize;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1544) 		return offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1545) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1546) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1547) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1548) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1549) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1550) static inline int ocfs2_xattr_recs_per_xb(int blocksize)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1551) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1552) 	int size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1553) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1554) 	size = blocksize -
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1555) 		offsetof(struct ocfs2_xattr_block,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1556) 			 xb_attrs.xb_root.xt_list.l_recs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1557) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1558) 	return size / sizeof(struct ocfs2_extent_rec);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1559) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1560) #endif  /* __KERNEL__ */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1561) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1562) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1563) static inline int ocfs2_system_inode_is_global(int type)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1564) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1565) 	return ((type >= 0) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1566) 		(type <= OCFS2_LAST_GLOBAL_SYSTEM_INODE));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1567) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1568) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1569) static inline int ocfs2_sprintf_system_inode_name(char *buf, int len,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1570) 						  int type, int slot)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1571) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1572) 	int chars;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1573) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1574)         /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1575)          * Global system inodes can only have one copy.  Everything
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1576)          * after OCFS2_LAST_GLOBAL_SYSTEM_INODE in the system inode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1577)          * list has a copy per slot.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1578)          */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1579) 	if (type <= OCFS2_LAST_GLOBAL_SYSTEM_INODE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1580) 		chars = snprintf(buf, len, "%s",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1581) 				 ocfs2_system_inodes[type].si_name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1582) 	else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1583) 		chars = snprintf(buf, len,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1584) 				 ocfs2_system_inodes[type].si_name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1585) 				 slot);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1586) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1587) 	return chars;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1588) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1589) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1590) static inline void ocfs2_set_de_type(struct ocfs2_dir_entry *de,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1591) 				    umode_t mode)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1592) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1593) 	de->file_type = fs_umode_to_ftype(mode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1594) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1595) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1596) static inline int ocfs2_gd_is_discontig(struct ocfs2_group_desc *gd)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1597) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1598) 	if ((offsetof(struct ocfs2_group_desc, bg_bitmap) +
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1599) 	     le16_to_cpu(gd->bg_size)) !=
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1600) 	    offsetof(struct ocfs2_group_desc, bg_list))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1601) 		return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1602) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1603) 	 * Only valid to check l_next_free_rec if
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1604) 	 * bg_bitmap + bg_size == bg_list.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1605) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1606) 	if (!gd->bg_list.l_next_free_rec)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1607) 		return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1608) 	return 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1609) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1610) #endif  /* _OCFS2_FS_H */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1611)