diff options
Diffstat (limited to 'fs/xfs/xfs_buf.c')
| -rw-r--r-- | fs/xfs/xfs_buf.c | 53 |
1 files changed, 23 insertions, 30 deletions
diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c index a4beb421018a..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 |
| @@ -1243,7 +1236,7 @@ xfs_buf_iorequest( | |||
| 1243 | */ | 1236 | */ |
| 1244 | atomic_set(&bp->b_io_remaining, 1); | 1237 | atomic_set(&bp->b_io_remaining, 1); |
| 1245 | _xfs_buf_ioapply(bp); | 1238 | _xfs_buf_ioapply(bp); |
| 1246 | _xfs_buf_ioend(bp, 0); | 1239 | _xfs_buf_ioend(bp, 1); |
| 1247 | 1240 | ||
| 1248 | xfs_buf_rele(bp); | 1241 | xfs_buf_rele(bp); |
| 1249 | } | 1242 | } |
