aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/xfs/linux-2.6/xfs_buf.h2
-rw-r--r--fs/xfs/xfs_log.c67
2 files changed, 33 insertions, 36 deletions
diff --git a/fs/xfs/linux-2.6/xfs_buf.h b/fs/xfs/linux-2.6/xfs_buf.h
index a34c7b54822d..c20a76001867 100644
--- a/fs/xfs/linux-2.6/xfs_buf.h
+++ b/fs/xfs/linux-2.6/xfs_buf.h
@@ -408,8 +408,6 @@ static inline int XFS_bwrite(xfs_buf_t *bp)
408 return error; 408 return error;
409} 409}
410 410
411#define XFS_bdstrat(bp) xfs_buf_iorequest(bp)
412
413#define xfs_iowait(bp) xfs_buf_iowait(bp) 411#define xfs_iowait(bp) xfs_buf_iowait(bp)
414 412
415#define xfs_baread(target, rablkno, ralen) \ 413#define xfs_baread(target, rablkno, ralen) \
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
index 600b5b06aaeb..0d17516fbb13 100644
--- a/fs/xfs/xfs_log.c
+++ b/fs/xfs/xfs_log.c
@@ -50,7 +50,6 @@ kmem_zone_t *xfs_log_ticket_zone;
50 (off) += (bytes);} 50 (off) += (bytes);}
51 51
52/* Local miscellaneous function prototypes */ 52/* Local miscellaneous function prototypes */
53STATIC int xlog_bdstrat_cb(struct xfs_buf *);
54STATIC int xlog_commit_record(xfs_mount_t *mp, xlog_ticket_t *ticket, 53STATIC int xlog_commit_record(xfs_mount_t *mp, xlog_ticket_t *ticket,
55 xlog_in_core_t **, xfs_lsn_t *); 54 xlog_in_core_t **, xfs_lsn_t *);
56STATIC xlog_t * xlog_alloc_log(xfs_mount_t *mp, 55STATIC xlog_t * xlog_alloc_log(xfs_mount_t *mp,
@@ -988,35 +987,6 @@ xlog_iodone(xfs_buf_t *bp)
988} /* xlog_iodone */ 987} /* xlog_iodone */
989 988
990/* 989/*
991 * The bdstrat callback function for log bufs. This gives us a central
992 * place to trap bufs in case we get hit by a log I/O error and need to
993 * shutdown. Actually, in practice, even when we didn't get a log error,
994 * we transition the iclogs to IOERROR state *after* flushing all existing
995 * iclogs to disk. This is because we don't want anymore new transactions to be
996 * started or completed afterwards.
997 */
998STATIC int
999xlog_bdstrat_cb(struct xfs_buf *bp)
1000{
1001 xlog_in_core_t *iclog;
1002
1003 iclog = XFS_BUF_FSPRIVATE(bp, xlog_in_core_t *);
1004
1005 if ((iclog->ic_state & XLOG_STATE_IOERROR) == 0) {
1006 /* note for irix bstrat will need struct bdevsw passed
1007 * Fix the following macro if the code ever is merged
1008 */
1009 XFS_bdstrat(bp);
1010 return 0;
1011 }
1012
1013 XFS_BUF_ERROR(bp, EIO);
1014 XFS_BUF_STALE(bp);
1015 xfs_biodone(bp);
1016 return XFS_ERROR(EIO);
1017}
1018
1019/*
1020 * Return size of each in-core log record buffer. 990 * Return size of each in-core log record buffer.
1021 * 991 *
1022 * All machines get 8 x 32kB buffers by default, unless tuned otherwise. 992 * All machines get 8 x 32kB buffers by default, unless tuned otherwise.
@@ -1158,7 +1128,6 @@ xlog_alloc_log(xfs_mount_t *mp,
1158 if (!bp) 1128 if (!bp)
1159 goto out_free_log; 1129 goto out_free_log;
1160 XFS_BUF_SET_IODONE_FUNC(bp, xlog_iodone); 1130 XFS_BUF_SET_IODONE_FUNC(bp, xlog_iodone);
1161 XFS_BUF_SET_BDSTRAT_FUNC(bp, xlog_bdstrat_cb);
1162 XFS_BUF_SET_FSPRIVATE2(bp, (unsigned long)1); 1131 XFS_BUF_SET_FSPRIVATE2(bp, (unsigned long)1);
1163 ASSERT(XFS_BUF_ISBUSY(bp)); 1132 ASSERT(XFS_BUF_ISBUSY(bp));
1164 ASSERT(XFS_BUF_VALUSEMA(bp) <= 0); 1133 ASSERT(XFS_BUF_VALUSEMA(bp) <= 0);
@@ -1196,7 +1165,6 @@ xlog_alloc_log(xfs_mount_t *mp,
1196 if (!XFS_BUF_CPSEMA(bp)) 1165 if (!XFS_BUF_CPSEMA(bp))
1197 ASSERT(0); 1166 ASSERT(0);
1198 XFS_BUF_SET_IODONE_FUNC(bp, xlog_iodone); 1167 XFS_BUF_SET_IODONE_FUNC(bp, xlog_iodone);
1199 XFS_BUF_SET_BDSTRAT_FUNC(bp, xlog_bdstrat_cb);
1200 XFS_BUF_SET_FSPRIVATE2(bp, (unsigned long)1); 1168 XFS_BUF_SET_FSPRIVATE2(bp, (unsigned long)1);
1201 iclog->ic_bp = bp; 1169 iclog->ic_bp = bp;
1202 iclog->ic_data = bp->b_addr; 1170 iclog->ic_data = bp->b_addr;
@@ -1343,6 +1311,37 @@ xlog_grant_push_ail(xfs_mount_t *mp,
1343 xfs_trans_ail_push(log->l_ailp, threshold_lsn); 1311 xfs_trans_ail_push(log->l_ailp, threshold_lsn);
1344} /* xlog_grant_push_ail */ 1312} /* xlog_grant_push_ail */
1345 1313
1314/*
1315 * The bdstrat callback function for log bufs. This gives us a central
1316 * place to trap bufs in case we get hit by a log I/O error and need to
1317 * shutdown. Actually, in practice, even when we didn't get a log error,
1318 * we transition the iclogs to IOERROR state *after* flushing all existing
1319 * iclogs to disk. This is because we don't want anymore new transactions to be
1320 * started or completed afterwards.
1321 */
1322STATIC int
1323xlog_bdstrat(
1324 struct xfs_buf *bp)
1325{
1326 struct xlog_in_core *iclog;
1327
1328 iclog = XFS_BUF_FSPRIVATE(bp, xlog_in_core_t *);
1329 if (iclog->ic_state & XLOG_STATE_IOERROR) {
1330 XFS_BUF_ERROR(bp, EIO);
1331 XFS_BUF_STALE(bp);
1332 xfs_biodone(bp);
1333 /*
1334 * It would seem logical to return EIO here, but we rely on
1335 * the log state machine to propagate I/O errors instead of
1336 * doing it here.
1337 */
1338 return 0;
1339 }
1340
1341 bp->b_flags |= _XBF_RUN_QUEUES;
1342 xfs_buf_iorequest(bp);
1343 return 0;
1344}
1346 1345
1347/* 1346/*
1348 * Flush out the in-core log (iclog) to the on-disk log in an asynchronous 1347 * Flush out the in-core log (iclog) to the on-disk log in an asynchronous
@@ -1462,7 +1461,7 @@ xlog_sync(xlog_t *log,
1462 */ 1461 */
1463 XFS_BUF_WRITE(bp); 1462 XFS_BUF_WRITE(bp);
1464 1463
1465 if ((error = XFS_bwrite(bp))) { 1464 if ((error = xlog_bdstrat(bp))) {
1466 xfs_ioerror_alert("xlog_sync", log->l_mp, bp, 1465 xfs_ioerror_alert("xlog_sync", log->l_mp, bp,
1467 XFS_BUF_ADDR(bp)); 1466 XFS_BUF_ADDR(bp));
1468 return error; 1467 return error;
@@ -1502,7 +1501,7 @@ xlog_sync(xlog_t *log,
1502 /* account for internal log which doesn't start at block #0 */ 1501 /* account for internal log which doesn't start at block #0 */
1503 XFS_BUF_SET_ADDR(bp, XFS_BUF_ADDR(bp) + log->l_logBBstart); 1502 XFS_BUF_SET_ADDR(bp, XFS_BUF_ADDR(bp) + log->l_logBBstart);
1504 XFS_BUF_WRITE(bp); 1503 XFS_BUF_WRITE(bp);
1505 if ((error = XFS_bwrite(bp))) { 1504 if ((error = xlog_bdstrat(bp))) {
1506 xfs_ioerror_alert("xlog_sync (split)", log->l_mp, 1505 xfs_ioerror_alert("xlog_sync (split)", log->l_mp,
1507 bp, XFS_BUF_ADDR(bp)); 1506 bp, XFS_BUF_ADDR(bp));
1508 return error; 1507 return error;