aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorKent Overstreet <koverstreet@google.com>2012-09-06 18:35:02 -0400
committerJens Axboe <axboe@kernel.dk>2012-09-09 04:35:39 -0400
commitbf800ef1816b4283a885e55ad38068aec9711e4d (patch)
treec99cbe70b68ede65b478b3006a7ed7e34b453f3d /include
parent3f86a82aeb03e6100f7ab39f4702e033a5e38166 (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.h17
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 *);
215extern struct bio *bio_alloc_bioset(gfp_t, int, struct bio_set *); 215extern struct bio *bio_alloc_bioset(gfp_t, int, struct bio_set *);
216extern void bio_put(struct bio *); 216extern void bio_put(struct bio *);
217 217
218extern void __bio_clone(struct bio *, struct bio *);
219extern struct bio *bio_clone_bioset(struct bio *, gfp_t, struct bio_set *bs);
220
218extern struct bio_set *fs_bio_set; 221extern struct bio_set *fs_bio_set;
219 222
220static inline struct bio *bio_alloc(gfp_t gfp_mask, unsigned int nr_iovecs) 223static 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
228static 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
225static inline struct bio *bio_kmalloc(gfp_t gfp_mask, unsigned int nr_iovecs) 233static 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
238static 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
230extern void bio_endio(struct bio *, int); 244extern void bio_endio(struct bio *, int);
231struct request_queue; 245struct request_queue;
232extern int bio_phys_segments(struct request_queue *, struct bio *); 246extern int bio_phys_segments(struct request_queue *, struct bio *);
233 247
234extern void __bio_clone(struct bio *, struct bio *);
235extern struct bio *bio_clone(struct bio *, gfp_t);
236
237extern void bio_init(struct bio *); 248extern void bio_init(struct bio *);
238extern void bio_reset(struct bio *); 249extern void bio_reset(struct bio *);
239 250