mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 19:21:31 -04:00
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 <[email protected]> CC: Jens Axboe <[email protected]> CC: NeilBrown <[email protected]> CC: Alasdair Kergon <[email protected]> CC: Boaz Harrosh <[email protected]> CC: Jeff Garzik <[email protected]> Acked-by: Jeff Garzik <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
This commit is contained in:
parent
3f86a82aeb
commit
bf800ef181
8 changed files with 29 additions and 46 deletions
11
fs/bio.c
11
fs/bio.c
|
|
@ -438,16 +438,19 @@ void __bio_clone(struct bio *bio, struct bio *bio_src)
|
|||
EXPORT_SYMBOL(__bio_clone);
|
||||
|
||||
/**
|
||||
* bio_clone - clone a bio
|
||||
* bio_clone_bioset - clone a bio
|
||||
* @bio: bio to clone
|
||||
* @gfp_mask: allocation priority
|
||||
* @bs: bio_set to allocate from
|
||||
*
|
||||
* Like __bio_clone, only also allocates the returned bio
|
||||
*/
|
||||
struct bio *bio_clone(struct bio *bio, gfp_t gfp_mask)
|
||||
struct bio *bio_clone_bioset(struct bio *bio, gfp_t gfp_mask,
|
||||
struct bio_set *bs)
|
||||
{
|
||||
struct bio *b = bio_alloc(gfp_mask, bio->bi_max_vecs);
|
||||
struct bio *b;
|
||||
|
||||
b = bio_alloc_bioset(gfp_mask, bio->bi_max_vecs, bs);
|
||||
if (!b)
|
||||
return NULL;
|
||||
|
||||
|
|
@ -466,7 +469,7 @@ struct bio *bio_clone(struct bio *bio, gfp_t gfp_mask)
|
|||
|
||||
return b;
|
||||
}
|
||||
EXPORT_SYMBOL(bio_clone);
|
||||
EXPORT_SYMBOL(bio_clone_bioset);
|
||||
|
||||
/**
|
||||
* bio_get_nr_vecs - return approx number of vecs
|
||||
|
|
|
|||
Loading…
Reference in a new issue