aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_buf.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2012-07-13 02:24:10 -0400
committerBen Myers <bpm@sgi.com>2012-07-13 13:50:54 -0400
commita2dcf5df5f3813a44423d4a5026666e751ec00dd (patch)
tree76ef63788a8e8c98824ef7cc7b70535d4c7b154f /fs/xfs/xfs_buf.c
parent08023d6dbe840dc4271805a9ea376fcbdee9f744 (diff)
xfs: do not call xfs_bdstrat_cb in xfs_buf_iodone_callbacks
xfs_bdstrat_cb only adds a check for a shutdown filesystem over xfs_buf_iorequest, but xfs_buf_iodone_callbacks just checked for a shut down filesystem a little earlier. In addition the shutdown handling in xfs_bdstrat_cb is not very suitable for this caller. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Ben Myers <bpm@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_buf.c')
-rw-r--r--fs/xfs/xfs_buf.c51
1 files changed, 22 insertions, 29 deletions
diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c
index d1edfa1a8112..d7a9dd735e1e 100644
--- a/fs/xfs/xfs_buf.c
+++ b/fs/xfs/xfs_buf.c
@@ -1049,27 +1049,6 @@ xfs_buf_ioerror_alert(
1049 (__uint64_t)XFS_BUF_ADDR(bp), func, bp->b_error, bp->b_length); 1049 (__uint64_t)XFS_BUF_ADDR(bp), func, bp->b_error, bp->b_length);
1050} 1050}
1051 1051
1052int
1053xfs_bwrite(
1054 struct xfs_buf *bp)
1055{
1056 int error;
1057
1058 ASSERT(xfs_buf_islocked(bp));
1059
1060 bp->b_flags |= XBF_WRITE;
1061 bp->b_flags &= ~(XBF_ASYNC | XBF_READ | _XBF_DELWRI_Q);
1062
1063 xfs_bdstrat_cb(bp);
1064
1065 error = xfs_buf_iowait(bp);
1066 if (error) {
1067 xfs_force_shutdown(bp->b_target->bt_mount,
1068 SHUTDOWN_META_IO_ERROR);
1069 }
1070 return error;
1071}
1072
1073/* 1052/*
1074 * Called when we want to stop a buffer from getting written or read. 1053 * Called when we want to stop a buffer from getting written or read.
1075 * We attach the EIO error, muck with its flags, and call xfs_buf_ioend 1054 * We attach the EIO error, muck with its flags, and call xfs_buf_ioend
@@ -1139,14 +1118,7 @@ xfs_bioerror_relse(
1139 return EIO; 1118 return EIO;
1140} 1119}
1141 1120
1142 1121STATIC int
1143/*
1144 * All xfs metadata buffers except log state machine buffers
1145 * get this attached as their b_bdstrat callback function.
1146 * This is so that we can catch a buffer
1147 * after prematurely unpinning it to forcibly shutdown the filesystem.
1148 */
1149int
1150xfs_bdstrat_cb( 1122xfs_bdstrat_cb(
1151 struct xfs_buf *bp) 1123 struct xfs_buf *bp)
1152{ 1124{
@@ -1167,6 +1139,27 @@ xfs_bdstrat_cb(
1167 return 0; 1139 return 0;
1168} 1140}
1169 1141
1142int
1143xfs_bwrite(
1144 struct xfs_buf *bp)
1145{
1146 int error;
1147
1148 ASSERT(xfs_buf_islocked(bp));
1149
1150 bp->b_flags |= XBF_WRITE;
1151 bp->b_flags &= ~(XBF_ASYNC | XBF_READ | _XBF_DELWRI_Q);
1152
1153 xfs_bdstrat_cb(bp);
1154
1155 error = xfs_buf_iowait(bp);
1156 if (error) {
1157 xfs_force_shutdown(bp->b_target->bt_mount,
1158 SHUTDOWN_META_IO_ERROR);
1159 }
1160 return error;
1161}
1162
1170/* 1163/*
1171 * Wrapper around bdstrat so that we can stop data from going to disk in case 1164 * Wrapper around bdstrat so that we can stop data from going to disk in case
1172 * we are shutting down the filesystem. Typically user data goes thru this 1165 * we are shutting down the filesystem. Typically user data goes thru this