diff options
| author | Kent Overstreet <kmo@daterainc.com> | 2013-11-23 21:34:15 -0500 |
|---|---|---|
| committer | Kent Overstreet <kmo@daterainc.com> | 2013-11-24 01:33:56 -0500 |
| commit | 196d38bccfcfa32faed8c561868336fdfa0fe8e4 (patch) | |
| tree | 9dee2bc174436072c9e90ffebbe71f47fde63aaf /include/linux | |
| parent | e90abc8ec323c1fd2a25600097ef7ae1e91f39b0 (diff) | |
block: Generic bio chaining
This adds a generic mechanism for chaining bio completions. This is
going to be used for a bio_split() replacement, and it turns out to be
very useful in a fair amount of driver code - a fair number of drivers
were implementing this in their own roundabout ways, often painfully.
Note that this means it's no longer to call bio_endio() more than once
on the same bio! This can cause problems for drivers that save/restore
bi_end_io. Arguably they shouldn't be saving/restoring bi_end_io at all
- in all but the simplest cases they'd be better off just cloning the
bio, and immutable biovecs is making bio cloning cheaper. But for now,
we add a bio_endio_nodec() for these cases.
Signed-off-by: Kent Overstreet <kmo@daterainc.com>
Cc: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/bio.h | 2 | ||||
| -rw-r--r-- | include/linux/blk_types.h | 2 |
2 files changed, 4 insertions, 0 deletions
diff --git a/include/linux/bio.h b/include/linux/bio.h index 0c32a45a419c..64f5169c224b 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h | |||
| @@ -356,6 +356,7 @@ static inline struct bio *bio_clone_kmalloc(struct bio *bio, gfp_t gfp_mask) | |||
| 356 | } | 356 | } |
| 357 | 357 | ||
| 358 | extern void bio_endio(struct bio *, int); | 358 | extern void bio_endio(struct bio *, int); |
| 359 | extern void bio_endio_nodec(struct bio *, int); | ||
| 359 | struct request_queue; | 360 | struct request_queue; |
| 360 | extern int bio_phys_segments(struct request_queue *, struct bio *); | 361 | extern int bio_phys_segments(struct request_queue *, struct bio *); |
| 361 | 362 | ||
| @@ -364,6 +365,7 @@ extern void bio_advance(struct bio *, unsigned); | |||
| 364 | 365 | ||
| 365 | extern void bio_init(struct bio *); | 366 | extern void bio_init(struct bio *); |
| 366 | extern void bio_reset(struct bio *); | 367 | extern void bio_reset(struct bio *); |
| 368 | void bio_chain(struct bio *, struct bio *); | ||
| 367 | 369 | ||
| 368 | extern int bio_add_page(struct bio *, struct page *, unsigned int,unsigned int); | 370 | extern int bio_add_page(struct bio *, struct page *, unsigned int,unsigned int); |
| 369 | extern int bio_add_pc_page(struct request_queue *, struct bio *, struct page *, | 371 | extern int bio_add_pc_page(struct request_queue *, struct bio *, struct page *, |
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h index d369f8f6af79..bbc3a6c88fce 100644 --- a/include/linux/blk_types.h +++ b/include/linux/blk_types.h | |||
| @@ -65,6 +65,8 @@ struct bio { | |||
| 65 | unsigned int bi_seg_front_size; | 65 | unsigned int bi_seg_front_size; |
| 66 | unsigned int bi_seg_back_size; | 66 | unsigned int bi_seg_back_size; |
| 67 | 67 | ||
| 68 | atomic_t bi_remaining; | ||
| 69 | |||
| 68 | bio_end_io_t *bi_end_io; | 70 | bio_end_io_t *bi_end_io; |
| 69 | 71 | ||
| 70 | void *bi_private; | 72 | void *bi_private; |
