aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_alloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/xfs_alloc.c')
-rw-r--r--fs/xfs/xfs_alloc.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/fs/xfs/xfs_alloc.c b/fs/xfs/xfs_alloc.c
index 012a649a19c3..ea6aa60ace06 100644
--- a/fs/xfs/xfs_alloc.c
+++ b/fs/xfs/xfs_alloc.c
@@ -2206,7 +2206,7 @@ xfs_alloc_read_agf(
2206 be32_to_cpu(agf->agf_levels[XFS_BTNUM_BNOi]); 2206 be32_to_cpu(agf->agf_levels[XFS_BTNUM_BNOi]);
2207 pag->pagf_levels[XFS_BTNUM_CNTi] = 2207 pag->pagf_levels[XFS_BTNUM_CNTi] =
2208 be32_to_cpu(agf->agf_levels[XFS_BTNUM_CNTi]); 2208 be32_to_cpu(agf->agf_levels[XFS_BTNUM_CNTi]);
2209 spinlock_init(&pag->pagb_lock, "xfspagb"); 2209 spin_lock_init(&pag->pagb_lock);
2210 pag->pagb_list = kmem_zalloc(XFS_PAGB_NUM_SLOTS * 2210 pag->pagb_list = kmem_zalloc(XFS_PAGB_NUM_SLOTS *
2211 sizeof(xfs_perag_busy_t), KM_SLEEP); 2211 sizeof(xfs_perag_busy_t), KM_SLEEP);
2212 pag->pagf_init = 1; 2212 pag->pagf_init = 1;
@@ -2500,10 +2500,9 @@ xfs_alloc_mark_busy(xfs_trans_t *tp,
2500 xfs_mount_t *mp; 2500 xfs_mount_t *mp;
2501 xfs_perag_busy_t *bsy; 2501 xfs_perag_busy_t *bsy;
2502 int n; 2502 int n;
2503 SPLDECL(s);
2504 2503
2505 mp = tp->t_mountp; 2504 mp = tp->t_mountp;
2506 s = mutex_spinlock(&mp->m_perag[agno].pagb_lock); 2505 spin_lock(&mp->m_perag[agno].pagb_lock);
2507 2506
2508 /* search pagb_list for an open slot */ 2507 /* search pagb_list for an open slot */
2509 for (bsy = mp->m_perag[agno].pagb_list, n = 0; 2508 for (bsy = mp->m_perag[agno].pagb_list, n = 0;
@@ -2533,7 +2532,7 @@ xfs_alloc_mark_busy(xfs_trans_t *tp,
2533 xfs_trans_set_sync(tp); 2532 xfs_trans_set_sync(tp);
2534 } 2533 }
2535 2534
2536 mutex_spinunlock(&mp->m_perag[agno].pagb_lock, s); 2535 spin_unlock(&mp->m_perag[agno].pagb_lock);
2537} 2536}
2538 2537
2539void 2538void
@@ -2543,11 +2542,10 @@ xfs_alloc_clear_busy(xfs_trans_t *tp,
2543{ 2542{
2544 xfs_mount_t *mp; 2543 xfs_mount_t *mp;
2545 xfs_perag_busy_t *list; 2544 xfs_perag_busy_t *list;
2546 SPLDECL(s);
2547 2545
2548 mp = tp->t_mountp; 2546 mp = tp->t_mountp;
2549 2547
2550 s = mutex_spinlock(&mp->m_perag[agno].pagb_lock); 2548 spin_lock(&mp->m_perag[agno].pagb_lock);
2551 list = mp->m_perag[agno].pagb_list; 2549 list = mp->m_perag[agno].pagb_list;
2552 2550
2553 ASSERT(idx < XFS_PAGB_NUM_SLOTS); 2551 ASSERT(idx < XFS_PAGB_NUM_SLOTS);
@@ -2559,7 +2557,7 @@ xfs_alloc_clear_busy(xfs_trans_t *tp,
2559 TRACE_UNBUSY("xfs_alloc_clear_busy", "missing", agno, idx, tp); 2557 TRACE_UNBUSY("xfs_alloc_clear_busy", "missing", agno, idx, tp);
2560 } 2558 }
2561 2559
2562 mutex_spinunlock(&mp->m_perag[agno].pagb_lock, s); 2560 spin_unlock(&mp->m_perag[agno].pagb_lock);
2563} 2561}
2564 2562
2565 2563
@@ -2578,11 +2576,10 @@ xfs_alloc_search_busy(xfs_trans_t *tp,
2578 xfs_agblock_t uend, bend; 2576 xfs_agblock_t uend, bend;
2579 xfs_lsn_t lsn; 2577 xfs_lsn_t lsn;
2580 int cnt; 2578 int cnt;
2581 SPLDECL(s);
2582 2579
2583 mp = tp->t_mountp; 2580 mp = tp->t_mountp;
2584 2581
2585 s = mutex_spinlock(&mp->m_perag[agno].pagb_lock); 2582 spin_lock(&mp->m_perag[agno].pagb_lock);
2586 cnt = mp->m_perag[agno].pagb_count; 2583 cnt = mp->m_perag[agno].pagb_count;
2587 2584
2588 uend = bno + len - 1; 2585 uend = bno + len - 1;
@@ -2615,12 +2612,12 @@ xfs_alloc_search_busy(xfs_trans_t *tp,
2615 if (cnt) { 2612 if (cnt) {
2616 TRACE_BUSYSEARCH("xfs_alloc_search_busy", "found", agno, bno, len, n, tp); 2613 TRACE_BUSYSEARCH("xfs_alloc_search_busy", "found", agno, bno, len, n, tp);
2617 lsn = bsy->busy_tp->t_commit_lsn; 2614 lsn = bsy->busy_tp->t_commit_lsn;
2618 mutex_spinunlock(&mp->m_perag[agno].pagb_lock, s); 2615 spin_unlock(&mp->m_perag[agno].pagb_lock);
2619 xfs_log_force(mp, lsn, XFS_LOG_FORCE|XFS_LOG_SYNC); 2616 xfs_log_force(mp, lsn, XFS_LOG_FORCE|XFS_LOG_SYNC);
2620 } else { 2617 } else {
2621 TRACE_BUSYSEARCH("xfs_alloc_search_busy", "not-found", agno, bno, len, n, tp); 2618 TRACE_BUSYSEARCH("xfs_alloc_search_busy", "not-found", agno, bno, len, n, tp);
2622 n = -1; 2619 n = -1;
2623 mutex_spinunlock(&mp->m_perag[agno].pagb_lock, s); 2620 spin_unlock(&mp->m_perag[agno].pagb_lock);
2624 } 2621 }
2625 2622
2626 return n; 2623 return n;