aboutsummaryrefslogtreecommitdiffstats
path: root/fs
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 14:09:49 -0400
commit1632dcc93f55f9ab407b373da1957a727b1a7fe3 (patch)
tree2a8b603f5fe9dcb6aff195a7d5999397db905f6c /fs
parent40a9b7963df32e743c45d79a5f41445fe2476f15 (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')
-rw-r--r--fs/xfs/xfs_buf.c51
-rw-r--r--fs/xfs/xfs_buf.h1
-rw-r--r--fs/xfs/xfs_buf_item.c2
3 files changed, 23 insertions, 31 deletions
diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c
index 687b275f165..269b35c084d 100644
--- a/fs/xfs/xfs_buf.c
+++ b/fs/xfs/xfs_buf.c
@@ -989,27 +989,6 @@ xfs_buf_ioerror_alert(
989 (__uint64_t)XFS_BUF_ADDR(bp), func, bp->b_error, bp->b_length); 989 (__uint64_t)XFS_BUF_ADDR(bp), func, bp->b_error, bp->b_length);
990} 990}
991 991
992int
993xfs_bwrite(
994 struct xfs_buf *bp)
995{
996 int error;
997
998 ASSERT(xfs_buf_islocked(bp));
999
1000 bp->b_flags |= XBF_WRITE;
1001 bp->b_flags &= ~(XBF_ASYNC | XBF_READ | _XBF_DELWRI_Q);
1002
1003 xfs_bdstrat_cb(bp);
1004
1005 error = xfs_buf_iowait(bp);
1006 if (error) {
1007 xfs_force_shutdown(bp->b_target->bt_mount,
1008 SHUTDOWN_META_IO_ERROR);
1009 }
1010 return error;
1011}
1012
1013/* 992/*
1014 * Called when we want to stop a buffer from getting written or read. 993 * Called when we want to stop a buffer from getting written or read.
1015 * We attach the EIO error, muck with its flags, and call xfs_buf_ioend 994 * We attach the EIO error, muck with its flags, and call xfs_buf_ioend
@@ -1079,14 +1058,7 @@ xfs_bioerror_relse(
1079 return EIO; 1058 return EIO;
1080} 1059}
1081 1060
1082 1061STATIC int
1083/*
1084 * All xfs metadata buffers except log state machine buffers
1085 * get this attached as their b_bdstrat callback function.
1086 * This is so that we can catch a buffer
1087 * after prematurely unpinning it to forcibly shutdown the filesystem.
1088 */
1089int
1090xfs_bdstrat_cb( 1062xfs_bdstrat_cb(
1091 struct xfs_buf *bp) 1063 struct xfs_buf *bp)
1092{ 1064{
@@ -1107,6 +1079,27 @@ xfs_bdstrat_cb(
1107 return 0; 1079 return 0;
1108} 1080}
1109 1081
1082int
1083xfs_bwrite(
1084 struct xfs_buf *bp)
1085{
1086 int error;
1087
1088 ASSERT(xfs_buf_islocked(bp));
1089
1090 bp->b_flags |= XBF_WRITE;
1091 bp->b_flags &= ~(XBF_ASYNC | XBF_READ | _XBF_DELWRI_Q);
1092
1093 xfs_bdstrat_cb(bp);
1094
1095 error = xfs_buf_iowait(bp);
1096 if (error) {
1097 xfs_force_shutdown(bp->b_target->bt_mount,
1098 SHUTDOWN_META_IO_ERROR);
1099 }
1100 return error;
1101}
1102
1110/* 1103/*
1111 * Wrapper around bdstrat so that we can stop data from going to disk in case 1104 * Wrapper around bdstrat so that we can stop data from going to disk in case
1112 * we are shutting down the filesystem. Typically user data goes thru this 1105 * we are shutting down the filesystem. Typically user data goes thru this
diff --git a/fs/xfs/xfs_buf.h b/fs/xfs/xfs_buf.h
index 7f1d1392ce3..79344c48008 100644
--- a/fs/xfs/xfs_buf.h
+++ b/fs/xfs/xfs_buf.h
@@ -180,7 +180,6 @@ extern void xfs_buf_unlock(xfs_buf_t *);
180extern int xfs_bwrite(struct xfs_buf *bp); 180extern int xfs_bwrite(struct xfs_buf *bp);
181 181
182extern void xfsbdstrat(struct xfs_mount *, struct xfs_buf *); 182extern void xfsbdstrat(struct xfs_mount *, struct xfs_buf *);
183extern int xfs_bdstrat_cb(struct xfs_buf *);
184 183
185extern void xfs_buf_ioend(xfs_buf_t *, int); 184extern void xfs_buf_ioend(xfs_buf_t *, int);
186extern void xfs_buf_ioerror(xfs_buf_t *, int); 185extern void xfs_buf_ioerror(xfs_buf_t *, int);
diff --git a/fs/xfs/xfs_buf_item.c b/fs/xfs/xfs_buf_item.c
index 45df2b857d4..d9e451115f9 100644
--- a/fs/xfs/xfs_buf_item.c
+++ b/fs/xfs/xfs_buf_item.c
@@ -954,7 +954,7 @@ xfs_buf_iodone_callbacks(
954 954
955 if (!XFS_BUF_ISSTALE(bp)) { 955 if (!XFS_BUF_ISSTALE(bp)) {
956 bp->b_flags |= XBF_WRITE | XBF_ASYNC | XBF_DONE; 956 bp->b_flags |= XBF_WRITE | XBF_ASYNC | XBF_DONE;
957 xfs_bdstrat_cb(bp); 957 xfs_buf_iorequest(bp);
958 } else { 958 } else {
959 xfs_buf_relse(bp); 959 xfs_buf_relse(bp);
960 } 960 }