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 /include | |
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 'include')
-rw-r--r-- | include/linux/bio.h | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/include/linux/bio.h b/include/linux/bio.h index fbe35b175555..52b9cbc3e4da 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h | |||
@@ -215,6 +215,9 @@ extern void bioset_free(struct bio_set *); | |||
215 | extern struct bio *bio_alloc_bioset(gfp_t, int, struct bio_set *); | 215 | extern struct bio *bio_alloc_bioset(gfp_t, int, struct bio_set *); |
216 | extern void bio_put(struct bio *); | 216 | extern void bio_put(struct bio *); |
217 | 217 | ||
218 | extern void __bio_clone(struct bio *, struct bio *); | ||
219 | extern struct bio *bio_clone_bioset(struct bio *, gfp_t, struct bio_set *bs); | ||
220 | |||
218 | extern struct bio_set *fs_bio_set; | 221 | extern struct bio_set *fs_bio_set; |
219 | 222 | ||
220 | static inline struct bio *bio_alloc(gfp_t gfp_mask, unsigned int nr_iovecs) | 223 | static inline struct bio *bio_alloc(gfp_t gfp_mask, unsigned int nr_iovecs) |
@@ -222,18 +225,26 @@ static inline struct bio *bio_alloc(gfp_t gfp_mask, unsigned int nr_iovecs) | |||
222 | return bio_alloc_bioset(gfp_mask, nr_iovecs, fs_bio_set); | 225 | return bio_alloc_bioset(gfp_mask, nr_iovecs, fs_bio_set); |
223 | } | 226 | } |
224 | 227 | ||
228 | static inline struct bio *bio_clone(struct bio *bio, gfp_t gfp_mask) | ||
229 | { | ||
230 | return bio_clone_bioset(bio, gfp_mask, fs_bio_set); | ||
231 | } | ||
232 | |||
225 | static inline struct bio *bio_kmalloc(gfp_t gfp_mask, unsigned int nr_iovecs) | 233 | static inline struct bio *bio_kmalloc(gfp_t gfp_mask, unsigned int nr_iovecs) |
226 | { | 234 | { |
227 | return bio_alloc_bioset(gfp_mask, nr_iovecs, NULL); | 235 | return bio_alloc_bioset(gfp_mask, nr_iovecs, NULL); |
228 | } | 236 | } |
229 | 237 | ||
238 | static inline struct bio *bio_clone_kmalloc(struct bio *bio, gfp_t gfp_mask) | ||
239 | { | ||
240 | return bio_clone_bioset(bio, gfp_mask, NULL); | ||
241 | |||
242 | } | ||
243 | |||
230 | extern void bio_endio(struct bio *, int); | 244 | extern void bio_endio(struct bio *, int); |
231 | struct request_queue; | 245 | struct request_queue; |
232 | extern int bio_phys_segments(struct request_queue *, struct bio *); | 246 | extern int bio_phys_segments(struct request_queue *, struct bio *); |
233 | 247 | ||
234 | extern void __bio_clone(struct bio *, struct bio *); | ||
235 | extern struct bio *bio_clone(struct bio *, gfp_t); | ||
236 | |||
237 | extern void bio_init(struct bio *); | 248 | extern void bio_init(struct bio *); |
238 | extern void bio_reset(struct bio *); | 249 | extern void bio_reset(struct bio *); |
239 | 250 | ||