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

📄 xfs_trans.h

📁 linux 内核源代码
💻 H
📖 第 1 页 / 共 3 页
字号:
	unsigned int		t_log_res;	/* amt of log space resvd */	unsigned int		t_log_count;	/* count for perm log res */	unsigned int		t_blk_res;	/* # of blocks resvd */	unsigned int		t_blk_res_used;	/* # of resvd blocks used */	unsigned int		t_rtx_res;	/* # of rt extents resvd */	unsigned int		t_rtx_res_used;	/* # of resvd rt extents used */	xfs_log_ticket_t	t_ticket;	/* log mgr ticket */	sema_t			t_sema;		/* sema for commit completion */	xfs_lsn_t		t_lsn;		/* log seq num of start of						 * transaction. */	xfs_lsn_t		t_commit_lsn;	/* log seq num of end of						 * transaction. */	struct xfs_mount	*t_mountp;	/* ptr to fs mount struct */	struct xfs_dquot_acct   *t_dqinfo;	/* acctg info for dquots */	xfs_trans_callback_t	t_callback;	/* transaction callback */	void			*t_callarg;	/* callback arg */	unsigned int		t_flags;	/* misc flags */	int64_t			t_icount_delta;	/* superblock icount change */	int64_t			t_ifree_delta;	/* superblock ifree change */	int64_t			t_fdblocks_delta; /* superblock fdblocks chg */	int64_t			t_res_fdblocks_delta; /* on-disk only chg */	int64_t			t_frextents_delta;/* superblock freextents chg*/	int64_t			t_res_frextents_delta; /* on-disk only chg */#ifdef DEBUG	int64_t			t_ag_freeblks_delta; /* debugging counter */	int64_t			t_ag_flist_delta; /* debugging counter */	int64_t			t_ag_btree_delta; /* debugging counter */#endif	int64_t			t_dblocks_delta;/* superblock dblocks change */	int64_t			t_agcount_delta;/* superblock agcount change */	int64_t			t_imaxpct_delta;/* superblock imaxpct change */	int64_t			t_rextsize_delta;/* superblock rextsize chg */	int64_t			t_rbmblocks_delta;/* superblock rbmblocks chg */	int64_t			t_rblocks_delta;/* superblock rblocks change */	int64_t			t_rextents_delta;/* superblocks rextents chg */	int64_t			t_rextslog_delta;/* superblocks rextslog chg */	unsigned int		t_items_free;	/* log item descs free */	xfs_log_item_chunk_t	t_items;	/* first log item desc chunk */	xfs_trans_header_t	t_header;	/* header for in-log trans */	unsigned int		t_busy_free;	/* busy descs free */	xfs_log_busy_chunk_t	t_busy;		/* busy/async free blocks */	unsigned long		t_pflags;	/* saved process flags state */} xfs_trans_t;#endif	/* __KERNEL__ */#define	XFS_TRANS_MAGIC		0x5452414E	/* 'TRAN' *//* * Values for t_flags. */#define	XFS_TRANS_DIRTY		0x01	/* something needs to be logged */#define	XFS_TRANS_SB_DIRTY	0x02	/* superblock is modified */#define	XFS_TRANS_PERM_LOG_RES	0x04	/* xact took a permanent log res */#define	XFS_TRANS_SYNC		0x08	/* make commit synchronous */#define XFS_TRANS_DQ_DIRTY	0x10	/* at least one dquot in trx dirty */#define XFS_TRANS_RESERVE	0x20    /* OK to use reserved data blocks *//* * Values for call flags parameter. */#define	XFS_TRANS_NOSLEEP		0x1#define	XFS_TRANS_WAIT			0x2#define	XFS_TRANS_RELEASE_LOG_RES	0x4#define	XFS_TRANS_ABORT			0x8/* * Field values for xfs_trans_mod_sb. */#define	XFS_TRANS_SB_ICOUNT		0x00000001#define	XFS_TRANS_SB_IFREE		0x00000002#define	XFS_TRANS_SB_FDBLOCKS		0x00000004#define	XFS_TRANS_SB_RES_FDBLOCKS	0x00000008#define	XFS_TRANS_SB_FREXTENTS		0x00000010#define	XFS_TRANS_SB_RES_FREXTENTS	0x00000020#define	XFS_TRANS_SB_DBLOCKS		0x00000040#define	XFS_TRANS_SB_AGCOUNT		0x00000080#define	XFS_TRANS_SB_IMAXPCT		0x00000100#define	XFS_TRANS_SB_REXTSIZE		0x00000200#define	XFS_TRANS_SB_RBMBLOCKS		0x00000400#define	XFS_TRANS_SB_RBLOCKS		0x00000800#define	XFS_TRANS_SB_REXTENTS		0x00001000#define	XFS_TRANS_SB_REXTSLOG		0x00002000/* * Various log reservation values. * These are based on the size of the file system block * because that is what most transactions manipulate. * Each adds in an additional 128 bytes per item logged to * try to account for the overhead of the transaction mechanism. * * Note: * Most of the reservations underestimate the number of allocation * groups into which they could free extents in the xfs_bmap_finish() * call.  This is because the number in the worst case is quite high * and quite unusual.  In order to fix this we need to change * xfs_bmap_finish() to free extents in only a single AG at a time. * This will require changes to the EFI code as well, however, so that * the EFI for the extents not freed is logged again in each transaction. * See bug 261917. *//* * Per-extent log reservation for the allocation btree changes * involved in freeing or allocating an extent. * 2 trees * (2 blocks/level * max depth - 1) * block size */#define	XFS_ALLOCFREE_LOG_RES(mp,nx) \	((nx) * (2 * XFS_FSB_TO_B((mp), 2 * XFS_AG_MAXLEVELS(mp) - 1)))#define	XFS_ALLOCFREE_LOG_COUNT(mp,nx) \	((nx) * (2 * (2 * XFS_AG_MAXLEVELS(mp) - 1)))/* * Per-directory log reservation for any directory change. * dir blocks: (1 btree block per level + data block + free block) * dblock size * bmap btree: (levels + 2) * max depth * block size * v2 directory blocks can be fragmented below the dirblksize down to the fsb * size, so account for that in the DAENTER macros. */#define	XFS_DIROP_LOG_RES(mp)	\	(XFS_FSB_TO_B(mp, XFS_DAENTER_BLOCKS(mp, XFS_DATA_FORK)) + \	 (XFS_FSB_TO_B(mp, XFS_DAENTER_BMAPS(mp, XFS_DATA_FORK) + 1)))#define	XFS_DIROP_LOG_COUNT(mp)	\	(XFS_DAENTER_BLOCKS(mp, XFS_DATA_FORK) + \	 XFS_DAENTER_BMAPS(mp, XFS_DATA_FORK) + 1)/* * In a write transaction we can allocate a maximum of 2 * extents.  This gives: *    the inode getting the new extents: inode size *    the inode\'s bmap btree: max depth * block size *    the agfs of the ags from which the extents are allocated: 2 * sector *    the superblock free block counter: sector size *    the allocation btrees: 2 exts * 2 trees * (2 * max depth - 1) * block size * And the bmap_finish transaction can free bmap blocks in a join: *    the agfs of the ags containing the blocks: 2 * sector size *    the agfls of the ags containing the blocks: 2 * sector size *    the super block free block counter: sector size *    the allocation btrees: 2 exts * 2 trees * (2 * max depth - 1) * block size */#define XFS_CALC_WRITE_LOG_RES(mp) \	(MAX( \	 ((mp)->m_sb.sb_inodesize + \	  XFS_FSB_TO_B((mp), XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK)) + \	  (2 * (mp)->m_sb.sb_sectsize) + \	  (mp)->m_sb.sb_sectsize + \	  XFS_ALLOCFREE_LOG_RES(mp, 2) + \	  (128 * (4 + XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK) + XFS_ALLOCFREE_LOG_COUNT(mp, 2)))),\	 ((2 * (mp)->m_sb.sb_sectsize) + \	  (2 * (mp)->m_sb.sb_sectsize) + \	  (mp)->m_sb.sb_sectsize + \	  XFS_ALLOCFREE_LOG_RES(mp, 2) + \	  (128 * (5 + XFS_ALLOCFREE_LOG_COUNT(mp, 2))))))#define	XFS_WRITE_LOG_RES(mp)	((mp)->m_reservations.tr_write)/* * In truncating a file we free up to two extents at once.  We can modify: *    the inode being truncated: inode size *    the inode\'s bmap btree: (max depth + 1) * block size * And the bmap_finish transaction can free the blocks and bmap blocks: *    the agf for each of the ags: 4 * sector size *    the agfl for each of the ags: 4 * sector size *    the super block to reflect the freed blocks: sector size *    worst case split in allocation btrees per extent assuming 4 extents: *		4 exts * 2 trees * (2 * max depth - 1) * block size *    the inode btree: max depth * blocksize *    the allocation btrees: 2 trees * (max depth - 1) * block size */#define	XFS_CALC_ITRUNCATE_LOG_RES(mp) \	(MAX( \	 ((mp)->m_sb.sb_inodesize + \	  XFS_FSB_TO_B((mp), XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK) + 1) + \	  (128 * (2 + XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK)))), \	 ((4 * (mp)->m_sb.sb_sectsize) + \	  (4 * (mp)->m_sb.sb_sectsize) + \	  (mp)->m_sb.sb_sectsize + \	  XFS_ALLOCFREE_LOG_RES(mp, 4) + \	  (128 * (9 + XFS_ALLOCFREE_LOG_COUNT(mp, 4))) + \	  (128 * 5) + \	  XFS_ALLOCFREE_LOG_RES(mp, 1) + \	   (128 * (2 + XFS_IALLOC_BLOCKS(mp) + XFS_IN_MAXLEVELS(mp) + \	    XFS_ALLOCFREE_LOG_COUNT(mp, 1))))))#define	XFS_ITRUNCATE_LOG_RES(mp)   ((mp)->m_reservations.tr_itruncate)/* * In renaming a files we can modify: *    the four inodes involved: 4 * inode size *    the two directory btrees: 2 * (max depth + v2) * dir block size *    the two directory bmap btrees: 2 * max depth * block size * And the bmap_finish transaction can free dir and bmap blocks (two sets *	of bmap blocks) giving: *    the agf for the ags in which the blocks live: 3 * sector size *    the agfl for the ags in which the blocks live: 3 * sector size *    the superblock for the free block count: sector size *    the allocation btrees: 3 exts * 2 trees * (2 * max depth - 1) * block size */#define	XFS_CALC_RENAME_LOG_RES(mp) \	(MAX( \	 ((4 * (mp)->m_sb.sb_inodesize) + \	  (2 * XFS_DIROP_LOG_RES(mp)) + \	  (128 * (4 + 2 * XFS_DIROP_LOG_COUNT(mp)))), \	 ((3 * (mp)->m_sb.sb_sectsize) + \	  (3 * (mp)->m_sb.sb_sectsize) + \	  (mp)->m_sb.sb_sectsize + \	  XFS_ALLOCFREE_LOG_RES(mp, 3) + \	  (128 * (7 + XFS_ALLOCFREE_LOG_COUNT(mp, 3))))))#define	XFS_RENAME_LOG_RES(mp)	((mp)->m_reservations.tr_rename)/* * For creating a link to an inode: *    the parent directory inode: inode size *    the linked inode: inode size *    the directory btree could split: (max depth + v2) * dir block size *    the directory bmap btree could join or split: (max depth + v2) * blocksize * And the bmap_finish transaction can free some bmap blocks giving: *    the agf for the ag in which the blocks live: sector size *    the agfl for the ag in which the blocks live: sector size *    the superblock for the free block count: sector size *    the allocation btrees: 2 trees * (2 * max depth - 1) * block size */#define	XFS_CALC_LINK_LOG_RES(mp) \	(MAX( \	 ((mp)->m_sb.sb_inodesize + \	  (mp)->m_sb.sb_inodesize + \	  XFS_DIROP_LOG_RES(mp) + \	  (128 * (2 + XFS_DIROP_LOG_COUNT(mp)))), \	 ((mp)->m_sb.sb_sectsize + \	  (mp)->m_sb.sb_sectsize + \	  (mp)->m_sb.sb_sectsize + \	  XFS_ALLOCFREE_LOG_RES(mp, 1) + \	  (128 * (3 + XFS_ALLOCFREE_LOG_COUNT(mp, 1))))))#define	XFS_LINK_LOG_RES(mp)	((mp)->m_reservations.tr_link)/* * For removing a directory entry we can modify: *    the parent directory inode: inode size *    the removed inode: inode size *    the directory btree could join: (max depth + v2) * dir block size *    the directory bmap btree could join or split: (max depth + v2) * blocksize * And the bmap_finish transaction can free the dir and bmap blocks giving: *    the agf for the ag in which the blocks live: 2 * sector size *    the agfl for the ag in which the blocks live: 2 * sector size *    the superblock for the free block count: sector size *    the allocation btrees: 2 exts * 2 trees * (2 * max depth - 1) * block size */#define	XFS_CALC_REMOVE_LOG_RES(mp)	\	(MAX( \	 ((mp)->m_sb.sb_inodesize + \	  (mp)->m_sb.sb_inodesize + \	  XFS_DIROP_LOG_RES(mp) + \	  (128 * (2 + XFS_DIROP_LOG_COUNT(mp)))), \	 ((2 * (mp)->m_sb.sb_sectsize) + \	  (2 * (mp)->m_sb.sb_sectsize) + \	  (mp)->m_sb.sb_sectsize + \	  XFS_ALLOCFREE_LOG_RES(mp, 2) + \	  (128 * (5 + XFS_ALLOCFREE_LOG_COUNT(mp, 2))))))#define	XFS_REMOVE_LOG_RES(mp)	((mp)->m_reservations.tr_remove)/* * For symlink we can modify: *    the parent directory inode: inode size *    the new inode: inode size *    the inode btree entry: 1 block *    the directory btree: (max depth + v2) * dir block size *    the directory inode\'s bmap btree: (max depth + v2) * block size *    the blocks for the symlink: 1 KB * Or in the first xact we allocate some inodes giving: *    the agi and agf of the ag getting the new inodes: 2 * sectorsize *    the inode blocks allocated: XFS_IALLOC_BLOCKS * blocksize *    the inode btree: max depth * blocksize *    the allocation btrees: 2 trees * (2 * max depth - 1) * block size */#define	XFS_CALC_SYMLINK_LOG_RES(mp)		\	(MAX( \	 ((mp)->m_sb.sb_inodesize + \	  (mp)->m_sb.sb_inodesize + \	  XFS_FSB_TO_B(mp, 1) + \	  XFS_DIROP_LOG_RES(mp) + \	  1024 + \	  (128 * (4 + XFS_DIROP_LOG_COUNT(mp)))), \	 (2 * (mp)->m_sb.sb_sectsize + \	  XFS_FSB_TO_B((mp), XFS_IALLOC_BLOCKS((mp))) + \	  XFS_FSB_TO_B((mp), XFS_IN_MAXLEVELS(mp)) + \	  XFS_ALLOCFREE_LOG_RES(mp, 1) + \	  (128 * (2 + XFS_IALLOC_BLOCKS(mp) + XFS_IN_MAXLEVELS(mp) + \	   XFS_ALLOCFREE_LOG_COUNT(mp, 1))))))#define	XFS_SYMLINK_LOG_RES(mp)	((mp)->m_reservations.tr_symlink)/* * For create we can modify: *    the parent directory inode: inode size *    the new inode: inode size *    the inode btree entry: block size *    the superblock for the nlink flag: sector size *    the directory btree: (max depth + v2) * dir block size *    the directory inode\'s bmap btree: (max depth + v2) * block size * Or in the first xact we allocate some inodes giving: *    the agi and agf of the ag getting the new inodes: 2 * sectorsize *    the superblock for the nlink flag: sector size *    the inode blocks allocated: XFS_IALLOC_BLOCKS * blocksize *    the inode btree: max depth * blocksize *    the allocation btrees: 2 trees * (max depth - 1) * block size */#define	XFS_CALC_CREATE_LOG_RES(mp)		\	(MAX( \	 ((mp)->m_sb.sb_inodesize + \	  (mp)->m_sb.sb_inodesize + \	  (mp)->m_sb.sb_sectsize + \	  XFS_FSB_TO_B(mp, 1) + \	  XFS_DIROP_LOG_RES(mp) + \	  (128 * (3 + XFS_DIROP_LOG_COUNT(mp)))), \	 (3 * (mp)->m_sb.sb_sectsize + \	  XFS_FSB_TO_B((mp), XFS_IALLOC_BLOCKS((mp))) + \	  XFS_FSB_TO_B((mp), XFS_IN_MAXLEVELS(mp)) + \	  XFS_ALLOCFREE_LOG_RES(mp, 1) + \	  (128 * (2 + XFS_IALLOC_BLOCKS(mp) + XFS_IN_MAXLEVELS(mp) + \	   XFS_ALLOCFREE_LOG_COUNT(mp, 1))))))#define	XFS_CREATE_LOG_RES(mp)	((mp)->m_reservations.tr_create)/* * Making a new directory is the same as creating a new file. */#define	XFS_CALC_MKDIR_LOG_RES(mp)	XFS_CALC_CREATE_LOG_RES(mp)#define	XFS_MKDIR_LOG_RES(mp)	((mp)->m_reservations.tr_mkdir)/* * In freeing an inode we can modify:

⌨️ 快捷键说明

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