diff options
| -rw-r--r-- | fs/xfs/xfs_buf.c | 51 | ||||
| -rw-r--r-- | fs/xfs/xfs_buf.h | 1 | ||||
| -rw-r--r-- | fs/xfs/xfs_buf_item.c | 2 |
3 files changed, 23 insertions, 31 deletions
diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c index 687b275f165c..269b35c084da 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 | ||
| 992 | int | ||
| 993 | xfs_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 | 1061 | STATIC 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 | */ | ||
| 1089 | int | ||
| 1090 | xfs_bdstrat_cb( | 1062 | xfs_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 | ||
| 1082 | int | ||
| 1083 | xfs_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 7f1d1392ce37..79344c48008e 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 *); | |||
| 180 | extern int xfs_bwrite(struct xfs_buf *bp); | 180 | extern int xfs_bwrite(struct xfs_buf *bp); |
| 181 | 181 | ||
| 182 | extern void xfsbdstrat(struct xfs_mount *, struct xfs_buf *); | 182 | extern void xfsbdstrat(struct xfs_mount *, struct xfs_buf *); |
| 183 | extern int xfs_bdstrat_cb(struct xfs_buf *); | ||
| 184 | 183 | ||
| 185 | extern void xfs_buf_ioend(xfs_buf_t *, int); | 184 | extern void xfs_buf_ioend(xfs_buf_t *, int); |
| 186 | extern void xfs_buf_ioerror(xfs_buf_t *, int); | 185 | extern 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 45df2b857d48..d9e451115f98 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 | } |
