aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_buf.h
diff options
context:
space:
mode:
authorDave Chinner <dchinner@redhat.com>2012-06-22 04:50:09 -0400
committerBen Myers <bpm@sgi.com>2012-07-01 15:50:05 -0400
commit3e85c868a697805a3d4c7800a6bacdfc81d15cdf (patch)
treec4c1ee345e2e84a6ff9abdef782cccc6293fc7c7 /fs/xfs/xfs_buf.h
parentcbb7baab285a540f173ef1ec3d5bcf9d0ad29d16 (diff)
xfs: convert internal buffer functions to pass maps
While the external interface currently uses separate blockno/length variables, we need to move internal interfaces to passing and parsing vector maps. This will then allow us to add external interfaces to support discontiguous buffer maps as the internal code will already support them. Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Ben Myers <bpm@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_buf.h')
-rw-r--r--fs/xfs/xfs_buf.h43
1 files changed, 35 insertions, 8 deletions
diff --git a/fs/xfs/xfs_buf.h b/fs/xfs/xfs_buf.h
index c9c2ba90c53c..67d134994ae4 100644
--- a/fs/xfs/xfs_buf.h
+++ b/fs/xfs/xfs_buf.h
@@ -105,6 +105,9 @@ struct xfs_buf_map {
105 int bm_len; /* size of I/O */ 105 int bm_len; /* size of I/O */
106}; 106};
107 107
108#define DEFINE_SINGLE_BUF_MAP(map, blkno, numblk) \
109 struct xfs_buf_map (map) = { .bm_bn = (blkno), .bm_len = (numblk) };
110
108typedef struct xfs_buf { 111typedef struct xfs_buf {
109 /* 112 /*
110 * first cacheline holds all the fields needed for an uncontended cache 113 * first cacheline holds all the fields needed for an uncontended cache
@@ -134,7 +137,9 @@ typedef struct xfs_buf {
134 struct xfs_trans *b_transp; 137 struct xfs_trans *b_transp;
135 struct page **b_pages; /* array of page pointers */ 138 struct page **b_pages; /* array of page pointers */
136 struct page *b_page_array[XB_PAGES]; /* inline pages */ 139 struct page *b_page_array[XB_PAGES]; /* inline pages */
137 struct xfs_buf_map b_map; /* compound buffer map */ 140 struct xfs_buf_map *b_maps; /* compound buffer map */
141 struct xfs_buf_map b_map; /* inline compound buffer map */
142 int b_map_count;
138 int b_io_length; /* IO size in BBs */ 143 int b_io_length; /* IO size in BBs */
139 atomic_t b_pin_count; /* pin count */ 144 atomic_t b_pin_count; /* pin count */
140 atomic_t b_io_remaining; /* #outstanding I/O requests */ 145 atomic_t b_io_remaining; /* #outstanding I/O requests */
@@ -149,11 +154,35 @@ typedef struct xfs_buf {
149 154
150 155
151/* Finding and Reading Buffers */ 156/* Finding and Reading Buffers */
152struct xfs_buf *_xfs_buf_find(struct xfs_buftarg *target, xfs_daddr_t blkno, 157struct xfs_buf *_xfs_buf_find(struct xfs_buftarg *target,
153 size_t numblks, xfs_buf_flags_t flags, 158 struct xfs_buf_map *map, int nmaps,
154 struct xfs_buf *new_bp); 159 xfs_buf_flags_t flags, struct xfs_buf *new_bp);
155#define xfs_incore(buftarg,blkno,len,lockit) \ 160
156 _xfs_buf_find(buftarg, blkno ,len, lockit, NULL) 161static inline struct xfs_buf *
162xfs_incore(
163 struct xfs_buftarg *target,
164 xfs_daddr_t blkno,
165 size_t numblks,
166 xfs_buf_flags_t flags)
167{
168 DEFINE_SINGLE_BUF_MAP(map, blkno, numblks);
169 return _xfs_buf_find(target, &map, 1, flags, NULL);
170}
171
172struct xfs_buf *_xfs_buf_alloc(struct xfs_buftarg *target,
173 struct xfs_buf_map *map, int nmaps,
174 xfs_buf_flags_t flags);
175
176static inline struct xfs_buf *
177xfs_buf_alloc(
178 struct xfs_buftarg *target,
179 xfs_daddr_t blkno,
180 size_t numblks,
181 xfs_buf_flags_t flags)
182{
183 DEFINE_SINGLE_BUF_MAP(map, blkno, numblks);
184 return _xfs_buf_alloc(target, &map, 1, flags);
185}
157 186
158struct xfs_buf *xfs_buf_get(struct xfs_buftarg *target, xfs_daddr_t blkno, 187struct xfs_buf *xfs_buf_get(struct xfs_buftarg *target, xfs_daddr_t blkno,
159 size_t numblks, xfs_buf_flags_t flags); 188 size_t numblks, xfs_buf_flags_t flags);
@@ -163,8 +192,6 @@ void xfs_buf_readahead(struct xfs_buftarg *target, xfs_daddr_t blkno,
163 size_t numblks); 192 size_t numblks);
164 193
165struct xfs_buf *xfs_buf_get_empty(struct xfs_buftarg *target, size_t numblks); 194struct xfs_buf *xfs_buf_get_empty(struct xfs_buftarg *target, size_t numblks);
166struct xfs_buf *xfs_buf_alloc(struct xfs_buftarg *target, xfs_daddr_t blkno,
167 size_t numblks, xfs_buf_flags_t flags);
168void xfs_buf_set_empty(struct xfs_buf *bp, size_t numblks); 195void xfs_buf_set_empty(struct xfs_buf *bp, size_t numblks);
169int xfs_buf_associate_memory(struct xfs_buf *bp, void *mem, size_t length); 196int xfs_buf_associate_memory(struct xfs_buf *bp, void *mem, size_t length);
170 197