Lines Matching refs:bio
27 /* Platforms may set this to teach the BIO layer about IOMMU hardware. */
64 struct bio;
65 typedef int (bio_end_io_t) (struct bio *, unsigned int, int);
66 typedef void (bio_destructor_t) (struct bio *);
72 struct bio {
74 struct bio *bi_next; /* request queue link */
84 /* Number of segments in this BIO after
99 * in this bio
117 * bio flags
124 #define BIO_BOUNCED 5 /* bio is a bounce bio */
127 #define bio_flagged(bio, flag) ((bio)->bi_flags & (1 << (flag)))
130 * top 4 bits of bio flags indicate the pool this bio came from
135 #define BIO_POOL_IDX(bio) ((bio)->bi_flags >> BIO_POOL_OFFSET)
138 * bio bi_rw flags
153 * upper 16 bits of bi_rw define the io priority of this bio
156 #define bio_prio(bio) ((bio)->bi_rw >> BIO_PRIO_SHIFT)
157 #define bio_prio_valid(bio) ioprio_valid(bio_prio(bio))
159 #define bio_set_prio(bio, prio) do { \
161 (bio)->bi_rw &= ((1UL << BIO_PRIO_SHIFT) - 1); \
162 (bio)->bi_rw |= ((unsigned long) (prio) << BIO_PRIO_SHIFT); \
169 #define bio_iovec_idx(bio, idx) (&((bio)->bi_io_vec[(idx)]))
170 #define bio_iovec(bio) bio_iovec_idx((bio), (bio)->bi_idx)
171 #define bio_page(bio) bio_iovec((bio))->bv_page
172 #define bio_offset(bio) bio_iovec((bio))->bv_offset
173 #define bio_segments(bio) ((bio)->bi_vcnt - (bio)->bi_idx)
174 #define bio_sectors(bio) ((bio)->bi_size >> 9)
175 #define bio_cur_sectors(bio) (bio_iovec(bio)->bv_len >> 9)
176 #define bio_data(bio) (page_address(bio_page((bio))) + bio_offset((bio)))
177 #define bio_barrier(bio) ((bio)->bi_rw & (1 << BIO_RW_BARRIER))
178 #define bio_sync(bio) ((bio)->bi_rw & (1 << BIO_RW_SYNC))
179 #define bio_failfast(bio) ((bio)->bi_rw & (1 << BIO_RW_FAILFAST))
180 #define bio_rw_ahead(bio) ((bio)->bi_rw & (1 << BIO_RW_AHEAD))
185 #define bio_to_phys(bio) (page_to_phys(bio_page((bio))) + (unsigned long) bio_offset((bio)))
194 #define __bio_kmap_atomic(bio, idx, kmtype) \
195 (kmap_atomic(bio_iovec_idx((bio), (idx))->bv_page, kmtype) + \
196 bio_iovec_idx((bio), (idx))->bv_offset)
204 #define __BVEC_END(bio) bio_iovec_idx((bio), (bio)->bi_vcnt - 1)
205 #define __BVEC_START(bio) bio_iovec_idx((bio), (bio)->bi_idx)
224 #define bio_io_error(bio, bytes) bio_endio((bio), (bytes), -EIO)
228 * run through the entire bio and not just pending pieces
230 #define __bio_for_each_segment(bvl, bio, i, start_idx) \
231 for (bvl = bio_iovec_idx((bio), (start_idx)), i = (start_idx); \
232 i < (bio)->bi_vcnt; \
235 #define bio_for_each_segment(bvl, bio, i) \
236 __bio_for_each_segment(bvl, bio, i, (bio)->bi_idx)
239 * get a reference to a bio, so it won't disappear. the intended use is
242 * bio_get(bio);
243 * submit_bio(rw, bio);
244 * if (bio->bi_flags ...)
246 * bio_put(bio);
249 * returns. and then bio would be freed memory when if (bio->bi_flags ...)
252 #define bio_get(bio) atomic_inc(&(bio)->bi_cnt)
256 * A bio_pair is used when we need to split a bio.
257 * This can only happen for a bio that refers to just one
261 * The address of the master bio is stored in bio1.bi_private
266 struct bio bio1, bio2;
271 extern struct bio_pair *bio_split(struct bio *bi, mempool_t *pool,
279 extern struct bio *bio_alloc(gfp_t, int);
280 extern struct bio *bio_alloc_bioset(gfp_t, int, struct bio_set *);
281 extern void bio_put(struct bio *);
282 extern void bio_free(struct bio *, struct bio_set *);
284 extern void bio_endio(struct bio *, unsigned int, int);
286 extern int bio_phys_segments(struct request_queue *, struct bio *);
287 extern int bio_hw_segments(struct request_queue *, struct bio *);
289 extern void __bio_clone(struct bio *, struct bio *);
290 extern struct bio *bio_clone(struct bio *, gfp_t);
292 extern void bio_init(struct bio *);
294 extern int bio_add_page(struct bio *, struct page *, unsigned int,unsigned int);
295 extern int bio_add_pc_page(struct request_queue *, struct bio *, struct page *,
298 extern struct bio *bio_map_user(struct request_queue *, struct block_device *,
301 extern struct bio *bio_map_user_iov(struct request_queue *,
304 extern void bio_unmap_user(struct bio *);
305 extern struct bio *bio_map_kern(struct request_queue *, void *, unsigned int,
307 extern void bio_set_pages_dirty(struct bio *bio);
308 extern void bio_check_pages_dirty(struct bio *bio);
309 extern struct bio *bio_copy_user(struct request_queue *, unsigned long, unsigned int, int);
310 extern int bio_uncopy_user(struct bio *);
311 void zero_fill_bio(struct bio *bio);
349 static inline char *__bio_kmap_irq(struct bio *bio, unsigned short idx,
352 return bvec_kmap_irq(bio_iovec_idx(bio, idx), flags);
356 #define bio_kmap_irq(bio, flags) \
357 __bio_kmap_irq((bio), (bio)->bi_idx, (flags))