aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_buf.h
diff options
context:
space:
mode:
authorDave Chinner <dchinner@redhat.com>2012-11-14 01:54:40 -0500
committerBen Myers <bpm@sgi.com>2012-11-15 22:35:12 -0500
commit1813dd64057490e7a0678a885c4fe6d02f78bdc1 (patch)
treecaf95e2be7881b771da65561b2f1664d73588401 /fs/xfs/xfs_buf.h
parentb0f539de9fcc543a3ffa40bc22bf51aca6ea6183 (diff)
xfs: convert buffer verifiers to an ops structure.
To separate the verifiers from iodone functions and associate read and write verifiers at the same time, introduce a buffer verifier operations structure to the xfs_buf. This avoids the need for assigning the write verifier, clearing the iodone function and re-running ioend processing in the read verifier, and gets rid of the nasty "b_pre_io" name for the write verifier function pointer. If we ever need to, it will also be easier to add further content specific callbacks to a buffer with an ops structure in place. We also avoid needing to export verifier functions, instead we can simply export the ops structures for those that are needed outside the function they are defined in. This patch also fixes a directory block readahead verifier issue it exposed. This patch also adds ops callbacks to the inode/alloc btree blocks initialised by growfs. These will need more work before they will work with CRCs. Signed-off-by: Dave Chinner <dchinner@redhat.com> 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.h24
1 files changed, 14 insertions, 10 deletions
diff --git a/fs/xfs/xfs_buf.h b/fs/xfs/xfs_buf.h
index 51bc16a1cd9c..23f5642480bb 100644
--- a/fs/xfs/xfs_buf.h
+++ b/fs/xfs/xfs_buf.h
@@ -111,6 +111,11 @@ struct xfs_buf_map {
111#define DEFINE_SINGLE_BUF_MAP(map, blkno, numblk) \ 111#define DEFINE_SINGLE_BUF_MAP(map, blkno, numblk) \
112 struct xfs_buf_map (map) = { .bm_bn = (blkno), .bm_len = (numblk) }; 112 struct xfs_buf_map (map) = { .bm_bn = (blkno), .bm_len = (numblk) };
113 113
114struct xfs_buf_ops {
115 void (*verify_read)(struct xfs_buf *);
116 void (*verify_write)(struct xfs_buf *);
117};
118
114typedef struct xfs_buf { 119typedef struct xfs_buf {
115 /* 120 /*
116 * first cacheline holds all the fields needed for an uncontended cache 121 * first cacheline holds all the fields needed for an uncontended cache
@@ -154,9 +159,7 @@ typedef struct xfs_buf {
154 unsigned int b_page_count; /* size of page array */ 159 unsigned int b_page_count; /* size of page array */
155 unsigned int b_offset; /* page offset in first page */ 160 unsigned int b_offset; /* page offset in first page */
156 unsigned short b_error; /* error code on I/O */ 161 unsigned short b_error; /* error code on I/O */
157 162 const struct xfs_buf_ops *b_ops;
158 void (*b_pre_io)(struct xfs_buf *);
159 /* pre-io callback function */
160 163
161#ifdef XFS_BUF_LOCK_TRACKING 164#ifdef XFS_BUF_LOCK_TRACKING
162 int b_last_holder; 165 int b_last_holder;
@@ -199,10 +202,11 @@ struct xfs_buf *xfs_buf_get_map(struct xfs_buftarg *target,
199 xfs_buf_flags_t flags); 202 xfs_buf_flags_t flags);
200struct xfs_buf *xfs_buf_read_map(struct xfs_buftarg *target, 203struct xfs_buf *xfs_buf_read_map(struct xfs_buftarg *target,
201 struct xfs_buf_map *map, int nmaps, 204 struct xfs_buf_map *map, int nmaps,
202 xfs_buf_flags_t flags, xfs_buf_iodone_t verify); 205 xfs_buf_flags_t flags,
206 const struct xfs_buf_ops *ops);
203void xfs_buf_readahead_map(struct xfs_buftarg *target, 207void xfs_buf_readahead_map(struct xfs_buftarg *target,
204 struct xfs_buf_map *map, int nmaps, 208 struct xfs_buf_map *map, int nmaps,
205 xfs_buf_iodone_t verify); 209 const struct xfs_buf_ops *ops);
206 210
207static inline struct xfs_buf * 211static inline struct xfs_buf *
208xfs_buf_get( 212xfs_buf_get(
@@ -221,10 +225,10 @@ xfs_buf_read(
221 xfs_daddr_t blkno, 225 xfs_daddr_t blkno,
222 size_t numblks, 226 size_t numblks,
223 xfs_buf_flags_t flags, 227 xfs_buf_flags_t flags,
224 xfs_buf_iodone_t verify) 228 const struct xfs_buf_ops *ops)
225{ 229{
226 DEFINE_SINGLE_BUF_MAP(map, blkno, numblks); 230 DEFINE_SINGLE_BUF_MAP(map, blkno, numblks);
227 return xfs_buf_read_map(target, &map, 1, flags, verify); 231 return xfs_buf_read_map(target, &map, 1, flags, ops);
228} 232}
229 233
230static inline void 234static inline void
@@ -232,10 +236,10 @@ xfs_buf_readahead(
232 struct xfs_buftarg *target, 236 struct xfs_buftarg *target,
233 xfs_daddr_t blkno, 237 xfs_daddr_t blkno,
234 size_t numblks, 238 size_t numblks,
235 xfs_buf_iodone_t verify) 239 const struct xfs_buf_ops *ops)
236{ 240{
237 DEFINE_SINGLE_BUF_MAP(map, blkno, numblks); 241 DEFINE_SINGLE_BUF_MAP(map, blkno, numblks);
238 return xfs_buf_readahead_map(target, &map, 1, verify); 242 return xfs_buf_readahead_map(target, &map, 1, ops);
239} 243}
240 244
241struct xfs_buf *xfs_buf_get_empty(struct xfs_buftarg *target, size_t numblks); 245struct xfs_buf *xfs_buf_get_empty(struct xfs_buftarg *target, size_t numblks);
@@ -246,7 +250,7 @@ struct xfs_buf *xfs_buf_get_uncached(struct xfs_buftarg *target, size_t numblks,
246 int flags); 250 int flags);
247struct xfs_buf *xfs_buf_read_uncached(struct xfs_buftarg *target, 251struct xfs_buf *xfs_buf_read_uncached(struct xfs_buftarg *target,
248 xfs_daddr_t daddr, size_t numblks, int flags, 252 xfs_daddr_t daddr, size_t numblks, int flags,
249 xfs_buf_iodone_t verify); 253 const struct xfs_buf_ops *ops);
250void xfs_buf_hold(struct xfs_buf *bp); 254void xfs_buf_hold(struct xfs_buf *bp);
251 255
252/* Releasing Buffers */ 256/* Releasing Buffers */