aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2011-08-23 04:28:07 -0400
committerAlex Elder <aelder@sgi.com>2011-10-11 22:15:00 -0400
commitc2b006c1da1602551def200e4661535f02b82488 (patch)
tree6801f459bb218ed062d30e31eb92d3867ce8166a /fs
parent61551f1ee536289084a4a8f1c4f187e2f371c440 (diff)
xfs: let xfs_bwrite callers handle the xfs_buf_relse
Remove the xfs_buf_relse from xfs_bwrite and let the caller handle it to mirror the delwri and read paths. Also remove the mount pointer passed to xfs_bwrite, which is superflous now that we have a mount pointer in the buftarg. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Alex Elder <aelder@sgi.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/xfs/xfs_attr.c7
-rw-r--r--fs/xfs/xfs_buf.c8
-rw-r--r--fs/xfs/xfs_buf.h2
-rw-r--r--fs/xfs/xfs_dquot.c8
-rw-r--r--fs/xfs/xfs_fsops.c40
-rw-r--r--fs/xfs/xfs_inode.c8
-rw-r--r--fs/xfs/xfs_log_recover.c11
-rw-r--r--fs/xfs/xfs_sync.c6
8 files changed, 50 insertions, 40 deletions
diff --git a/fs/xfs/xfs_attr.c b/fs/xfs/xfs_attr.c
index b097fd5a2b3f..8f0f65833500 100644
--- a/fs/xfs/xfs_attr.c
+++ b/fs/xfs/xfs_attr.c
@@ -2128,9 +2128,10 @@ xfs_attr_rmtval_set(xfs_da_args_t *args)
2128 xfs_buf_iomove(bp, 0, tmp, src, XBRW_WRITE); 2128 xfs_buf_iomove(bp, 0, tmp, src, XBRW_WRITE);
2129 if (tmp < XFS_BUF_SIZE(bp)) 2129 if (tmp < XFS_BUF_SIZE(bp))
2130 xfs_buf_zero(bp, tmp, XFS_BUF_SIZE(bp) - tmp); 2130 xfs_buf_zero(bp, tmp, XFS_BUF_SIZE(bp) - tmp);
2131 if ((error = xfs_bwrite(mp, bp))) {/* GROT: NOTE: synchronous write */ 2131 error = xfs_bwrite(bp); /* GROT: NOTE: synchronous write */
2132 return (error); 2132 xfs_buf_relse(bp);
2133 } 2133 if (error)
2134 return error;
2134 src += tmp; 2135 src += tmp;
2135 valuelen -= tmp; 2136 valuelen -= tmp;
2136 2137
diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c
index 309eca75fad4..63dbeb9efc49 100644
--- a/fs/xfs/xfs_buf.c
+++ b/fs/xfs/xfs_buf.c
@@ -1014,7 +1014,6 @@ xfs_buf_ioerror(
1014 1014
1015int 1015int
1016xfs_bwrite( 1016xfs_bwrite(
1017 struct xfs_mount *mp,
1018 struct xfs_buf *bp) 1017 struct xfs_buf *bp)
1019{ 1018{
1020 int error; 1019 int error;
@@ -1026,9 +1025,10 @@ xfs_bwrite(
1026 xfs_bdstrat_cb(bp); 1025 xfs_bdstrat_cb(bp);
1027 1026
1028 error = xfs_buf_iowait(bp); 1027 error = xfs_buf_iowait(bp);
1029 if (error) 1028 if (error) {
1030 xfs_force_shutdown(mp, SHUTDOWN_META_IO_ERROR); 1029 xfs_force_shutdown(bp->b_target->bt_mount,
1031 xfs_buf_relse(bp); 1030 SHUTDOWN_META_IO_ERROR);
1031 }
1032 return error; 1032 return error;
1033} 1033}
1034 1034
diff --git a/fs/xfs/xfs_buf.h b/fs/xfs/xfs_buf.h
index f1a8933becb6..3f543ed3009b 100644
--- a/fs/xfs/xfs_buf.h
+++ b/fs/xfs/xfs_buf.h
@@ -197,7 +197,7 @@ extern void xfs_buf_unlock(xfs_buf_t *);
197 ((bp)->b_sema.count <= 0) 197 ((bp)->b_sema.count <= 0)
198 198
199/* Buffer Read and Write Routines */ 199/* Buffer Read and Write Routines */
200extern int xfs_bwrite(struct xfs_mount *mp, struct xfs_buf *bp); 200extern int xfs_bwrite(struct xfs_buf *bp);
201 201
202extern void xfsbdstrat(struct xfs_mount *, struct xfs_buf *); 202extern void xfsbdstrat(struct xfs_mount *, struct xfs_buf *);
203extern int xfs_bdstrat_cb(struct xfs_buf *); 203extern int xfs_bdstrat_cb(struct xfs_buf *);
diff --git a/fs/xfs/xfs_dquot.c b/fs/xfs/xfs_dquot.c
index 0f78dd46415c..3e2ccaedc51e 100644
--- a/fs/xfs/xfs_dquot.c
+++ b/fs/xfs/xfs_dquot.c
@@ -1242,11 +1242,11 @@ xfs_qm_dqflush(
1242 } 1242 }
1243 1243
1244 if (flags & SYNC_WAIT) 1244 if (flags & SYNC_WAIT)
1245 error = xfs_bwrite(mp, bp); 1245 error = xfs_bwrite(bp);
1246 else { 1246 else
1247 xfs_buf_delwri_queue(bp); 1247 xfs_buf_delwri_queue(bp);
1248 xfs_buf_relse(bp); 1248
1249 } 1249 xfs_buf_relse(bp);
1250 1250
1251 trace_xfs_dqflush_done(dqp); 1251 trace_xfs_dqflush_done(dqp);
1252 1252
diff --git a/fs/xfs/xfs_fsops.c b/fs/xfs/xfs_fsops.c
index 9153d2c77caf..e023f940a3dd 100644
--- a/fs/xfs/xfs_fsops.c
+++ b/fs/xfs/xfs_fsops.c
@@ -216,10 +216,11 @@ xfs_growfs_data_private(
216 tmpsize = agsize - XFS_PREALLOC_BLOCKS(mp); 216 tmpsize = agsize - XFS_PREALLOC_BLOCKS(mp);
217 agf->agf_freeblks = cpu_to_be32(tmpsize); 217 agf->agf_freeblks = cpu_to_be32(tmpsize);
218 agf->agf_longest = cpu_to_be32(tmpsize); 218 agf->agf_longest = cpu_to_be32(tmpsize);
219 error = xfs_bwrite(mp, bp); 219 error = xfs_bwrite(bp);
220 if (error) { 220 xfs_buf_relse(bp);
221 if (error)
221 goto error0; 222 goto error0;
222 } 223
223 /* 224 /*
224 * AG inode header block 225 * AG inode header block
225 */ 226 */
@@ -240,10 +241,11 @@ xfs_growfs_data_private(
240 agi->agi_dirino = cpu_to_be32(NULLAGINO); 241 agi->agi_dirino = cpu_to_be32(NULLAGINO);
241 for (bucket = 0; bucket < XFS_AGI_UNLINKED_BUCKETS; bucket++) 242 for (bucket = 0; bucket < XFS_AGI_UNLINKED_BUCKETS; bucket++)
242 agi->agi_unlinked[bucket] = cpu_to_be32(NULLAGINO); 243 agi->agi_unlinked[bucket] = cpu_to_be32(NULLAGINO);
243 error = xfs_bwrite(mp, bp); 244 error = xfs_bwrite(bp);
244 if (error) { 245 xfs_buf_relse(bp);
246 if (error)
245 goto error0; 247 goto error0;
246 } 248
247 /* 249 /*
248 * BNO btree root block 250 * BNO btree root block
249 */ 251 */
@@ -262,10 +264,11 @@ xfs_growfs_data_private(
262 arec->ar_startblock = cpu_to_be32(XFS_PREALLOC_BLOCKS(mp)); 264 arec->ar_startblock = cpu_to_be32(XFS_PREALLOC_BLOCKS(mp));
263 arec->ar_blockcount = cpu_to_be32( 265 arec->ar_blockcount = cpu_to_be32(
264 agsize - be32_to_cpu(arec->ar_startblock)); 266 agsize - be32_to_cpu(arec->ar_startblock));
265 error = xfs_bwrite(mp, bp); 267 error = xfs_bwrite(bp);
266 if (error) { 268 xfs_buf_relse(bp);
269 if (error)
267 goto error0; 270 goto error0;
268 } 271
269 /* 272 /*
270 * CNT btree root block 273 * CNT btree root block
271 */ 274 */
@@ -285,10 +288,11 @@ xfs_growfs_data_private(
285 arec->ar_blockcount = cpu_to_be32( 288 arec->ar_blockcount = cpu_to_be32(
286 agsize - be32_to_cpu(arec->ar_startblock)); 289 agsize - be32_to_cpu(arec->ar_startblock));
287 nfree += be32_to_cpu(arec->ar_blockcount); 290 nfree += be32_to_cpu(arec->ar_blockcount);
288 error = xfs_bwrite(mp, bp); 291 error = xfs_bwrite(bp);
289 if (error) { 292 xfs_buf_relse(bp);
293 if (error)
290 goto error0; 294 goto error0;
291 } 295
292 /* 296 /*
293 * INO btree root block 297 * INO btree root block
294 */ 298 */
@@ -303,10 +307,10 @@ xfs_growfs_data_private(
303 block->bb_numrecs = 0; 307 block->bb_numrecs = 0;
304 block->bb_u.s.bb_leftsib = cpu_to_be32(NULLAGBLOCK); 308 block->bb_u.s.bb_leftsib = cpu_to_be32(NULLAGBLOCK);
305 block->bb_u.s.bb_rightsib = cpu_to_be32(NULLAGBLOCK); 309 block->bb_u.s.bb_rightsib = cpu_to_be32(NULLAGBLOCK);
306 error = xfs_bwrite(mp, bp); 310 error = xfs_bwrite(bp);
307 if (error) { 311 xfs_buf_relse(bp);
312 if (error)
308 goto error0; 313 goto error0;
309 }
310 } 314 }
311 xfs_trans_agblocks_delta(tp, nfree); 315 xfs_trans_agblocks_delta(tp, nfree);
312 /* 316 /*
@@ -396,9 +400,9 @@ xfs_growfs_data_private(
396 * just issue a warning and continue. The real work is 400 * just issue a warning and continue. The real work is
397 * already done and committed. 401 * already done and committed.
398 */ 402 */
399 if (!(error = xfs_bwrite(mp, bp))) { 403 error = xfs_bwrite(bp);
400 continue; 404 xfs_buf_relse(bp);
401 } else { 405 if (error) {
402 xfs_warn(mp, 406 xfs_warn(mp,
403 "write error %d updating secondary superblock for ag %d", 407 "write error %d updating secondary superblock for ag %d",
404 error, agno); 408 error, agno);
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index f8fe1c66d420..7f237ba3c292 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -2597,11 +2597,11 @@ xfs_iflush(
2597 goto cluster_corrupt_out; 2597 goto cluster_corrupt_out;
2598 2598
2599 if (flags & SYNC_WAIT) 2599 if (flags & SYNC_WAIT)
2600 error = xfs_bwrite(mp, bp); 2600 error = xfs_bwrite(bp);
2601 else { 2601 else
2602 xfs_buf_delwri_queue(bp); 2602 xfs_buf_delwri_queue(bp);
2603 xfs_buf_relse(bp); 2603
2604 } 2604 xfs_buf_relse(bp);
2605 return error; 2605 return error;
2606 2606
2607corrupt_out: 2607corrupt_out:
diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c
index 22946949bf5e..be173852b2ca 100644
--- a/fs/xfs/xfs_log_recover.c
+++ b/fs/xfs/xfs_log_recover.c
@@ -268,9 +268,12 @@ xlog_bwrite(
268 xfs_buf_lock(bp); 268 xfs_buf_lock(bp);
269 XFS_BUF_SET_COUNT(bp, BBTOB(nbblks)); 269 XFS_BUF_SET_COUNT(bp, BBTOB(nbblks));
270 270
271 if ((error = xfs_bwrite(log->l_mp, bp))) 271 error = xfs_bwrite(bp);
272 if (error) {
272 xfs_ioerror_alert("xlog_bwrite", log->l_mp, 273 xfs_ioerror_alert("xlog_bwrite", log->l_mp,
273 bp, XFS_BUF_ADDR(bp)); 274 bp, XFS_BUF_ADDR(bp));
275 }
276 xfs_buf_relse(bp);
274 return error; 277 return error;
275} 278}
276 279
@@ -2172,15 +2175,15 @@ xlog_recover_buffer_pass2(
2172 (XFS_BUF_COUNT(bp) != MAX(log->l_mp->m_sb.sb_blocksize, 2175 (XFS_BUF_COUNT(bp) != MAX(log->l_mp->m_sb.sb_blocksize,
2173 (__uint32_t)XFS_INODE_CLUSTER_SIZE(log->l_mp)))) { 2176 (__uint32_t)XFS_INODE_CLUSTER_SIZE(log->l_mp)))) {
2174 XFS_BUF_STALE(bp); 2177 XFS_BUF_STALE(bp);
2175 error = xfs_bwrite(mp, bp); 2178 error = xfs_bwrite(bp);
2176 } else { 2179 } else {
2177 ASSERT(bp->b_target->bt_mount == mp); 2180 ASSERT(bp->b_target->bt_mount == mp);
2178 bp->b_iodone = xlog_recover_iodone; 2181 bp->b_iodone = xlog_recover_iodone;
2179 xfs_buf_delwri_queue(bp); 2182 xfs_buf_delwri_queue(bp);
2180 xfs_buf_relse(bp);
2181 } 2183 }
2182 2184
2183 return (error); 2185 xfs_buf_relse(bp);
2186 return error;
2184} 2187}
2185 2188
2186STATIC int 2189STATIC int
diff --git a/fs/xfs/xfs_sync.c b/fs/xfs/xfs_sync.c
index 4604f90f86a3..90cc197e0433 100644
--- a/fs/xfs/xfs_sync.c
+++ b/fs/xfs/xfs_sync.c
@@ -322,6 +322,7 @@ xfs_sync_fsdata(
322 struct xfs_mount *mp) 322 struct xfs_mount *mp)
323{ 323{
324 struct xfs_buf *bp; 324 struct xfs_buf *bp;
325 int error;
325 326
326 /* 327 /*
327 * If the buffer is pinned then push on the log so we won't get stuck 328 * If the buffer is pinned then push on the log so we won't get stuck
@@ -334,8 +335,9 @@ xfs_sync_fsdata(
334 bp = xfs_getsb(mp, 0); 335 bp = xfs_getsb(mp, 0);
335 if (xfs_buf_ispinned(bp)) 336 if (xfs_buf_ispinned(bp))
336 xfs_log_force(mp, 0); 337 xfs_log_force(mp, 0);
337 338 error = xfs_bwrite(bp);
338 return xfs_bwrite(mp, bp); 339 xfs_buf_relse(bp);
340 return error;
339} 341}
340 342
341/* 343/*