diff options
author | Christoph Hellwig <hch@infradead.org> | 2010-01-13 17:17:58 -0500 |
---|---|---|
committer | Alex Elder <aelder@sgi.com> | 2010-01-15 16:35:07 -0500 |
commit | 64e0bc7d2a6609ad265757a600e2a0d93c8adb47 (patch) | |
tree | 15733d61868f4dbd59da833cd84614ff78ef1049 /fs | |
parent | 873ff5501d8cd1a21045d6c1da34f0c3876bc235 (diff) |
xfs: clean up xfs_bwrite
Fold XFS_bwrite into it's only caller, xfs_bwrite and move it into
xfs_buf.c instead of leaving it as a fairly large inline function.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Alex Elder <aelder@sgi.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/xfs/linux-2.6/xfs_buf.c | 27 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/xfs_buf.h | 19 | ||||
-rw-r--r-- | fs/xfs/xfs_rw.c | 31 | ||||
-rw-r--r-- | fs/xfs/xfs_rw.h | 1 |
4 files changed, 28 insertions, 50 deletions
diff --git a/fs/xfs/linux-2.6/xfs_buf.c b/fs/xfs/linux-2.6/xfs_buf.c index 18ae3ba8f78a..492465c6e0b4 100644 --- a/fs/xfs/linux-2.6/xfs_buf.c +++ b/fs/xfs/linux-2.6/xfs_buf.c | |||
@@ -1051,6 +1051,33 @@ xfs_buf_ioerror( | |||
1051 | } | 1051 | } |
1052 | 1052 | ||
1053 | int | 1053 | int |
1054 | xfs_bwrite( | ||
1055 | struct xfs_mount *mp, | ||
1056 | struct xfs_buf *bp) | ||
1057 | { | ||
1058 | int iowait = (bp->b_flags & XBF_ASYNC) == 0; | ||
1059 | int error = 0; | ||
1060 | |||
1061 | bp->b_strat = xfs_bdstrat_cb; | ||
1062 | bp->b_mount = mp; | ||
1063 | bp->b_flags |= XBF_WRITE; | ||
1064 | if (!iowait) | ||
1065 | bp->b_flags |= _XBF_RUN_QUEUES; | ||
1066 | |||
1067 | xfs_buf_delwri_dequeue(bp); | ||
1068 | xfs_buf_iostrategy(bp); | ||
1069 | |||
1070 | if (iowait) { | ||
1071 | error = xfs_buf_iowait(bp); | ||
1072 | if (error) | ||
1073 | xfs_force_shutdown(mp, SHUTDOWN_META_IO_ERROR); | ||
1074 | xfs_buf_relse(bp); | ||
1075 | } | ||
1076 | |||
1077 | return error; | ||
1078 | } | ||
1079 | |||
1080 | int | ||
1054 | xfs_bawrite( | 1081 | xfs_bawrite( |
1055 | void *mp, | 1082 | void *mp, |
1056 | struct xfs_buf *bp) | 1083 | struct xfs_buf *bp) |
diff --git a/fs/xfs/linux-2.6/xfs_buf.h b/fs/xfs/linux-2.6/xfs_buf.h index c20a76001867..f69b8e714a11 100644 --- a/fs/xfs/linux-2.6/xfs_buf.h +++ b/fs/xfs/linux-2.6/xfs_buf.h | |||
@@ -232,6 +232,7 @@ extern void xfs_buf_lock(xfs_buf_t *); | |||
232 | extern void xfs_buf_unlock(xfs_buf_t *); | 232 | extern void xfs_buf_unlock(xfs_buf_t *); |
233 | 233 | ||
234 | /* Buffer Read and Write Routines */ | 234 | /* Buffer Read and Write Routines */ |
235 | extern int xfs_bwrite(struct xfs_mount *mp, struct xfs_buf *bp); | ||
235 | extern int xfs_bawrite(void *mp, xfs_buf_t *bp); | 236 | extern int xfs_bawrite(void *mp, xfs_buf_t *bp); |
236 | extern void xfs_bdwrite(void *mp, xfs_buf_t *bp); | 237 | extern void xfs_bdwrite(void *mp, xfs_buf_t *bp); |
237 | extern void xfs_buf_ioend(xfs_buf_t *, int); | 238 | extern void xfs_buf_ioend(xfs_buf_t *, int); |
@@ -390,24 +391,6 @@ static inline void xfs_buf_relse(xfs_buf_t *bp) | |||
390 | #define xfs_biozero(bp, off, len) \ | 391 | #define xfs_biozero(bp, off, len) \ |
391 | xfs_buf_iomove((bp), (off), (len), NULL, XBRW_ZERO) | 392 | xfs_buf_iomove((bp), (off), (len), NULL, XBRW_ZERO) |
392 | 393 | ||
393 | |||
394 | static inline int XFS_bwrite(xfs_buf_t *bp) | ||
395 | { | ||
396 | int iowait = (bp->b_flags & XBF_ASYNC) == 0; | ||
397 | int error = 0; | ||
398 | |||
399 | if (!iowait) | ||
400 | bp->b_flags |= _XBF_RUN_QUEUES; | ||
401 | |||
402 | xfs_buf_delwri_dequeue(bp); | ||
403 | xfs_buf_iostrategy(bp); | ||
404 | if (iowait) { | ||
405 | error = xfs_buf_iowait(bp); | ||
406 | xfs_buf_relse(bp); | ||
407 | } | ||
408 | return error; | ||
409 | } | ||
410 | |||
411 | #define xfs_iowait(bp) xfs_buf_iowait(bp) | 394 | #define xfs_iowait(bp) xfs_buf_iowait(bp) |
412 | 395 | ||
413 | #define xfs_baread(target, rablkno, ralen) \ | 396 | #define xfs_baread(target, rablkno, ralen) \ |
diff --git a/fs/xfs/xfs_rw.c b/fs/xfs/xfs_rw.c index 5aa07caea5f1..9d933a10d6bb 100644 --- a/fs/xfs/xfs_rw.c +++ b/fs/xfs/xfs_rw.c | |||
@@ -306,37 +306,6 @@ xfs_read_buf( | |||
306 | } | 306 | } |
307 | 307 | ||
308 | /* | 308 | /* |
309 | * Wrapper around bwrite() so that we can trap | ||
310 | * write errors, and act accordingly. | ||
311 | */ | ||
312 | int | ||
313 | xfs_bwrite( | ||
314 | struct xfs_mount *mp, | ||
315 | struct xfs_buf *bp) | ||
316 | { | ||
317 | int error; | ||
318 | |||
319 | /* | ||
320 | * XXXsup how does this work for quotas. | ||
321 | */ | ||
322 | XFS_BUF_SET_BDSTRAT_FUNC(bp, xfs_bdstrat_cb); | ||
323 | bp->b_mount = mp; | ||
324 | XFS_BUF_WRITE(bp); | ||
325 | |||
326 | if ((error = XFS_bwrite(bp))) { | ||
327 | ASSERT(mp); | ||
328 | /* | ||
329 | * Cannot put a buftrace here since if the buffer is not | ||
330 | * B_HOLD then we will brelse() the buffer before returning | ||
331 | * from bwrite and we could be tracing a buffer that has | ||
332 | * been reused. | ||
333 | */ | ||
334 | xfs_force_shutdown(mp, SHUTDOWN_META_IO_ERROR); | ||
335 | } | ||
336 | return (error); | ||
337 | } | ||
338 | |||
339 | /* | ||
340 | * helper function to extract extent size hint from inode | 309 | * helper function to extract extent size hint from inode |
341 | */ | 310 | */ |
342 | xfs_extlen_t | 311 | xfs_extlen_t |
diff --git a/fs/xfs/xfs_rw.h b/fs/xfs/xfs_rw.h index 571f2174435c..ff68eb5e738e 100644 --- a/fs/xfs/xfs_rw.h +++ b/fs/xfs/xfs_rw.h | |||
@@ -40,7 +40,6 @@ xfs_fsb_to_db(struct xfs_inode *ip, xfs_fsblock_t fsb) | |||
40 | * Prototypes for functions in xfs_rw.c. | 40 | * Prototypes for functions in xfs_rw.c. |
41 | */ | 41 | */ |
42 | extern int xfs_write_clear_setuid(struct xfs_inode *ip); | 42 | extern int xfs_write_clear_setuid(struct xfs_inode *ip); |
43 | extern int xfs_bwrite(struct xfs_mount *mp, struct xfs_buf *bp); | ||
44 | extern int xfs_bioerror(struct xfs_buf *bp); | 43 | extern int xfs_bioerror(struct xfs_buf *bp); |
45 | extern int xfs_bioerror_relse(struct xfs_buf *bp); | 44 | extern int xfs_bioerror_relse(struct xfs_buf *bp); |
46 | extern int xfs_read_buf(struct xfs_mount *mp, xfs_buftarg_t *btp, | 45 | extern int xfs_read_buf(struct xfs_mount *mp, xfs_buftarg_t *btp, |