diff options
author | Kent Overstreet <koverstreet@google.com> | 2012-09-06 18:35:02 -0400 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2012-09-09 04:35:39 -0400 |
commit | bf800ef1816b4283a885e55ad38068aec9711e4d (patch) | |
tree | c99cbe70b68ede65b478b3006a7ed7e34b453f3d /drivers/md/md.c | |
parent | 3f86a82aeb03e6100f7ab39f4702e033a5e38166 (diff) |
block: Add bio_clone_bioset(), bio_clone_kmalloc()
Previously, there was bio_clone() but it only allocated from the fs bio
set; as a result various users were open coding it and using
__bio_clone().
This changes bio_clone() to become bio_clone_bioset(), and then we add
bio_clone() and bio_clone_kmalloc() as wrappers around it, making use of
the functionality the last patch adedd.
This will also help in a later patch changing how bio cloning works.
Signed-off-by: Kent Overstreet <koverstreet@google.com>
CC: Jens Axboe <axboe@kernel.dk>
CC: NeilBrown <neilb@suse.de>
CC: Alasdair Kergon <agk@redhat.com>
CC: Boaz Harrosh <bharrosh@panasas.com>
CC: Jeff Garzik <jeff@garzik.org>
Acked-by: Jeff Garzik <jgarzik@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/md/md.c')
-rw-r--r-- | drivers/md/md.c | 20 |
1 files changed, 1 insertions, 19 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c index 457ca8451ddb..7a2b0793f66e 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -173,28 +173,10 @@ EXPORT_SYMBOL_GPL(bio_alloc_mddev); | |||
173 | struct bio *bio_clone_mddev(struct bio *bio, gfp_t gfp_mask, | 173 | struct bio *bio_clone_mddev(struct bio *bio, gfp_t gfp_mask, |
174 | struct mddev *mddev) | 174 | struct mddev *mddev) |
175 | { | 175 | { |
176 | struct bio *b; | ||
177 | |||
178 | if (!mddev || !mddev->bio_set) | 176 | if (!mddev || !mddev->bio_set) |
179 | return bio_clone(bio, gfp_mask); | 177 | return bio_clone(bio, gfp_mask); |
180 | 178 | ||
181 | b = bio_alloc_bioset(gfp_mask, bio->bi_max_vecs, mddev->bio_set); | 179 | return bio_clone_bioset(bio, gfp_mask, mddev->bio_set); |
182 | if (!b) | ||
183 | return NULL; | ||
184 | |||
185 | __bio_clone(b, bio); | ||
186 | if (bio_integrity(bio)) { | ||
187 | int ret; | ||
188 | |||
189 | ret = bio_integrity_clone(b, bio, gfp_mask); | ||
190 | |||
191 | if (ret < 0) { | ||
192 | bio_put(b); | ||
193 | return NULL; | ||
194 | } | ||
195 | } | ||
196 | |||
197 | return b; | ||
198 | } | 180 | } |
199 | EXPORT_SYMBOL_GPL(bio_clone_mddev); | 181 | EXPORT_SYMBOL_GPL(bio_clone_mddev); |
200 | 182 | ||