Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 339437
b: refs/heads/master
c: cfb0285
h: refs/heads/master
i:
  339435: e5cc1e7
v: v3
  • Loading branch information
Dave Chinner authored and Ben Myers committed Nov 16, 2012
1 parent 0a4d67d commit 070408e
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: da6958c873ecd846d71fafbfe0f6168bb9c2c99e
refs/heads/master: cfb02852226aa449fe27075caffe88726507668c
16 changes: 16 additions & 0 deletions trunk/fs/xfs/xfs_buf.c
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,9 @@ _xfs_buf_find(
*/
if (bp->b_flags & XBF_STALE) {
ASSERT((bp->b_flags & _XBF_DELWRI_Q) == 0);
ASSERT(bp->b_iodone == NULL);
bp->b_flags &= _XBF_KMEM | _XBF_PAGES;
bp->b_pre_io = NULL;
}

trace_xfs_buf_find(bp, flags, _RET_IP_);
Expand Down Expand Up @@ -1323,6 +1325,20 @@ _xfs_buf_ioapply(
/* we only use the buffer cache for meta-data */
rw |= REQ_META;

/*
* run the pre-io callback function if it exists. If this function
* fails it will mark the buffer with an error and the IO should
* not be dispatched.
*/
if (bp->b_pre_io) {
bp->b_pre_io(bp);
if (bp->b_error) {
xfs_force_shutdown(bp->b_target->bt_mount,
SHUTDOWN_CORRUPT_INCORE);
return;
}
}

/*
* Walk all the vectors issuing IO on them. Set up the initial offset
* into the buffer and the desired IO size before we start -
Expand Down
3 changes: 3 additions & 0 deletions trunk/fs/xfs/xfs_buf.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,9 @@ typedef struct xfs_buf {
unsigned int b_offset; /* page offset in first page */
unsigned short b_error; /* error code on I/O */

void (*b_pre_io)(struct xfs_buf *);
/* pre-io callback function */

#ifdef XFS_BUF_LOCK_TRACKING
int b_last_holder;
#endif
Expand Down

0 comments on commit 070408e

Please sign in to comment.