summaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_buf.h
diff options
context:
space:
mode:
authorDave Chinner <dchinner@redhat.com>2012-11-12 22:54:01 +1100
committerBen Myers <bpm@sgi.com>2012-11-15 21:34:02 -0600
commitc3f8fc73ac97b76a12692088ef9cace9af8422c0 (patch)
treea90e132507842b7ed8c5d93e0c002e0dc0f99a5c /fs/xfs/xfs_buf.h
parentfb59581404ab7ec5075299065c22cb211a9262a9 (diff)
downloadlinux-c3f8fc73ac97b76a12692088ef9cace9af8422c0.tar.gz
linux-c3f8fc73ac97b76a12692088ef9cace9af8422c0.tar.bz2
linux-c3f8fc73ac97b76a12692088ef9cace9af8422c0.zip
xfs: make buffer read verication an IO completion function
Add a verifier function callback capability to the buffer read interfaces. This will be used by the callers to supply a function that verifies the contents of the buffer when it is read from disk. This patch does not provide callback functions, but simply modifies the interfaces to allow them to be called. The reason for adding this to the read interfaces is that it is very difficult to tell fom the outside is a buffer was just read from disk or whether we just pulled it out of cache. Supplying a callbck allows the buffer cache to use it's internal knowledge of the buffer to execute it only when the buffer is read from disk. It is intended that the verifier functions will mark the buffer with an EFSCORRUPTED error when verification fails. This allows the reading context to distinguish a verification error from an IO error, and potentially take further actions on the buffer (e.g. attempt repair) based on the error reported. Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Phil White <pwhite@sgi.com> Signed-off-by: Ben Myers <bpm@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_buf.h')
-rw-r--r--fs/xfs/xfs_buf.h20
1 files changed, 12 insertions, 8 deletions
diff --git a/fs/xfs/xfs_buf.h b/fs/xfs/xfs_buf.h
index 7c0b6a0a1557..677b1dc822f4 100644
--- a/fs/xfs/xfs_buf.h
+++ b/fs/xfs/xfs_buf.h
@@ -100,6 +100,7 @@ typedef struct xfs_buftarg {
struct xfs_buf;
typedef void (*xfs_buf_iodone_t)(struct xfs_buf *);
+
#define XB_PAGES 2
struct xfs_buf_map {
@@ -159,7 +160,6 @@ typedef struct xfs_buf {
#endif
} xfs_buf_t;
-
/* Finding and Reading Buffers */
struct xfs_buf *_xfs_buf_find(struct xfs_buftarg *target,
struct xfs_buf_map *map, int nmaps,
@@ -196,9 +196,10 @@ struct xfs_buf *xfs_buf_get_map(struct xfs_buftarg *target,
xfs_buf_flags_t flags);
struct xfs_buf *xfs_buf_read_map(struct xfs_buftarg *target,
struct xfs_buf_map *map, int nmaps,
- xfs_buf_flags_t flags);
+ xfs_buf_flags_t flags, xfs_buf_iodone_t verify);
void xfs_buf_readahead_map(struct xfs_buftarg *target,
- struct xfs_buf_map *map, int nmaps);
+ struct xfs_buf_map *map, int nmaps,
+ xfs_buf_iodone_t verify);
static inline struct xfs_buf *
xfs_buf_get(
@@ -216,20 +217,22 @@ xfs_buf_read(
struct xfs_buftarg *target,
xfs_daddr_t blkno,
size_t numblks,
- xfs_buf_flags_t flags)
+ xfs_buf_flags_t flags,
+ xfs_buf_iodone_t verify)
{
DEFINE_SINGLE_BUF_MAP(map, blkno, numblks);
- return xfs_buf_read_map(target, &map, 1, flags);
+ return xfs_buf_read_map(target, &map, 1, flags, verify);
}
static inline void
xfs_buf_readahead(
struct xfs_buftarg *target,
xfs_daddr_t blkno,
- size_t numblks)
+ size_t numblks,
+ xfs_buf_iodone_t verify)
{
DEFINE_SINGLE_BUF_MAP(map, blkno, numblks);
- return xfs_buf_readahead_map(target, &map, 1);
+ return xfs_buf_readahead_map(target, &map, 1, verify);
}
struct xfs_buf *xfs_buf_get_empty(struct xfs_buftarg *target, size_t numblks);
@@ -239,7 +242,8 @@ int xfs_buf_associate_memory(struct xfs_buf *bp, void *mem, size_t length);
struct xfs_buf *xfs_buf_get_uncached(struct xfs_buftarg *target, size_t numblks,
int flags);
struct xfs_buf *xfs_buf_read_uncached(struct xfs_buftarg *target,
- xfs_daddr_t daddr, size_t numblks, int flags);
+ xfs_daddr_t daddr, size_t numblks, int flags,
+ xfs_buf_iodone_t verify);
void xfs_buf_hold(struct xfs_buf *bp);
/* Releasing Buffers */