diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c diff --git a/fs/bio.c b/fs/bio.c index 6a0b9ad..e120945 100644 --- a/fs/bio.c +++ b/fs/bio.c @@ -75,6 +75,7 @@ struct bio_set { * IO code that does not need private memory pools. */ static struct bio_set *fs_bio_set; +static struct bio_set *blk_pc_bio_set; /* TODO rename for what is is now called */ static inline struct bio_vec *bvec_alloc_bs(gfp_t gfp_mask, int nr, unsigned long *idx, struct bio_set *bs) { @@ -119,6 +120,14 @@ void bio_free(struct bio *bio, struct bi /* * default destructor for a bio allocated with bio_alloc_bioset() */ +static void bio_pc_destructor(struct bio *bio) +{ + bio_free(bio, blk_pc_bio_set); +} + +/* + * default destructor for a bio allocated with bio_alloc_bioset() + */ static void bio_fs_destructor(struct bio *bio) { bio_free(bio, fs_bio_set); @@ -832,9 +841,13 @@ static struct bio *__bio_map_kern(reques int offset, i; struct bio *bio; - bio = bio_alloc(gfp_mask, nr_pages); - if (!bio) + /* todo: move so map_user can use */ + bio = bio_alloc_bioset(gfp_mask, nr_pages, blk_pc_bio_set); + if (!bio) { + /* if GFP_WAIT then retry and wait like in get_request_wait */ return ERR_PTR(-ENOMEM); + } + bio->bi_destructor = bio_pc_destructor; offset = offset_in_page(kaddr); for (i = 0; i < nr_pages; i++) { @@ -1243,7 +1256,11 @@ static int __init init_bio(void) fs_bio_set = bioset_create(BIO_POOL_SIZE, bvec_pool_entries, scale); if (!fs_bio_set) - panic("bio: can't allocate bios\n"); + panic("bio: can't allocate fs bios\n"); + + blk_pc_bio_set = bioset_create(BIO_POOL_SIZE, bvec_pool_entries, scale) + if (!blk_pc_bio_set) + panic("bio: can't allocate blk pc bios\n"); bio_split_pool = mempool_create_kmalloc_pool(BIO_SPLIT_ENTRIES, sizeof(struct bio_pair));