Commit 64137e56 authored by Eric Sandeen's avatar Eric Sandeen Committed by Lachlan McIlroy

[XFS] Unwrap pagb_lock.

Un-obfuscate pagb_lock, remove mutex_lock->spin_lock macros, call
spin_lock directly, remove extraneous cookie holdover from old xfs code,
and change lock type to spinlock_t.

SGI-PV: 970382
SGI-Modid: xfs-linux-melb:xfs-kern:29743a
Signed-off-by: default avatarEric Sandeen <sandeen@sandeen.net>
Signed-off-by: default avatarDonald Douwsma <donaldd@sgi.com>
Signed-off-by: default avatarTim Shimmin <tes@sgi.com>
parent 869b9060
...@@ -193,7 +193,7 @@ typedef struct xfs_perag ...@@ -193,7 +193,7 @@ typedef struct xfs_perag
xfs_agino_t pagi_count; /* number of allocated inodes */ xfs_agino_t pagi_count; /* number of allocated inodes */
int pagb_count; /* pagb slots in use */ int pagb_count; /* pagb slots in use */
#ifdef __KERNEL__ #ifdef __KERNEL__
lock_t pagb_lock; /* lock for pagb_list */ spinlock_t pagb_lock; /* lock for pagb_list */
#endif #endif
xfs_perag_busy_t *pagb_list; /* unstable blocks */ xfs_perag_busy_t *pagb_list; /* unstable blocks */
atomic_t pagf_fstrms; /* # of filestreams active in this AG */ atomic_t pagf_fstrms; /* # of filestreams active in this AG */
......
...@@ -2500,10 +2500,9 @@ xfs_alloc_mark_busy(xfs_trans_t *tp, ...@@ -2500,10 +2500,9 @@ xfs_alloc_mark_busy(xfs_trans_t *tp,
xfs_mount_t *mp; xfs_mount_t *mp;
xfs_perag_busy_t *bsy; xfs_perag_busy_t *bsy;
int n; int n;
SPLDECL(s);
mp = tp->t_mountp; mp = tp->t_mountp;
s = mutex_spinlock(&mp->m_perag[agno].pagb_lock); spin_lock(&mp->m_perag[agno].pagb_lock);
/* search pagb_list for an open slot */ /* search pagb_list for an open slot */
for (bsy = mp->m_perag[agno].pagb_list, n = 0; for (bsy = mp->m_perag[agno].pagb_list, n = 0;
...@@ -2533,7 +2532,7 @@ xfs_alloc_mark_busy(xfs_trans_t *tp, ...@@ -2533,7 +2532,7 @@ xfs_alloc_mark_busy(xfs_trans_t *tp,
xfs_trans_set_sync(tp); xfs_trans_set_sync(tp);
} }
mutex_spinunlock(&mp->m_perag[agno].pagb_lock, s); spin_unlock(&mp->m_perag[agno].pagb_lock);
} }
void void
...@@ -2543,11 +2542,10 @@ xfs_alloc_clear_busy(xfs_trans_t *tp, ...@@ -2543,11 +2542,10 @@ xfs_alloc_clear_busy(xfs_trans_t *tp,
{ {
xfs_mount_t *mp; xfs_mount_t *mp;
xfs_perag_busy_t *list; xfs_perag_busy_t *list;
SPLDECL(s);
mp = tp->t_mountp; mp = tp->t_mountp;
s = mutex_spinlock(&mp->m_perag[agno].pagb_lock); spin_lock(&mp->m_perag[agno].pagb_lock);
list = mp->m_perag[agno].pagb_list; list = mp->m_perag[agno].pagb_list;
ASSERT(idx < XFS_PAGB_NUM_SLOTS); ASSERT(idx < XFS_PAGB_NUM_SLOTS);
...@@ -2559,7 +2557,7 @@ xfs_alloc_clear_busy(xfs_trans_t *tp, ...@@ -2559,7 +2557,7 @@ xfs_alloc_clear_busy(xfs_trans_t *tp,
TRACE_UNBUSY("xfs_alloc_clear_busy", "missing", agno, idx, tp); TRACE_UNBUSY("xfs_alloc_clear_busy", "missing", agno, idx, tp);
} }
mutex_spinunlock(&mp->m_perag[agno].pagb_lock, s); spin_unlock(&mp->m_perag[agno].pagb_lock);
} }
...@@ -2578,11 +2576,10 @@ xfs_alloc_search_busy(xfs_trans_t *tp, ...@@ -2578,11 +2576,10 @@ xfs_alloc_search_busy(xfs_trans_t *tp,
xfs_agblock_t uend, bend; xfs_agblock_t uend, bend;
xfs_lsn_t lsn; xfs_lsn_t lsn;
int cnt; int cnt;
SPLDECL(s);
mp = tp->t_mountp; mp = tp->t_mountp;
s = mutex_spinlock(&mp->m_perag[agno].pagb_lock); spin_lock(&mp->m_perag[agno].pagb_lock);
cnt = mp->m_perag[agno].pagb_count; cnt = mp->m_perag[agno].pagb_count;
uend = bno + len - 1; uend = bno + len - 1;
...@@ -2615,12 +2612,12 @@ xfs_alloc_search_busy(xfs_trans_t *tp, ...@@ -2615,12 +2612,12 @@ xfs_alloc_search_busy(xfs_trans_t *tp,
if (cnt) { if (cnt) {
TRACE_BUSYSEARCH("xfs_alloc_search_busy", "found", agno, bno, len, n, tp); TRACE_BUSYSEARCH("xfs_alloc_search_busy", "found", agno, bno, len, n, tp);
lsn = bsy->busy_tp->t_commit_lsn; lsn = bsy->busy_tp->t_commit_lsn;
mutex_spinunlock(&mp->m_perag[agno].pagb_lock, s); spin_unlock(&mp->m_perag[agno].pagb_lock);
xfs_log_force(mp, lsn, XFS_LOG_FORCE|XFS_LOG_SYNC); xfs_log_force(mp, lsn, XFS_LOG_FORCE|XFS_LOG_SYNC);
} else { } else {
TRACE_BUSYSEARCH("xfs_alloc_search_busy", "not-found", agno, bno, len, n, tp); TRACE_BUSYSEARCH("xfs_alloc_search_busy", "not-found", agno, bno, len, n, tp);
n = -1; n = -1;
mutex_spinunlock(&mp->m_perag[agno].pagb_lock, s); spin_unlock(&mp->m_perag[agno].pagb_lock);
} }
return n; return n;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment