[PATCH 04/45] FIXUP: xfs: make metabtree reservations global

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 include/spinlock.h   |  5 +++++
 include/xfs_mount.h  |  4 ++++
 libxfs/libxfs_priv.h |  1 +
 mkfs/xfs_mkfs.c      | 25 ++++---------------------
 4 files changed, 14 insertions(+), 21 deletions(-)

diff --git a/include/spinlock.h b/include/spinlock.h
index 82973726b101..73bd8c078fea 100644
--- a/include/spinlock.h
+++ b/include/spinlock.h
@@ -22,4 +22,9 @@ typedef pthread_mutex_t	spinlock_t;
 #define spin_trylock(l)		(pthread_mutex_trylock(l) != EBUSY)
 #define spin_unlock(l)		pthread_mutex_unlock(l)
 
+#define mutex_init(l)		pthread_mutex_init(l, NULL)
+#define mutex_lock(l)		pthread_mutex_lock(l)
+#define mutex_trylock(l)	(pthread_mutex_trylock(l) != EBUSY)
+#define mutex_unlock(l)		pthread_mutex_unlock(l)
+
 #endif /* __LIBXFS_SPINLOCK_H__ */
diff --git a/include/xfs_mount.h b/include/xfs_mount.h
index e0f72fc32b25..0acf952eb9d7 100644
--- a/include/xfs_mount.h
+++ b/include/xfs_mount.h
@@ -164,6 +164,10 @@ typedef struct xfs_mount {
 	atomic64_t		m_allocbt_blks;
 	spinlock_t		m_perag_lock;	/* lock for m_perag_tree */
 
+	pthread_mutex_t		m_metafile_resv_lock;
+	uint64_t		m_metafile_resv_target;
+	uint64_t		m_metafile_resv_used;
+	uint64_t		m_metafile_resv_avail;
 } xfs_mount_t;
 
 #define M_IGEO(mp)		(&(mp)->m_ino_geo)
diff --git a/libxfs/libxfs_priv.h b/libxfs/libxfs_priv.h
index cb4800de0b11..82952b0db629 100644
--- a/libxfs/libxfs_priv.h
+++ b/libxfs/libxfs_priv.h
@@ -151,6 +151,7 @@ enum ce { CE_DEBUG, CE_CONT, CE_NOTE, CE_WARN, CE_ALERT, CE_PANIC };
 
 #define xfs_force_shutdown(d,n)		((void) 0)
 #define xfs_mod_delalloc(a,b,c)		((void) 0)
+#define xfs_mod_sb_delalloc(sb, d)	((void) 0)
 
 /* stop unused var warnings by assigning mp to itself */
 
diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c
index 3f4455d46383..39e3349205fb 100644
--- a/mkfs/xfs_mkfs.c
+++ b/mkfs/xfs_mkfs.c
@@ -5102,8 +5102,6 @@ check_rt_meta_prealloc(
 	struct xfs_mount	*mp)
 {
 	struct xfs_perag	*pag = NULL;
-	struct xfs_rtgroup	*rtg = NULL;
-	xfs_filblks_t		ask;
 	int			error;
 
 	/*
@@ -5123,27 +5121,12 @@ check_rt_meta_prealloc(
 		}
 	}
 
-	/* Realtime metadata btree inode */
-	while ((rtg = xfs_rtgroup_next(mp, rtg))) {
-		ask = libxfs_rtrmapbt_calc_reserves(mp);
-		error = -libxfs_metafile_resv_init(rtg_rmap(rtg), ask);
-		if (error)
-			prealloc_fail(mp, error, ask, _("realtime rmap btree"));
-
-		ask = libxfs_rtrefcountbt_calc_reserves(mp);
-		error = -libxfs_metafile_resv_init(rtg_refcount(rtg), ask);
-		if (error)
-			prealloc_fail(mp, error, ask,
-					_("realtime refcount btree"));
-	}
+	error = -libxfs_metafile_resv_init(mp);
+	if (error)
+		prealloc_fail(mp, error, 0, _("metafile"));
 
-	/* Unreserve the realtime metadata reservations. */
-	while ((rtg = xfs_rtgroup_next(mp, rtg))) {
-		libxfs_metafile_resv_free(rtg_rmap(rtg));
-		libxfs_metafile_resv_free(rtg_refcount(rtg));
-	}
+	libxfs_metafile_resv_free(mp);
 
-	/* Unreserve the per-AG reservations. */
 	while ((pag = xfs_perag_next(mp, pag)))
 		libxfs_ag_resv_free(pag);
 
-- 
2.47.2





[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux