~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/fs/xfs/libxfs/xfs_trans_space.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 // SPDX-License-Identifier: GPL-2.0
  2 /*
  3  * Copyright (c) 2000,2005 Silicon Graphics, Inc.
  4  * All Rights Reserved.
  5  */
  6 #ifndef __XFS_TRANS_SPACE_H__
  7 #define __XFS_TRANS_SPACE_H__
  8 
  9 /*
 10  * Components of space reservations.
 11  */
 12 
 13 /* Worst case number of bmaps that can be held in a block. */
 14 #define XFS_MAX_CONTIG_BMAPS_PER_BLOCK(mp)    \
 15                 (((mp)->m_bmap_dmxr[0]) - ((mp)->m_bmap_dmnr[0]))
 16 
 17 /* Worst case number of rmaps that can be held in a block. */
 18 #define XFS_MAX_CONTIG_RMAPS_PER_BLOCK(mp)    \
 19                 (((mp)->m_rmap_mxr[0]) - ((mp)->m_rmap_mnr[0]))
 20 
 21 /* Adding one rmap could split every level up to the top of the tree. */
 22 #define XFS_RMAPADD_SPACE_RES(mp) ((mp)->m_rmap_maxlevels)
 23 
 24 /*
 25  * Note that we historically set m_rmap_maxlevels to 9 when reflink is enabled,
 26  * so we must preserve this behavior to avoid changing the transaction space
 27  * reservations and minimum log size calculations for existing filesystems.
 28  */
 29 #define XFS_OLD_REFLINK_RMAP_MAXLEVELS          9
 30 
 31 /* Blocks we might need to add "b" rmaps to a tree. */
 32 #define XFS_NRMAPADD_SPACE_RES(mp, b)\
 33         (((b + XFS_MAX_CONTIG_RMAPS_PER_BLOCK(mp) - 1) / \
 34           XFS_MAX_CONTIG_RMAPS_PER_BLOCK(mp)) * \
 35           XFS_RMAPADD_SPACE_RES(mp))
 36 
 37 #define XFS_MAX_CONTIG_EXTENTS_PER_BLOCK(mp)    \
 38                 (((mp)->m_alloc_mxr[0]) - ((mp)->m_alloc_mnr[0]))
 39 #define XFS_EXTENTADD_SPACE_RES(mp,w)   (XFS_BM_MAXLEVELS(mp,w) - 1)
 40 #define XFS_NEXTENTADD_SPACE_RES(mp,b,w)\
 41         (((b + XFS_MAX_CONTIG_EXTENTS_PER_BLOCK(mp) - 1) / \
 42           XFS_MAX_CONTIG_EXTENTS_PER_BLOCK(mp)) * \
 43           XFS_EXTENTADD_SPACE_RES(mp,w))
 44 
 45 /* Blocks we might need to add "b" mappings & rmappings to a file. */
 46 #define XFS_SWAP_RMAP_SPACE_RES(mp,b,w)\
 47         (XFS_NEXTENTADD_SPACE_RES((mp), (b), (w)) + \
 48          XFS_NRMAPADD_SPACE_RES((mp), (b)))
 49 
 50 #define XFS_DAENTER_1B(mp,w)    \
 51         ((w) == XFS_DATA_FORK ? (mp)->m_dir_geo->fsbcount : 1)
 52 #define XFS_DAENTER_DBS(mp,w)   \
 53         (XFS_DA_NODE_MAXDEPTH + (((w) == XFS_DATA_FORK) ? 2 : 0))
 54 #define XFS_DAENTER_BLOCKS(mp,w)        \
 55         (XFS_DAENTER_1B(mp,w) * XFS_DAENTER_DBS(mp,w))
 56 #define XFS_DAENTER_BMAP1B(mp,w)        \
 57         XFS_NEXTENTADD_SPACE_RES(mp, XFS_DAENTER_1B(mp, w), w)
 58 #define XFS_DAENTER_BMAPS(mp,w)         \
 59         (XFS_DAENTER_DBS(mp,w) * XFS_DAENTER_BMAP1B(mp,w))
 60 #define XFS_DAENTER_SPACE_RES(mp,w)     \
 61         (XFS_DAENTER_BLOCKS(mp,w) + XFS_DAENTER_BMAPS(mp,w))
 62 #define XFS_DAREMOVE_SPACE_RES(mp,w)    XFS_DAENTER_BMAPS(mp,w)
 63 #define XFS_DIRENTER_MAX_SPLIT(mp,nl)   1
 64 #define XFS_DIRENTER_SPACE_RES(mp,nl)   \
 65         (XFS_DAENTER_SPACE_RES(mp, XFS_DATA_FORK) * \
 66          XFS_DIRENTER_MAX_SPLIT(mp,nl))
 67 #define XFS_DIRREMOVE_SPACE_RES(mp)     \
 68         XFS_DAREMOVE_SPACE_RES(mp, XFS_DATA_FORK)
 69 #define XFS_IALLOC_SPACE_RES(mp)        \
 70         (M_IGEO(mp)->ialloc_blks + \
 71          ((xfs_has_finobt(mp) ? 2 : 1) * M_IGEO(mp)->inobt_maxlevels))
 72 
 73 /*
 74  * Space reservation values for various transactions.
 75  */
 76 #define XFS_ADDAFORK_SPACE_RES(mp)      \
 77         ((mp)->m_dir_geo->fsbcount + XFS_DAENTER_BMAP1B(mp, XFS_DATA_FORK))
 78 #define XFS_ATTRRM_SPACE_RES(mp)        \
 79         XFS_DAREMOVE_SPACE_RES(mp, XFS_ATTR_FORK)
 80 /* This macro is not used - see inline code in xfs_attr_set */
 81 #define XFS_ATTRSET_SPACE_RES(mp, v)    \
 82         (XFS_DAENTER_SPACE_RES(mp, XFS_ATTR_FORK) + XFS_B_TO_FSB(mp, v))
 83 #define XFS_DIOSTRAT_SPACE_RES(mp, v)   \
 84         (XFS_EXTENTADD_SPACE_RES(mp, XFS_DATA_FORK) + (v))
 85 #define XFS_GROWFS_SPACE_RES(mp)        \
 86         (2 * (mp)->m_alloc_maxlevels)
 87 #define XFS_GROWFSRT_SPACE_RES(mp,b)    \
 88         ((b) + XFS_EXTENTADD_SPACE_RES(mp, XFS_DATA_FORK))
 89 #define XFS_QM_DQALLOC_SPACE_RES(mp)    \
 90         (XFS_EXTENTADD_SPACE_RES(mp, XFS_DATA_FORK) + \
 91          XFS_DQUOT_CLUSTER_SIZE_FSB)
 92 #define XFS_QM_QINOCREATE_SPACE_RES(mp) \
 93         XFS_IALLOC_SPACE_RES(mp)
 94 #define XFS_IFREE_SPACE_RES(mp)         \
 95         (xfs_has_finobt(mp) ? M_IGEO(mp)->inobt_maxlevels : 0)
 96 
 97 unsigned int xfs_parent_calc_space_res(struct xfs_mount *mp,
 98                 unsigned int namelen);
 99 
100 unsigned int xfs_create_space_res(struct xfs_mount *mp, unsigned int namelen);
101 unsigned int xfs_mkdir_space_res(struct xfs_mount *mp, unsigned int namelen);
102 unsigned int xfs_link_space_res(struct xfs_mount *mp, unsigned int namelen);
103 unsigned int xfs_symlink_space_res(struct xfs_mount *mp, unsigned int namelen,
104                 unsigned int fsblocks);
105 unsigned int xfs_remove_space_res(struct xfs_mount *mp, unsigned int namelen);
106 
107 unsigned int xfs_rename_space_res(struct xfs_mount *mp,
108                 unsigned int src_namelen, bool target_exists,
109                 unsigned int target_namelen, bool has_whiteout);
110 
111 #endif  /* __XFS_TRANS_SPACE_H__ */
112 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php