aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/xfs/xfs_buf.c16
-rw-r--r--fs/xfs/xfs_buf.h3
2 files changed, 19 insertions, 0 deletions
diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c
index fbc965fc075a..bd1a948ee39c 100644
--- a/fs/xfs/xfs_buf.c
+++ b/fs/xfs/xfs_buf.c
@@ -569,7 +569,9 @@ found:
569 */ 569 */
570 if (bp->b_flags & XBF_STALE) { 570 if (bp->b_flags & XBF_STALE) {
571 ASSERT((bp->b_flags & _XBF_DELWRI_Q) == 0); 571 ASSERT((bp->b_flags & _XBF_DELWRI_Q) == 0);
572 ASSERT(bp->b_iodone == NULL);
572 bp->b_flags &= _XBF_KMEM | _XBF_PAGES; 573 bp->b_flags &= _XBF_KMEM | _XBF_PAGES;
574 bp->b_pre_io = NULL;
573 } 575 }
574 576
575 trace_xfs_buf_find(bp, flags, _RET_IP_); 577 trace_xfs_buf_find(bp, flags, _RET_IP_);
@@ -1324,6 +1326,20 @@ _xfs_buf_ioapply(
1324 rw |= REQ_META; 1326 rw |= REQ_META;
1325 1327
1326 /* 1328 /*
1329 * run the pre-io callback function if it exists. If this function
1330 * fails it will mark the buffer with an error and the IO should
1331 * not be dispatched.
1332 */
1333 if (bp->b_pre_io) {
1334 bp->b_pre_io(bp);
1335 if (bp->b_error) {
1336 xfs_force_shutdown(bp->b_target->bt_mount,
1337 SHUTDOWN_CORRUPT_INCORE);
1338 return;
1339 }
1340 }
1341
1342 /*
1327 * Walk all the vectors issuing IO on them. Set up the initial offset 1343 * Walk all the vectors issuing IO on them. Set up the initial offset
1328 * into the buffer and the desired IO size before we start - 1344 * into the buffer and the desired IO size before we start -
1329 * _xfs_buf_ioapply_vec() will modify them appropriately for each 1345 * _xfs_buf_ioapply_vec() will modify them appropriately for each
diff --git a/fs/xfs/xfs_buf.h b/fs/xfs/xfs_buf.h
index 677b1dc822f4..51bc16a1cd9c 100644
--- a/fs/xfs/xfs_buf.h
+++ b/fs/xfs/xfs_buf.h
@@ -155,6 +155,9 @@ typedef struct xfs_buf {
155 unsigned int b_offset; /* page offset in first page */ 155 unsigned int b_offset; /* page offset in first page */
156 unsigned short b_error; /* error code on I/O */ 156 unsigned short b_error; /* error code on I/O */
157 157
158 void (*b_pre_io)(struct xfs_buf *);
159 /* pre-io callback function */
160
158#ifdef XFS_BUF_LOCK_TRACKING 161#ifdef XFS_BUF_LOCK_TRACKING
159 int b_last_holder; 162 int b_last_holder;
160#endif 163#endif