diff options
Diffstat (limited to 'fs/xfs/xfs_alloc.c')
-rw-r--r-- | fs/xfs/xfs_alloc.c | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/fs/xfs/xfs_alloc.c b/fs/xfs/xfs_alloc.c index bd5c01788eff..bd43f77daacd 100644 --- a/fs/xfs/xfs_alloc.c +++ b/fs/xfs/xfs_alloc.c | |||
@@ -45,7 +45,7 @@ | |||
45 | #define XFSA_FIXUP_BNO_OK 1 | 45 | #define XFSA_FIXUP_BNO_OK 1 |
46 | #define XFSA_FIXUP_CNT_OK 2 | 46 | #define XFSA_FIXUP_CNT_OK 2 |
47 | 47 | ||
48 | STATIC int | 48 | STATIC void |
49 | xfs_alloc_search_busy(xfs_trans_t *tp, | 49 | xfs_alloc_search_busy(xfs_trans_t *tp, |
50 | xfs_agnumber_t agno, | 50 | xfs_agnumber_t agno, |
51 | xfs_agblock_t bno, | 51 | xfs_agblock_t bno, |
@@ -64,15 +64,15 @@ ktrace_t *xfs_alloc_trace_buf; | |||
64 | xfs_alloc_trace_busy(__func__, s, mp, ag, agb, l, sl, tp, XFS_ALLOC_KTRACE_BUSY, __LINE__) | 64 | xfs_alloc_trace_busy(__func__, s, mp, ag, agb, l, sl, tp, XFS_ALLOC_KTRACE_BUSY, __LINE__) |
65 | #define TRACE_UNBUSY(__func__,s,ag,sl,tp) \ | 65 | #define TRACE_UNBUSY(__func__,s,ag,sl,tp) \ |
66 | xfs_alloc_trace_busy(__func__, s, mp, ag, -1, -1, sl, tp, XFS_ALLOC_KTRACE_UNBUSY, __LINE__) | 66 | xfs_alloc_trace_busy(__func__, s, mp, ag, -1, -1, sl, tp, XFS_ALLOC_KTRACE_UNBUSY, __LINE__) |
67 | #define TRACE_BUSYSEARCH(__func__,s,ag,agb,l,sl,tp) \ | 67 | #define TRACE_BUSYSEARCH(__func__,s,ag,agb,l,tp) \ |
68 | xfs_alloc_trace_busy(__func__, s, mp, ag, agb, l, sl, tp, XFS_ALLOC_KTRACE_BUSYSEARCH, __LINE__) | 68 | xfs_alloc_trace_busy(__func__, s, mp, ag, agb, l, 0, tp, XFS_ALLOC_KTRACE_BUSYSEARCH, __LINE__) |
69 | #else | 69 | #else |
70 | #define TRACE_ALLOC(s,a) | 70 | #define TRACE_ALLOC(s,a) |
71 | #define TRACE_FREE(s,a,b,x,f) | 71 | #define TRACE_FREE(s,a,b,x,f) |
72 | #define TRACE_MODAGF(s,a,f) | 72 | #define TRACE_MODAGF(s,a,f) |
73 | #define TRACE_BUSY(s,a,ag,agb,l,sl,tp) | 73 | #define TRACE_BUSY(s,a,ag,agb,l,sl,tp) |
74 | #define TRACE_UNBUSY(fname,s,ag,sl,tp) | 74 | #define TRACE_UNBUSY(fname,s,ag,sl,tp) |
75 | #define TRACE_BUSYSEARCH(fname,s,ag,agb,l,sl,tp) | 75 | #define TRACE_BUSYSEARCH(fname,s,ag,agb,l,tp) |
76 | #endif /* XFS_ALLOC_TRACE */ | 76 | #endif /* XFS_ALLOC_TRACE */ |
77 | 77 | ||
78 | /* | 78 | /* |
@@ -2562,9 +2562,10 @@ xfs_alloc_clear_busy(xfs_trans_t *tp, | |||
2562 | 2562 | ||
2563 | 2563 | ||
2564 | /* | 2564 | /* |
2565 | * returns non-zero if any of (agno,bno):len is in a busy list | 2565 | * If we find the extent in the busy list, force the log out to get the |
2566 | * extent out of the busy list so the caller can use it straight away. | ||
2566 | */ | 2567 | */ |
2567 | STATIC int | 2568 | STATIC void |
2568 | xfs_alloc_search_busy(xfs_trans_t *tp, | 2569 | xfs_alloc_search_busy(xfs_trans_t *tp, |
2569 | xfs_agnumber_t agno, | 2570 | xfs_agnumber_t agno, |
2570 | xfs_agblock_t bno, | 2571 | xfs_agblock_t bno, |
@@ -2572,7 +2573,6 @@ xfs_alloc_search_busy(xfs_trans_t *tp, | |||
2572 | { | 2573 | { |
2573 | xfs_mount_t *mp; | 2574 | xfs_mount_t *mp; |
2574 | xfs_perag_busy_t *bsy; | 2575 | xfs_perag_busy_t *bsy; |
2575 | int n; | ||
2576 | xfs_agblock_t uend, bend; | 2576 | xfs_agblock_t uend, bend; |
2577 | xfs_lsn_t lsn; | 2577 | xfs_lsn_t lsn; |
2578 | int cnt; | 2578 | int cnt; |
@@ -2585,21 +2585,18 @@ xfs_alloc_search_busy(xfs_trans_t *tp, | |||
2585 | uend = bno + len - 1; | 2585 | uend = bno + len - 1; |
2586 | 2586 | ||
2587 | /* search pagb_list for this slot, skipping open slots */ | 2587 | /* search pagb_list for this slot, skipping open slots */ |
2588 | for (bsy = mp->m_perag[agno].pagb_list, n = 0; | 2588 | for (bsy = mp->m_perag[agno].pagb_list; cnt; bsy++) { |
2589 | cnt; bsy++, n++) { | ||
2590 | 2589 | ||
2591 | /* | 2590 | /* |
2592 | * (start1,length1) within (start2, length2) | 2591 | * (start1,length1) within (start2, length2) |
2593 | */ | 2592 | */ |
2594 | if (bsy->busy_tp != NULL) { | 2593 | if (bsy->busy_tp != NULL) { |
2595 | bend = bsy->busy_start + bsy->busy_length - 1; | 2594 | bend = bsy->busy_start + bsy->busy_length - 1; |
2596 | if ((bno > bend) || | 2595 | if ((bno > bend) || (uend < bsy->busy_start)) { |
2597 | (uend < bsy->busy_start)) { | ||
2598 | cnt--; | 2596 | cnt--; |
2599 | } else { | 2597 | } else { |
2600 | TRACE_BUSYSEARCH("xfs_alloc_search_busy", | 2598 | TRACE_BUSYSEARCH("xfs_alloc_search_busy", |
2601 | "found1", agno, bno, len, n, | 2599 | "found1", agno, bno, len, tp); |
2602 | tp); | ||
2603 | break; | 2600 | break; |
2604 | } | 2601 | } |
2605 | } | 2602 | } |
@@ -2610,15 +2607,12 @@ xfs_alloc_search_busy(xfs_trans_t *tp, | |||
2610 | * transaction that freed the block | 2607 | * transaction that freed the block |
2611 | */ | 2608 | */ |
2612 | if (cnt) { | 2609 | if (cnt) { |
2613 | TRACE_BUSYSEARCH("xfs_alloc_search_busy", "found", agno, bno, len, n, tp); | 2610 | TRACE_BUSYSEARCH("xfs_alloc_search_busy", "found", agno, bno, len, tp); |
2614 | lsn = bsy->busy_tp->t_commit_lsn; | 2611 | lsn = bsy->busy_tp->t_commit_lsn; |
2615 | spin_unlock(&mp->m_perag[agno].pagb_lock); | 2612 | spin_unlock(&mp->m_perag[agno].pagb_lock); |
2616 | xfs_log_force(mp, lsn, XFS_LOG_FORCE|XFS_LOG_SYNC); | 2613 | xfs_log_force(mp, lsn, XFS_LOG_FORCE|XFS_LOG_SYNC); |
2617 | } else { | 2614 | } else { |
2618 | TRACE_BUSYSEARCH("xfs_alloc_search_busy", "not-found", agno, bno, len, n, tp); | 2615 | TRACE_BUSYSEARCH("xfs_alloc_search_busy", "not-found", agno, bno, len, tp); |
2619 | n = -1; | ||
2620 | spin_unlock(&mp->m_perag[agno].pagb_lock); | 2616 | spin_unlock(&mp->m_perag[agno].pagb_lock); |
2621 | } | 2617 | } |
2622 | |||
2623 | return n; | ||
2624 | } | 2618 | } |