aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2011-07-08 08:36:25 -0400
committerChristoph Hellwig <hch@lst.de>2011-07-08 08:36:25 -0400
commitc8da0faf6b07623c473cab42967f943ad4ab7560 (patch)
tree6bfd211ba798c482f592c81bfbe4760758c829e8 /fs/xfs
parent0c842ad46a51891ac4420b7285613f4134a65ccd (diff)
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: Christoph Hellwig <hch@lst.de> Reviewed-by: Alex Elder <aelder@sgi.com> Reviewed-by: Dave Chinner <dchinner@redhat.com>
Diffstat (limited to 'fs/xfs')
-rw-r--r--fs/xfs/linux-2.6/xfs_buf.c3
-rw-r--r--fs/xfs/xfs_log.c3
-rw-r--r--fs/xfs/xfs_log_recover.c8
-rw-r--r--fs/xfs/xfs_vnodeops.c2
4 files changed, 9 insertions, 7 deletions
diff --git a/fs/xfs/linux-2.6/xfs_buf.c b/fs/xfs/linux-2.6/xfs_buf.c
index c77227615403..6ad5ae249bfb 100644
--- a/fs/xfs/linux-2.6/xfs_buf.c
+++ b/fs/xfs/linux-2.6/xfs_buf.c
@@ -679,7 +679,6 @@ xfs_buf_read_uncached(
679 return NULL; 679 return NULL;
680 680
681 /* set up the buffer for a read IO */ 681 /* set up the buffer for a read IO */
682 xfs_buf_lock(bp);
683 XFS_BUF_SET_ADDR(bp, daddr); 682 XFS_BUF_SET_ADDR(bp, daddr);
684 XFS_BUF_READ(bp); 683 XFS_BUF_READ(bp);
685 XFS_BUF_BUSY(bp); 684 XFS_BUF_BUSY(bp);
@@ -814,8 +813,6 @@ xfs_buf_get_uncached(
814 goto fail_free_mem; 813 goto fail_free_mem;
815 } 814 }
816 815
817 xfs_buf_unlock(bp);
818
819 trace_xfs_buf_get_uncached(bp, _RET_IP_); 816 trace_xfs_buf_get_uncached(bp, _RET_IP_);
820 return bp; 817 return bp;
821 818
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
index 68e053ea6e78..44c269b387c7 100644
--- a/fs/xfs/xfs_log.c
+++ b/fs/xfs/xfs_log.c
@@ -1090,8 +1090,7 @@ xlog_alloc_log(xfs_mount_t *mp,
1090 log->l_iclog_size, 0); 1090 log->l_iclog_size, 0);
1091 if (!bp) 1091 if (!bp)
1092 goto out_free_iclog; 1092 goto out_free_iclog;
1093 if (!xfs_buf_trylock(bp)) 1093
1094 ASSERT(0);
1095 XFS_BUF_SET_IODONE_FUNC(bp, xlog_iodone); 1094 XFS_BUF_SET_IODONE_FUNC(bp, xlog_iodone);
1096 XFS_BUF_SET_FSPRIVATE2(bp, (unsigned long)1); 1095 XFS_BUF_SET_FSPRIVATE2(bp, (unsigned long)1);
1097 iclog->ic_bp = bp; 1096 iclog->ic_bp = bp;
diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c
index a74e26408343..40c9742aa478 100644
--- a/fs/xfs/xfs_log_recover.c
+++ b/fs/xfs/xfs_log_recover.c
@@ -91,6 +91,8 @@ xlog_get_bp(
91 xlog_t *log, 91 xlog_t *log,
92 int nbblks) 92 int nbblks)
93{ 93{
94 struct xfs_buf *bp;
95
94 if (!xlog_buf_bbcount_valid(log, nbblks)) { 96 if (!xlog_buf_bbcount_valid(log, nbblks)) {
95 xfs_warn(log->l_mp, "Invalid block length (0x%x) for buffer", 97 xfs_warn(log->l_mp, "Invalid block length (0x%x) for buffer",
96 nbblks); 98 nbblks);
@@ -118,8 +120,10 @@ xlog_get_bp(
118 nbblks += log->l_sectBBsize; 120 nbblks += log->l_sectBBsize;
119 nbblks = round_up(nbblks, log->l_sectBBsize); 121 nbblks = round_up(nbblks, log->l_sectBBsize);
120 122
121 return xfs_buf_get_uncached(log->l_mp->m_logdev_targp, 123 bp = xfs_buf_get_uncached(log->l_mp->m_logdev_targp, BBTOB(nbblks), 0);
122 BBTOB(nbblks), 0); 124 if (bp)
125 xfs_buf_unlock(bp);
126 return bp;
123} 127}
124 128
125STATIC void 129STATIC void
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c
index 11242c482771..88d121486c52 100644
--- a/fs/xfs/xfs_vnodeops.c
+++ b/fs/xfs/xfs_vnodeops.c
@@ -1969,6 +1969,8 @@ xfs_zero_remaining_bytes(
1969 if (!bp) 1969 if (!bp)
1970 return XFS_ERROR(ENOMEM); 1970 return XFS_ERROR(ENOMEM);
1971 1971
1972 xfs_buf_unlock(bp);
1973
1972 for (offset = startoff; offset <= endoff; offset = lastoffset + 1) { 1974 for (offset = startoff; offset <= endoff; offset = lastoffset + 1) {
1973 offset_fsb = XFS_B_TO_FSBT(mp, offset); 1975 offset_fsb = XFS_B_TO_FSBT(mp, offset);
1974 nimap = 1; 1976 nimap = 1;