提交 c8da0faf 编写于 作者: C Christoph Hellwig

xfs: return the buffer locked from xfs_buf_get_uncached

All other xfs_buf_get/read-like helpers return the buffer locked, make sure
xfs_buf_get_uncached isn't different for no reason.  Half of the callers
already lock it directly after, and the others probably should also keep
it locked if only for consistency and beeing able to use xfs_buf_rele,
but I'll leave that for later.
Signed-off-by: NChristoph Hellwig <hch@lst.de>
Reviewed-by: NAlex Elder <aelder@sgi.com>
Reviewed-by: NDave Chinner <dchinner@redhat.com>
上级 0c842ad4
...@@ -679,7 +679,6 @@ xfs_buf_read_uncached( ...@@ -679,7 +679,6 @@ xfs_buf_read_uncached(
return NULL; return NULL;
/* set up the buffer for a read IO */ /* set up the buffer for a read IO */
xfs_buf_lock(bp);
XFS_BUF_SET_ADDR(bp, daddr); XFS_BUF_SET_ADDR(bp, daddr);
XFS_BUF_READ(bp); XFS_BUF_READ(bp);
XFS_BUF_BUSY(bp); XFS_BUF_BUSY(bp);
...@@ -814,8 +813,6 @@ xfs_buf_get_uncached( ...@@ -814,8 +813,6 @@ xfs_buf_get_uncached(
goto fail_free_mem; goto fail_free_mem;
} }
xfs_buf_unlock(bp);
trace_xfs_buf_get_uncached(bp, _RET_IP_); trace_xfs_buf_get_uncached(bp, _RET_IP_);
return bp; return bp;
......
...@@ -1090,8 +1090,7 @@ xlog_alloc_log(xfs_mount_t *mp, ...@@ -1090,8 +1090,7 @@ xlog_alloc_log(xfs_mount_t *mp,
log->l_iclog_size, 0); log->l_iclog_size, 0);
if (!bp) if (!bp)
goto out_free_iclog; goto out_free_iclog;
if (!xfs_buf_trylock(bp))
ASSERT(0);
XFS_BUF_SET_IODONE_FUNC(bp, xlog_iodone); XFS_BUF_SET_IODONE_FUNC(bp, xlog_iodone);
XFS_BUF_SET_FSPRIVATE2(bp, (unsigned long)1); XFS_BUF_SET_FSPRIVATE2(bp, (unsigned long)1);
iclog->ic_bp = bp; iclog->ic_bp = bp;
......
...@@ -91,6 +91,8 @@ xlog_get_bp( ...@@ -91,6 +91,8 @@ xlog_get_bp(
xlog_t *log, xlog_t *log,
int nbblks) int nbblks)
{ {
struct xfs_buf *bp;
if (!xlog_buf_bbcount_valid(log, nbblks)) { if (!xlog_buf_bbcount_valid(log, nbblks)) {
xfs_warn(log->l_mp, "Invalid block length (0x%x) for buffer", xfs_warn(log->l_mp, "Invalid block length (0x%x) for buffer",
nbblks); nbblks);
...@@ -118,8 +120,10 @@ xlog_get_bp( ...@@ -118,8 +120,10 @@ xlog_get_bp(
nbblks += log->l_sectBBsize; nbblks += log->l_sectBBsize;
nbblks = round_up(nbblks, log->l_sectBBsize); nbblks = round_up(nbblks, log->l_sectBBsize);
return xfs_buf_get_uncached(log->l_mp->m_logdev_targp, bp = xfs_buf_get_uncached(log->l_mp->m_logdev_targp, BBTOB(nbblks), 0);
BBTOB(nbblks), 0); if (bp)
xfs_buf_unlock(bp);
return bp;
} }
STATIC void STATIC void
......
...@@ -1969,6 +1969,8 @@ xfs_zero_remaining_bytes( ...@@ -1969,6 +1969,8 @@ xfs_zero_remaining_bytes(
if (!bp) if (!bp)
return XFS_ERROR(ENOMEM); return XFS_ERROR(ENOMEM);
xfs_buf_unlock(bp);
for (offset = startoff; offset <= endoff; offset = lastoffset + 1) { for (offset = startoff; offset <= endoff; offset = lastoffset + 1) {
offset_fsb = XFS_B_TO_FSBT(mp, offset); offset_fsb = XFS_B_TO_FSBT(mp, offset);
nimap = 1; nimap = 1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册