提交 f4586e40 编写于 作者: D David Chinner 提交者: Lachlan McIlroy

[XFS] Clean up xfs_alloc_search_busy() return values.

xfs_alloc_search_busy() returns an index into the busy array if the extent
was found in the array. This is never checked, and the
xfs_alloc_search_busy() does a log force to prevent reuse of the extent
before the free transaction hits the disk. Hence the return value is
useless. Declare the function void and remove the slot number from the
tracing as well.

SGI-PV: 980084
SGI-Modid: xfs-linux-melb:xfs-kern:30796a
Signed-off-by: NDavid Chinner <dgc@sgi.com>
Signed-off-by: NNiv Sardi <xaiki@sgi.com>
Signed-off-by: NLachlan McIlroy <lachlan@sgi.com>
上级 e5720eec
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
#define XFSA_FIXUP_BNO_OK 1 #define XFSA_FIXUP_BNO_OK 1
#define XFSA_FIXUP_CNT_OK 2 #define XFSA_FIXUP_CNT_OK 2
STATIC int STATIC void
xfs_alloc_search_busy(xfs_trans_t *tp, xfs_alloc_search_busy(xfs_trans_t *tp,
xfs_agnumber_t agno, xfs_agnumber_t agno,
xfs_agblock_t bno, xfs_agblock_t bno,
...@@ -64,15 +64,15 @@ ktrace_t *xfs_alloc_trace_buf; ...@@ -64,15 +64,15 @@ ktrace_t *xfs_alloc_trace_buf;
xfs_alloc_trace_busy(__func__, s, mp, ag, agb, l, sl, tp, XFS_ALLOC_KTRACE_BUSY, __LINE__) xfs_alloc_trace_busy(__func__, s, mp, ag, agb, l, sl, tp, XFS_ALLOC_KTRACE_BUSY, __LINE__)
#define TRACE_UNBUSY(__func__,s,ag,sl,tp) \ #define TRACE_UNBUSY(__func__,s,ag,sl,tp) \
xfs_alloc_trace_busy(__func__, s, mp, ag, -1, -1, sl, tp, XFS_ALLOC_KTRACE_UNBUSY, __LINE__) xfs_alloc_trace_busy(__func__, s, mp, ag, -1, -1, sl, tp, XFS_ALLOC_KTRACE_UNBUSY, __LINE__)
#define TRACE_BUSYSEARCH(__func__,s,ag,agb,l,sl,tp) \ #define TRACE_BUSYSEARCH(__func__,s,ag,agb,l,tp) \
xfs_alloc_trace_busy(__func__, s, mp, ag, agb, l, sl, tp, XFS_ALLOC_KTRACE_BUSYSEARCH, __LINE__) xfs_alloc_trace_busy(__func__, s, mp, ag, agb, l, 0, tp, XFS_ALLOC_KTRACE_BUSYSEARCH, __LINE__)
#else #else
#define TRACE_ALLOC(s,a) #define TRACE_ALLOC(s,a)
#define TRACE_FREE(s,a,b,x,f) #define TRACE_FREE(s,a,b,x,f)
#define TRACE_MODAGF(s,a,f) #define TRACE_MODAGF(s,a,f)
#define TRACE_BUSY(s,a,ag,agb,l,sl,tp) #define TRACE_BUSY(s,a,ag,agb,l,sl,tp)
#define TRACE_UNBUSY(fname,s,ag,sl,tp) #define TRACE_UNBUSY(fname,s,ag,sl,tp)
#define TRACE_BUSYSEARCH(fname,s,ag,agb,l,sl,tp) #define TRACE_BUSYSEARCH(fname,s,ag,agb,l,tp)
#endif /* XFS_ALLOC_TRACE */ #endif /* XFS_ALLOC_TRACE */
/* /*
...@@ -2562,9 +2562,10 @@ xfs_alloc_clear_busy(xfs_trans_t *tp, ...@@ -2562,9 +2562,10 @@ xfs_alloc_clear_busy(xfs_trans_t *tp,
/* /*
* returns non-zero if any of (agno,bno):len is in a busy list * If we find the extent in the busy list, force the log out to get the
* extent out of the busy list so the caller can use it straight away.
*/ */
STATIC int STATIC void
xfs_alloc_search_busy(xfs_trans_t *tp, xfs_alloc_search_busy(xfs_trans_t *tp,
xfs_agnumber_t agno, xfs_agnumber_t agno,
xfs_agblock_t bno, xfs_agblock_t bno,
...@@ -2572,7 +2573,6 @@ xfs_alloc_search_busy(xfs_trans_t *tp, ...@@ -2572,7 +2573,6 @@ xfs_alloc_search_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;
xfs_agblock_t uend, bend; xfs_agblock_t uend, bend;
xfs_lsn_t lsn; xfs_lsn_t lsn;
int cnt; int cnt;
...@@ -2585,21 +2585,18 @@ xfs_alloc_search_busy(xfs_trans_t *tp, ...@@ -2585,21 +2585,18 @@ xfs_alloc_search_busy(xfs_trans_t *tp,
uend = bno + len - 1; uend = bno + len - 1;
/* search pagb_list for this slot, skipping open slots */ /* search pagb_list for this slot, skipping open slots */
for (bsy = mp->m_perag[agno].pagb_list, n = 0; for (bsy = mp->m_perag[agno].pagb_list; cnt; bsy++) {
cnt; bsy++, n++) {
/* /*
* (start1,length1) within (start2, length2) * (start1,length1) within (start2, length2)
*/ */
if (bsy->busy_tp != NULL) { if (bsy->busy_tp != NULL) {
bend = bsy->busy_start + bsy->busy_length - 1; bend = bsy->busy_start + bsy->busy_length - 1;
if ((bno > bend) || if ((bno > bend) || (uend < bsy->busy_start)) {
(uend < bsy->busy_start)) {
cnt--; cnt--;
} else { } else {
TRACE_BUSYSEARCH("xfs_alloc_search_busy", TRACE_BUSYSEARCH("xfs_alloc_search_busy",
"found1", agno, bno, len, n, "found1", agno, bno, len, tp);
tp);
break; break;
} }
} }
...@@ -2610,15 +2607,12 @@ xfs_alloc_search_busy(xfs_trans_t *tp, ...@@ -2610,15 +2607,12 @@ xfs_alloc_search_busy(xfs_trans_t *tp,
* transaction that freed the block * transaction that freed the block
*/ */
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, tp);
lsn = bsy->busy_tp->t_commit_lsn; lsn = bsy->busy_tp->t_commit_lsn;
spin_unlock(&mp->m_perag[agno].pagb_lock); 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, tp);
n = -1;
spin_unlock(&mp->m_perag[agno].pagb_lock); spin_unlock(&mp->m_perag[agno].pagb_lock);
} }
return n;
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册