diff options
Diffstat (limited to 'fs/xfs/xfs_buf.h')
-rw-r--r-- | fs/xfs/xfs_buf.h | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/fs/xfs/xfs_buf.h b/fs/xfs/xfs_buf.h index 7c0b6a0a1557..433a12ed7b17 100644 --- a/fs/xfs/xfs_buf.h +++ b/fs/xfs/xfs_buf.h | |||
@@ -100,6 +100,7 @@ typedef struct xfs_buftarg { | |||
100 | struct xfs_buf; | 100 | struct xfs_buf; |
101 | typedef void (*xfs_buf_iodone_t)(struct xfs_buf *); | 101 | typedef void (*xfs_buf_iodone_t)(struct xfs_buf *); |
102 | 102 | ||
103 | |||
103 | #define XB_PAGES 2 | 104 | #define XB_PAGES 2 |
104 | 105 | ||
105 | struct xfs_buf_map { | 106 | struct xfs_buf_map { |
@@ -110,6 +111,11 @@ struct xfs_buf_map { | |||
110 | #define DEFINE_SINGLE_BUF_MAP(map, blkno, numblk) \ | 111 | #define DEFINE_SINGLE_BUF_MAP(map, blkno, numblk) \ |
111 | struct xfs_buf_map (map) = { .bm_bn = (blkno), .bm_len = (numblk) }; | 112 | struct xfs_buf_map (map) = { .bm_bn = (blkno), .bm_len = (numblk) }; |
112 | 113 | ||
114 | struct xfs_buf_ops { | ||
115 | void (*verify_read)(struct xfs_buf *); | ||
116 | void (*verify_write)(struct xfs_buf *); | ||
117 | }; | ||
118 | |||
113 | typedef struct xfs_buf { | 119 | typedef struct xfs_buf { |
114 | /* | 120 | /* |
115 | * first cacheline holds all the fields needed for an uncontended cache | 121 | * first cacheline holds all the fields needed for an uncontended cache |
@@ -145,7 +151,7 @@ typedef struct xfs_buf { | |||
145 | struct page **b_pages; /* array of page pointers */ | 151 | struct page **b_pages; /* array of page pointers */ |
146 | struct page *b_page_array[XB_PAGES]; /* inline pages */ | 152 | struct page *b_page_array[XB_PAGES]; /* inline pages */ |
147 | struct xfs_buf_map *b_maps; /* compound buffer map */ | 153 | struct xfs_buf_map *b_maps; /* compound buffer map */ |
148 | struct xfs_buf_map b_map; /* inline compound buffer map */ | 154 | struct xfs_buf_map __b_map; /* inline compound buffer map */ |
149 | int b_map_count; | 155 | int b_map_count; |
150 | int b_io_length; /* IO size in BBs */ | 156 | int b_io_length; /* IO size in BBs */ |
151 | atomic_t b_pin_count; /* pin count */ | 157 | atomic_t b_pin_count; /* pin count */ |
@@ -153,13 +159,13 @@ typedef struct xfs_buf { | |||
153 | unsigned int b_page_count; /* size of page array */ | 159 | unsigned int b_page_count; /* size of page array */ |
154 | unsigned int b_offset; /* page offset in first page */ | 160 | unsigned int b_offset; /* page offset in first page */ |
155 | unsigned short b_error; /* error code on I/O */ | 161 | unsigned short b_error; /* error code on I/O */ |
162 | const struct xfs_buf_ops *b_ops; | ||
156 | 163 | ||
157 | #ifdef XFS_BUF_LOCK_TRACKING | 164 | #ifdef XFS_BUF_LOCK_TRACKING |
158 | int b_last_holder; | 165 | int b_last_holder; |
159 | #endif | 166 | #endif |
160 | } xfs_buf_t; | 167 | } xfs_buf_t; |
161 | 168 | ||
162 | |||
163 | /* Finding and Reading Buffers */ | 169 | /* Finding and Reading Buffers */ |
164 | struct xfs_buf *_xfs_buf_find(struct xfs_buftarg *target, | 170 | struct xfs_buf *_xfs_buf_find(struct xfs_buftarg *target, |
165 | struct xfs_buf_map *map, int nmaps, | 171 | struct xfs_buf_map *map, int nmaps, |
@@ -196,9 +202,11 @@ struct xfs_buf *xfs_buf_get_map(struct xfs_buftarg *target, | |||
196 | xfs_buf_flags_t flags); | 202 | xfs_buf_flags_t flags); |
197 | struct xfs_buf *xfs_buf_read_map(struct xfs_buftarg *target, | 203 | struct xfs_buf *xfs_buf_read_map(struct xfs_buftarg *target, |
198 | struct xfs_buf_map *map, int nmaps, | 204 | struct xfs_buf_map *map, int nmaps, |
199 | xfs_buf_flags_t flags); | 205 | xfs_buf_flags_t flags, |
206 | const struct xfs_buf_ops *ops); | ||
200 | void xfs_buf_readahead_map(struct xfs_buftarg *target, | 207 | void xfs_buf_readahead_map(struct xfs_buftarg *target, |
201 | struct xfs_buf_map *map, int nmaps); | 208 | struct xfs_buf_map *map, int nmaps, |
209 | const struct xfs_buf_ops *ops); | ||
202 | 210 | ||
203 | static inline struct xfs_buf * | 211 | static inline struct xfs_buf * |
204 | xfs_buf_get( | 212 | xfs_buf_get( |
@@ -216,20 +224,22 @@ xfs_buf_read( | |||
216 | struct xfs_buftarg *target, | 224 | struct xfs_buftarg *target, |
217 | xfs_daddr_t blkno, | 225 | xfs_daddr_t blkno, |
218 | size_t numblks, | 226 | size_t numblks, |
219 | xfs_buf_flags_t flags) | 227 | xfs_buf_flags_t flags, |
228 | const struct xfs_buf_ops *ops) | ||
220 | { | 229 | { |
221 | DEFINE_SINGLE_BUF_MAP(map, blkno, numblks); | 230 | DEFINE_SINGLE_BUF_MAP(map, blkno, numblks); |
222 | return xfs_buf_read_map(target, &map, 1, flags); | 231 | return xfs_buf_read_map(target, &map, 1, flags, ops); |
223 | } | 232 | } |
224 | 233 | ||
225 | static inline void | 234 | static inline void |
226 | xfs_buf_readahead( | 235 | xfs_buf_readahead( |
227 | struct xfs_buftarg *target, | 236 | struct xfs_buftarg *target, |
228 | xfs_daddr_t blkno, | 237 | xfs_daddr_t blkno, |
229 | size_t numblks) | 238 | size_t numblks, |
239 | const struct xfs_buf_ops *ops) | ||
230 | { | 240 | { |
231 | DEFINE_SINGLE_BUF_MAP(map, blkno, numblks); | 241 | DEFINE_SINGLE_BUF_MAP(map, blkno, numblks); |
232 | return xfs_buf_readahead_map(target, &map, 1); | 242 | return xfs_buf_readahead_map(target, &map, 1, ops); |
233 | } | 243 | } |
234 | 244 | ||
235 | struct xfs_buf *xfs_buf_get_empty(struct xfs_buftarg *target, size_t numblks); | 245 | struct xfs_buf *xfs_buf_get_empty(struct xfs_buftarg *target, size_t numblks); |
@@ -239,7 +249,8 @@ int xfs_buf_associate_memory(struct xfs_buf *bp, void *mem, size_t length); | |||
239 | struct xfs_buf *xfs_buf_get_uncached(struct xfs_buftarg *target, size_t numblks, | 249 | struct xfs_buf *xfs_buf_get_uncached(struct xfs_buftarg *target, size_t numblks, |
240 | int flags); | 250 | int flags); |
241 | struct xfs_buf *xfs_buf_read_uncached(struct xfs_buftarg *target, | 251 | struct xfs_buf *xfs_buf_read_uncached(struct xfs_buftarg *target, |
242 | xfs_daddr_t daddr, size_t numblks, int flags); | 252 | xfs_daddr_t daddr, size_t numblks, int flags, |
253 | const struct xfs_buf_ops *ops); | ||
243 | void xfs_buf_hold(struct xfs_buf *bp); | 254 | void xfs_buf_hold(struct xfs_buf *bp); |
244 | 255 | ||
245 | /* Releasing Buffers */ | 256 | /* Releasing Buffers */ |
@@ -319,8 +330,8 @@ void xfs_buf_stale(struct xfs_buf *bp); | |||
319 | * In future, uncached buffers will pass the block number directly to the io | 330 | * In future, uncached buffers will pass the block number directly to the io |
320 | * request function and hence these macros will go away at that point. | 331 | * request function and hence these macros will go away at that point. |
321 | */ | 332 | */ |
322 | #define XFS_BUF_ADDR(bp) ((bp)->b_map.bm_bn) | 333 | #define XFS_BUF_ADDR(bp) ((bp)->b_maps[0].bm_bn) |
323 | #define XFS_BUF_SET_ADDR(bp, bno) ((bp)->b_map.bm_bn = (xfs_daddr_t)(bno)) | 334 | #define XFS_BUF_SET_ADDR(bp, bno) ((bp)->b_maps[0].bm_bn = (xfs_daddr_t)(bno)) |
324 | 335 | ||
325 | static inline void xfs_buf_set_ref(struct xfs_buf *bp, int lru_ref) | 336 | static inline void xfs_buf_set_ref(struct xfs_buf *bp, int lru_ref) |
326 | { | 337 | { |