From 15e9369dee2f26eb23a05c627815a329974648f6 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Sun, 25 May 2003 05:28:57 -0700 Subject: [PATCH] bio splitting So here it is, easy split support for md and dm. Neil, the changes over your version are merely: - Make a global bio split pool instead of requring device setup of one. Will waste 8 * sizeof(struct bio_pair) of RAM, but... For 2.6 at least it has to be a core functionality. - Various style changes to follow the kernel guide lines. --- include/linux/bio.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'include/linux') diff --git a/include/linux/bio.h b/include/linux/bio.h index bbc69dd67b28..3921d3b751b9 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h @@ -22,6 +22,7 @@ #include #include +#include /* Platforms may set this to teach the BIO layer about IOMMU hardware. */ #include @@ -202,6 +203,27 @@ struct bio { */ #define bio_get(bio) atomic_inc(&(bio)->bi_cnt) + +/* + * A bio_pair is used when we need to split a bio. + * This can only happen for a bio that refers to just one + * page of data, and in the unusual situation when the + * page crosses a chunk/device boundary + * + * The address of the master bio is stored in bio1.bi_private + * The address of the pool the pair was allocated from is stored + * in bio2.bi_private + */ +struct bio_pair { + struct bio bio1, bio2; + struct bio_vec bv1, bv2; + atomic_t cnt; + int error; +}; +extern struct bio_pair *bio_split(struct bio *bi, mempool_t *pool, + int first_sectors); +extern void bio_pair_release(struct bio_pair *dbio); + extern struct bio *bio_alloc(int, int); extern void bio_put(struct bio *); -- cgit v1.2.3