block: Generic bio chaining
authorKent Overstreet <kmo@daterainc.com>
Wed, 30 Oct 2013 00:17:53 +0000 (17:17 -0700)
committerJens Axboe <axboe@kernel.dk>
Thu, 31 Oct 2013 14:04:50 +0000 (08:04 -0600)
commit2771aecc0cc33d70747c8335239c20c9ff87ac67
tree0f1c11daa5ff637b82e7f5b4c46a14803f3b6f12
parent7e814b148e1127be7c32bb438ceaadb0b6e33042
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>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/md/bcache/io.c
drivers/md/dm-cache-target.c
drivers/md/dm-thin.c
fs/bio-integrity.c
fs/bio.c
include/linux/bio.h
include/linux/blk_types.h