aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_buf.h
diff options
context:
space:
mode:
authorDave Chinner <dchinner@redhat.com>2012-11-12 06:54:01 -0500
committerBen Myers <bpm@sgi.com>2012-11-15 22:34:02 -0500
commitc3f8fc73ac97b76a12692088ef9cace9af8422c0 (patch)
treea90e132507842b7ed8c5d93e0c002e0dc0f99a5c /fs/xfs/xfs_buf.h
parentfb59581404ab7ec5075299065c22cb211a9262a9 (diff)
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 {
100struct xfs_buf; 100struct xfs_buf;
101typedef void (*xfs_buf_iodone_t)(struct xfs_buf *); 101typedef void (*xfs_buf_iodone_t)(struct xfs_buf *);
102 102
103
103#define XB_PAGES 2 104#define XB_PAGES 2
104 105
105struct xfs_buf_map { 106struct xfs_buf_map {
@@ -159,7 +160,6 @@ typedef struct xfs_buf {
159#endif 160#endif
160} xfs_buf_t; 161} xfs_buf_t;
161 162
162
163/* Finding and Reading Buffers */ 163/* Finding and Reading Buffers */
164struct xfs_buf *_xfs_buf_find(struct xfs_buftarg *target, 164struct xfs_buf *_xfs_buf_find(struct xfs_buftarg *target,
165 struct xfs_buf_map *map, int nmaps, 165 struct xfs_buf_map *map, int nmaps,
@@ -196,9 +196,10 @@ struct xfs_buf *xfs_buf_get_map(struct xfs_buftarg *target,
196 xfs_buf_flags_t flags); 196 xfs_buf_flags_t flags);
197struct xfs_buf *xfs_buf_read_map(struct xfs_buftarg *target, 197struct xfs_buf *xfs_buf_read_map(struct xfs_buftarg *target,
198 struct xfs_buf_map *map, int nmaps, 198 struct xfs_buf_map *map, int nmaps,
199 xfs_buf_flags_t flags); 199 xfs_buf_flags_t flags, xfs_buf_iodone_t verify);
200void xfs_buf_readahead_map(struct xfs_buftarg *target, 200void xfs_buf_readahead_map(struct xfs_buftarg *target,
201 struct xfs_buf_map *map, int nmaps); 201 struct xfs_buf_map *map, int nmaps,
202 xfs_buf_iodone_t verify);
202 203
203static inline struct xfs_buf * 204static inline struct xfs_buf *
204xfs_buf_get( 205xfs_buf_get(
@@ -216,20 +217,22 @@ xfs_buf_read(
216 struct xfs_buftarg *target, 217 struct xfs_buftarg *target,
217 xfs_daddr_t blkno, 218 xfs_daddr_t blkno,
218 size_t numblks, 219 size_t numblks,
219 xfs_buf_flags_t flags) 220 xfs_buf_flags_t flags,
221 xfs_buf_iodone_t verify)
220{ 222{
221 DEFINE_SINGLE_BUF_MAP(map, blkno, numblks); 223 DEFINE_SINGLE_BUF_MAP(map, blkno, numblks);
222 return xfs_buf_read_map(target, &map, 1, flags); 224 return xfs_buf_read_map(target, &map, 1, flags, verify);
223} 225}
224 226
225static inline void 227static inline void
226xfs_buf_readahead( 228xfs_buf_readahead(
227 struct xfs_buftarg *target, 229 struct xfs_buftarg *target,
228 xfs_daddr_t blkno, 230 xfs_daddr_t blkno,
229 size_t numblks) 231 size_t numblks,
232 xfs_buf_iodone_t verify)
230{ 233{
231 DEFINE_SINGLE_BUF_MAP(map, blkno, numblks); 234 DEFINE_SINGLE_BUF_MAP(map, blkno, numblks);
232 return xfs_buf_readahead_map(target, &map, 1); 235 return xfs_buf_readahead_map(target, &map, 1, verify);
233} 236}
234 237
235struct xfs_buf *xfs_buf_get_empty(struct xfs_buftarg *target, size_t numblks); 238struct 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);
239struct xfs_buf *xfs_buf_get_uncached(struct xfs_buftarg *target, size_t numblks, 242struct xfs_buf *xfs_buf_get_uncached(struct xfs_buftarg *target, size_t numblks,
240 int flags); 243 int flags);
241struct xfs_buf *xfs_buf_read_uncached(struct xfs_buftarg *target, 244struct xfs_buf *xfs_buf_read_uncached(struct xfs_buftarg *target,
242 xfs_daddr_t daddr, size_t numblks, int flags); 245 xfs_daddr_t daddr, size_t numblks, int flags,
246 xfs_buf_iodone_t verify);
243void xfs_buf_hold(struct xfs_buf *bp); 247void xfs_buf_hold(struct xfs_buf *bp);
244 248
245/* Releasing Buffers */ 249/* Releasing Buffers */