|
@@ -21,8 +21,20 @@
|
|
/*
|
|
/*
|
|
* Components of space reservations.
|
|
* Components of space reservations.
|
|
*/
|
|
*/
|
|
|
|
+
|
|
|
|
+/* Worst case number of rmaps that can be held in a block. */
|
|
#define XFS_MAX_CONTIG_RMAPS_PER_BLOCK(mp) \
|
|
#define XFS_MAX_CONTIG_RMAPS_PER_BLOCK(mp) \
|
|
(((mp)->m_rmap_mxr[0]) - ((mp)->m_rmap_mnr[0]))
|
|
(((mp)->m_rmap_mxr[0]) - ((mp)->m_rmap_mnr[0]))
|
|
|
|
+
|
|
|
|
+/* Adding one rmap could split every level up to the top of the tree. */
|
|
|
|
+#define XFS_RMAPADD_SPACE_RES(mp) ((mp)->m_rmap_maxlevels)
|
|
|
|
+
|
|
|
|
+/* Blocks we might need to add "b" rmaps to a tree. */
|
|
|
|
+#define XFS_NRMAPADD_SPACE_RES(mp, b)\
|
|
|
|
+ (((b + XFS_MAX_CONTIG_RMAPS_PER_BLOCK(mp) - 1) / \
|
|
|
|
+ XFS_MAX_CONTIG_RMAPS_PER_BLOCK(mp)) * \
|
|
|
|
+ XFS_RMAPADD_SPACE_RES(mp))
|
|
|
|
+
|
|
#define XFS_MAX_CONTIG_EXTENTS_PER_BLOCK(mp) \
|
|
#define XFS_MAX_CONTIG_EXTENTS_PER_BLOCK(mp) \
|
|
(((mp)->m_alloc_mxr[0]) - ((mp)->m_alloc_mnr[0]))
|
|
(((mp)->m_alloc_mxr[0]) - ((mp)->m_alloc_mnr[0]))
|
|
#define XFS_EXTENTADD_SPACE_RES(mp,w) (XFS_BM_MAXLEVELS(mp,w) - 1)
|
|
#define XFS_EXTENTADD_SPACE_RES(mp,w) (XFS_BM_MAXLEVELS(mp,w) - 1)
|
|
@@ -30,13 +42,12 @@
|
|
(((b + XFS_MAX_CONTIG_EXTENTS_PER_BLOCK(mp) - 1) / \
|
|
(((b + XFS_MAX_CONTIG_EXTENTS_PER_BLOCK(mp) - 1) / \
|
|
XFS_MAX_CONTIG_EXTENTS_PER_BLOCK(mp)) * \
|
|
XFS_MAX_CONTIG_EXTENTS_PER_BLOCK(mp)) * \
|
|
XFS_EXTENTADD_SPACE_RES(mp,w))
|
|
XFS_EXTENTADD_SPACE_RES(mp,w))
|
|
|
|
+
|
|
|
|
+/* Blocks we might need to add "b" mappings & rmappings to a file. */
|
|
#define XFS_SWAP_RMAP_SPACE_RES(mp,b,w)\
|
|
#define XFS_SWAP_RMAP_SPACE_RES(mp,b,w)\
|
|
- (((b + XFS_MAX_CONTIG_EXTENTS_PER_BLOCK(mp) - 1) / \
|
|
|
|
- XFS_MAX_CONTIG_EXTENTS_PER_BLOCK(mp)) * \
|
|
|
|
- XFS_EXTENTADD_SPACE_RES(mp,w) + \
|
|
|
|
- ((b + XFS_MAX_CONTIG_RMAPS_PER_BLOCK(mp) - 1) / \
|
|
|
|
- XFS_MAX_CONTIG_RMAPS_PER_BLOCK(mp)) * \
|
|
|
|
- (mp)->m_rmap_maxlevels)
|
|
|
|
|
|
+ (XFS_NEXTENTADD_SPACE_RES((mp), (b), (w)) + \
|
|
|
|
+ XFS_NRMAPADD_SPACE_RES((mp), (b)))
|
|
|
|
+
|
|
#define XFS_DAENTER_1B(mp,w) \
|
|
#define XFS_DAENTER_1B(mp,w) \
|
|
((w) == XFS_DATA_FORK ? (mp)->m_dir_geo->fsbcount : 1)
|
|
((w) == XFS_DATA_FORK ? (mp)->m_dir_geo->fsbcount : 1)
|
|
#define XFS_DAENTER_DBS(mp,w) \
|
|
#define XFS_DAENTER_DBS(mp,w) \
|