⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ocfs2_fs.h

📁 ocfs1.4.1 oracle分布式文件系统
💻 H
📖 第 1 页 / 共 2 页
字号:
/* -*- mode: c; c-basic-offset: 8; -*- * vim: noexpandtab sw=8 ts=8 sts=0: * * ocfs2_fs.h * * On-disk structures for OCFS2. * * Copyright (C) 2002, 2004 Oracle.  All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License, version 2,  as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public * License along with this program; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 021110-1307, USA. */#ifndef _OCFS2_FS_H#define _OCFS2_FS_H/* Version */#define OCFS2_MAJOR_REV_LEVEL		0#define OCFS2_MINOR_REV_LEVEL          	90/* * An OCFS2 volume starts this way: * Sector 0: Valid ocfs1_vol_disk_hdr that cleanly fails to mount OCFS. * Sector 1: Valid ocfs1_vol_label that cleanly fails to mount OCFS. * Block OCFS2_SUPER_BLOCK_BLKNO: OCFS2 superblock. * * All other structures are found from the superblock information. * * OCFS2_SUPER_BLOCK_BLKNO is in blocks, not sectors.  eg, for a * blocksize of 2K, it is 4096 bytes into disk. */#define OCFS2_SUPER_BLOCK_BLKNO		2/* * Cluster size limits. The maximum is kept arbitrarily at 1 MB, and could * grow if needed. */#define OCFS2_MIN_CLUSTERSIZE		4096#define OCFS2_MAX_CLUSTERSIZE		1048576/* * Blocks cannot be bigger than clusters, so the maximum blocksize is the * minimum cluster size. */#define OCFS2_MIN_BLOCKSIZE		512#define OCFS2_MAX_BLOCKSIZE		OCFS2_MIN_CLUSTERSIZE/* Filesystem magic number */#define OCFS2_SUPER_MAGIC		0x7461636f/* Object signatures */#define OCFS2_SUPER_BLOCK_SIGNATURE	"OCFSV2"#define OCFS2_INODE_SIGNATURE		"INODE01"#define OCFS2_EXTENT_BLOCK_SIGNATURE	"EXBLK01"#define OCFS2_GROUP_DESC_SIGNATURE      "GROUP01"/* Compatibility flags */#define OCFS2_HAS_COMPAT_FEATURE(sb,mask)			\	( OCFS2_SB(sb)->s_feature_compat & (mask) )#define OCFS2_HAS_RO_COMPAT_FEATURE(sb,mask)			\	( OCFS2_SB(sb)->s_feature_ro_compat & (mask) )#define OCFS2_HAS_INCOMPAT_FEATURE(sb,mask)			\	( OCFS2_SB(sb)->s_feature_incompat & (mask) )#define OCFS2_SET_COMPAT_FEATURE(sb,mask)			\	OCFS2_SB(sb)->s_feature_compat |= (mask)#define OCFS2_SET_RO_COMPAT_FEATURE(sb,mask)			\	OCFS2_SB(sb)->s_feature_ro_compat |= (mask)#define OCFS2_SET_INCOMPAT_FEATURE(sb,mask)			\	OCFS2_SB(sb)->s_feature_incompat |= (mask)#define OCFS2_CLEAR_COMPAT_FEATURE(sb,mask)			\	OCFS2_SB(sb)->s_feature_compat &= ~(mask)#define OCFS2_CLEAR_RO_COMPAT_FEATURE(sb,mask)			\	OCFS2_SB(sb)->s_feature_ro_compat &= ~(mask)#define OCFS2_CLEAR_INCOMPAT_FEATURE(sb,mask)			\	OCFS2_SB(sb)->s_feature_incompat &= ~(mask)#define OCFS2_FEATURE_COMPAT_SUPP	OCFS2_FEATURE_COMPAT_BACKUP_SB#define OCFS2_FEATURE_INCOMPAT_SUPP	(OCFS2_FEATURE_INCOMPAT_LOCAL_MOUNT \					 | OCFS2_FEATURE_INCOMPAT_SPARSE_ALLOC \					 | OCFS2_FEATURE_INCOMPAT_INLINE_DATA)#define OCFS2_FEATURE_RO_COMPAT_SUPP	OCFS2_FEATURE_RO_COMPAT_UNWRITTEN/* * Heartbeat-only devices are missing journals and other files.  The * filesystem driver can't load them, but the library can.  Never put * this in OCFS2_FEATURE_INCOMPAT_SUPP, *ever*. */#define OCFS2_FEATURE_INCOMPAT_HEARTBEAT_DEV	0x0002/* * tunefs sets this incompat flag before starting the resize and clears it * at the end. This flag protects users from inadvertently mounting the fs * after an aborted run without fsck-ing. */#define OCFS2_FEATURE_INCOMPAT_RESIZE_INPROG    0x0004/* Used to denote a non-clustered volume */#define OCFS2_FEATURE_INCOMPAT_LOCAL_MOUNT	0x0008/* Support for sparse allocation in b-trees */#define OCFS2_FEATURE_INCOMPAT_SPARSE_ALLOC	0x0010/* * Tunefs sets this incompat flag before starting an operation which * would require cleanup on abort. This is done to protect users from * inadvertently mounting the fs after an aborted run without * fsck-ing. * * s_tunefs_flags on the super block describes precisely which * operations were in progress. */#define OCFS2_FEATURE_INCOMPAT_TUNEFS_INPROG	0x0020/* Support for data packed into inode blocks */#define OCFS2_FEATURE_INCOMPAT_INLINE_DATA	0x0040/* * backup superblock flag is used to indicate that this volume * has backup superblocks. */#define OCFS2_FEATURE_COMPAT_BACKUP_SB		0x0001/* * Unwritten extents support. */#define OCFS2_FEATURE_RO_COMPAT_UNWRITTEN	0x0001/* The byte offset of the first backup block will be 1G. * The following will be 4G, 16G, 64G, 256G and 1T. */#define OCFS2_BACKUP_SB_START			1 << 30/* the max backup superblock nums */#define OCFS2_MAX_BACKUP_SUPERBLOCKS	6/* * Flags on ocfs2_super_block.s_tunefs_flags */#define OCFS2_TUNEFS_INPROG_REMOVE_SLOT		0x0001	/* Removing slots *//* * Flags on ocfs2_dinode.i_flags */#define OCFS2_VALID_FL		(0x00000001)	/* Inode is valid */#define OCFS2_UNUSED2_FL	(0x00000002)#define OCFS2_ORPHANED_FL	(0x00000004)	/* On the orphan list */#define OCFS2_UNUSED3_FL	(0x00000008)/* System inode flags */#define OCFS2_SYSTEM_FL		(0x00000010)	/* System inode */#define OCFS2_SUPER_BLOCK_FL	(0x00000020)	/* Super block */#define OCFS2_LOCAL_ALLOC_FL	(0x00000040)	/* Slot local alloc bitmap */#define OCFS2_BITMAP_FL		(0x00000080)	/* Allocation bitmap */#define OCFS2_JOURNAL_FL	(0x00000100)	/* Slot local journal */#define OCFS2_HEARTBEAT_FL	(0x00000200)	/* Heartbeat area */#define OCFS2_CHAIN_FL		(0x00000400)	/* Chain allocator */#define OCFS2_DEALLOC_FL	(0x00000800)	/* Truncate log *//* * Flags on ocfs2_dinode.i_dyn_features * * These can change much more often than i_flags. When adding flags, * keep in mind that i_dyn_features is only 16 bits wide. */#define OCFS2_INLINE_DATA_FL	(0x0001)	/* Data stored in inode block */#define OCFS2_HAS_XATTR_FL	(0x0002)#define OCFS2_INLINE_XATTR_FL	(0x0004)#define OCFS2_INDEXED_DIR_FL	(0x0008)/* Inode attributes, keep in sync with EXT2 */#define OCFS2_SECRM_FL		(0x00000001)	/* Secure deletion */#define OCFS2_UNRM_FL		(0x00000002)	/* Undelete */#define OCFS2_COMPR_FL		(0x00000004)	/* Compress file */#define OCFS2_SYNC_FL		(0x00000008)	/* Synchronous updates */#define OCFS2_IMMUTABLE_FL	(0x00000010)	/* Immutable file */#define OCFS2_APPEND_FL		(0x00000020)	/* writes to file may only append */#define OCFS2_NODUMP_FL		(0x00000040)	/* do not dump file */#define OCFS2_NOATIME_FL	(0x00000080)	/* do not update atime */#define OCFS2_DIRSYNC_FL	(0x00010000)	/* dirsync behaviour (directories only) */#define OCFS2_FL_VISIBLE	(0x000100FF)	/* User visible flags */#define OCFS2_FL_MODIFIABLE	(0x000100FF)	/* User modifiable flags *//* * Extent record flags (e_node.leaf.flags) */#define OCFS2_EXT_UNWRITTEN	(0x01)	/* Extent is allocated but					 * unwritten *//* * ioctl commands */#define OCFS2_IOC_GETFLAGS	_IOR('f', 1, long)#define OCFS2_IOC_SETFLAGS	_IOW('f', 2, long)#define OCFS2_IOC32_GETFLAGS	_IOR('f', 1, int)#define OCFS2_IOC32_SETFLAGS	_IOW('f', 2, int)/* * Space reservation / allocation / free ioctls and argument structure * are designed to be compatible with XFS. * * ALLOCSP* and FREESP* are not and will never be supported, but are * included here for completeness. */struct ocfs2_space_resv {	__s16		l_type;	__s16		l_whence;	__s64		l_start;	__s64		l_len;		/* len == 0 means until end of file */	__s32		l_sysid;	__u32		l_pid;	__s32		l_pad[4];	/* reserve area			    */};#define OCFS2_IOC_ALLOCSP		_IOW ('X', 10, struct ocfs2_space_resv)#define OCFS2_IOC_FREESP		_IOW ('X', 11, struct ocfs2_space_resv)#define OCFS2_IOC_RESVSP		_IOW ('X', 40, struct ocfs2_space_resv)#define OCFS2_IOC_UNRESVSP	_IOW ('X', 41, struct ocfs2_space_resv)#define OCFS2_IOC_ALLOCSP64	_IOW ('X', 36, struct ocfs2_space_resv)#define OCFS2_IOC_FREESP64	_IOW ('X', 37, struct ocfs2_space_resv)#define OCFS2_IOC_RESVSP64	_IOW ('X', 42, struct ocfs2_space_resv)#define OCFS2_IOC_UNRESVSP64	_IOW ('X', 43, struct ocfs2_space_resv)/* Used to pass group descriptor data when online resize is done */struct ocfs2_new_group_input {	__u64 group;		/* Group descriptor's blkno. */	__u32 clusters;		/* Total number of clusters in this group */	__u32 frees;		/* Total free clusters in this group */	__u16 chain;		/* Chain for this group */	__u16 reserved1;	__u32 reserved2;};#define OCFS2_IOC_GROUP_EXTEND	_IOW('o', 1, int)#define OCFS2_IOC_GROUP_ADD	_IOW('o', 2,struct ocfs2_new_group_input)#define OCFS2_IOC_GROUP_ADD64	_IOW('o', 3,struct ocfs2_new_group_input)/* * Journal Flags (ocfs2_dinode.id1.journal1.i_flags) */#define OCFS2_JOURNAL_DIRTY_FL	(0x00000001)	/* Journal needs recovery *//* * superblock s_state flags */#define OCFS2_ERROR_FS		(0x00000001)	/* FS saw errors *//* Limit of space in ocfs2_dir_entry */#define OCFS2_MAX_FILENAME_LEN		255/* Maximum slots on an ocfs2 file system */#define OCFS2_MAX_SLOTS			255/* Slot map indicator for an empty slot */#define OCFS2_INVALID_SLOT		-1#define OCFS2_VOL_UUID_LEN		16#define OCFS2_MAX_VOL_LABEL_LEN		64/* Journal limits (in bytes) */#define OCFS2_MIN_JOURNAL_SIZE		(4 * 1024 * 1024)/* * Default local alloc size (in megabytes) * * The value chosen should be such that most allocations, including new * block groups, use local alloc. */#define OCFS2_DEFAULT_LOCAL_ALLOC_SIZE	8struct ocfs2_system_inode_info {	char	*si_name;	int	si_iflags;	int	si_mode;};/* System file index */enum {	BAD_BLOCK_SYSTEM_INODE = 0,	GLOBAL_INODE_ALLOC_SYSTEM_INODE,	SLOT_MAP_SYSTEM_INODE,#define OCFS2_FIRST_ONLINE_SYSTEM_INODE SLOT_MAP_SYSTEM_INODE	HEARTBEAT_SYSTEM_INODE,	GLOBAL_BITMAP_SYSTEM_INODE,#define OCFS2_LAST_GLOBAL_SYSTEM_INODE GLOBAL_BITMAP_SYSTEM_INODE	ORPHAN_DIR_SYSTEM_INODE,	EXTENT_ALLOC_SYSTEM_INODE,	INODE_ALLOC_SYSTEM_INODE,	JOURNAL_SYSTEM_INODE,	LOCAL_ALLOC_SYSTEM_INODE,	TRUNCATE_LOG_SYSTEM_INODE,	NUM_SYSTEM_INODES};static struct ocfs2_system_inode_info ocfs2_system_inodes[NUM_SYSTEM_INODES] = {	/* Global system inodes (single copy) */	/* The first two are only used from userspace mfks/tunefs */	[BAD_BLOCK_SYSTEM_INODE]		= { "bad_blocks", 0, S_IFREG | 0644 },	[GLOBAL_INODE_ALLOC_SYSTEM_INODE] 	= { "global_inode_alloc", OCFS2_BITMAP_FL | OCFS2_CHAIN_FL, S_IFREG | 0644 },	/* These are used by the running filesystem */	[SLOT_MAP_SYSTEM_INODE]			= { "slot_map", 0, S_IFREG | 0644 },	[HEARTBEAT_SYSTEM_INODE]		= { "heartbeat", OCFS2_HEARTBEAT_FL, S_IFREG | 0644 },	[GLOBAL_BITMAP_SYSTEM_INODE]		= { "global_bitmap", 0, S_IFREG | 0644 },	/* Slot-specific system inodes (one copy per slot) */	[ORPHAN_DIR_SYSTEM_INODE]		= { "orphan_dir:%04d", 0, S_IFDIR | 0755 },	[EXTENT_ALLOC_SYSTEM_INODE]		= { "extent_alloc:%04d", OCFS2_BITMAP_FL | OCFS2_CHAIN_FL, S_IFREG | 0644 },	[INODE_ALLOC_SYSTEM_INODE]		= { "inode_alloc:%04d", OCFS2_BITMAP_FL | OCFS2_CHAIN_FL, S_IFREG | 0644 },	[JOURNAL_SYSTEM_INODE]			= { "journal:%04d", OCFS2_JOURNAL_FL, S_IFREG | 0644 },	[LOCAL_ALLOC_SYSTEM_INODE]		= { "local_alloc:%04d", OCFS2_BITMAP_FL | OCFS2_LOCAL_ALLOC_FL, S_IFREG | 0644 },	[TRUNCATE_LOG_SYSTEM_INODE]		= { "truncate_log:%04d", OCFS2_DEALLOC_FL, S_IFREG | 0644 }};/* Parameter passed from mount.ocfs2 to module */#define OCFS2_HB_NONE			"heartbeat=none"#define OCFS2_HB_LOCAL			"heartbeat=local"/* * OCFS2 directory file types.  Only the low 3 bits are used.  The * other bits are reserved for now. */#define OCFS2_FT_UNKNOWN	0#define OCFS2_FT_REG_FILE	1#define OCFS2_FT_DIR		2#define OCFS2_FT_CHRDEV		3#define OCFS2_FT_BLKDEV		4#define OCFS2_FT_FIFO		5#define OCFS2_FT_SOCK		6#define OCFS2_FT_SYMLINK	7#define OCFS2_FT_MAX		8/* * OCFS2_DIR_PAD defines the directory entries boundaries * * NOTE: It must be a multiple of 4 */#define OCFS2_DIR_PAD			4#define OCFS2_DIR_ROUND			(OCFS2_DIR_PAD - 1)#define OCFS2_DIR_MEMBER_LEN 		offsetof(struct ocfs2_dir_entry, name)#define OCFS2_DIR_REC_LEN(name_len)	(((name_len) + OCFS2_DIR_MEMBER_LEN + \                                          OCFS2_DIR_ROUND) & \					 ~OCFS2_DIR_ROUND)#define OCFS2_LINK_MAX		32000#define S_SHIFT			12static unsigned char ocfs2_type_by_mode[S_IFMT >> S_SHIFT] = {	[S_IFREG >> S_SHIFT]  = OCFS2_FT_REG_FILE,	[S_IFDIR >> S_SHIFT]  = OCFS2_FT_DIR,	[S_IFCHR >> S_SHIFT]  = OCFS2_FT_CHRDEV,	[S_IFBLK >> S_SHIFT]  = OCFS2_FT_BLKDEV,	[S_IFIFO >> S_SHIFT]  = OCFS2_FT_FIFO,	[S_IFSOCK >> S_SHIFT] = OCFS2_FT_SOCK,	[S_IFLNK >> S_SHIFT]  = OCFS2_FT_SYMLINK,};/* * Convenience casts */#define OCFS2_RAW_SB(dinode)		(&((dinode)->id2.i_super))/* * On disk extent record for OCFS2 * It describes a range of clusters on disk. * * Length fields are divided into interior and leaf node versions. * This leaves room for a flags field (OCFS2_EXT_*) in the leaf nodes. */struct ocfs2_extent_rec {/*00*/	__le32 e_cpos;		/* Offset into the file, in clusters */	union {		__le32 e_int_clusters; /* Clusters covered by all children */		struct {			__le16 e_leaf_clusters; /* Clusters covered by this						   extent */			__u8 e_reserved1;			__u8 e_flags; /* Extent flags */		};	};	__le64 e_blkno;		/* Physical disk offset, in blocks *//*10*/};struct ocfs2_chain_rec {	__le32 c_free;	/* Number of free bits in this chain. */	__le32 c_total;	/* Number of total bits in this chain */	__le64 c_blkno;	/* Physical disk offset (blocks) of 1st group */};struct ocfs2_truncate_rec {	__le32 t_start;		/* 1st cluster in this log */	__le32 t_clusters;	/* Number of total clusters covered */};/* * On disk extent list for OCFS2 (node in the tree).  Note that this * is contained inside ocfs2_dinode or ocfs2_extent_block, so the * offsets are relative to ocfs2_dinode.id2.i_list or * ocfs2_extent_block.h_list, respectively. */struct ocfs2_extent_list {/*00*/	__le16 l_tree_depth;		/* Extent tree depth from this					   point.  0 means data extents					   hang directly off this					   header (a leaf)					   NOTE: The high 8 bits cannot be					   used - tree_depth is never that big.					*/	__le16 l_count;			/* Number of extent records */	__le16 l_next_free_rec;		/* Next unused extent slot */	__le16 l_reserved1;	__le64 l_reserved2;		/* Pad to

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -