Commit a47a28b7 authored by Kent Overstreet's avatar Kent Overstreet Committed by Jens Axboe

target: convert to bioset_init()/mempool_init()

Convert the target code to embedded bio sets.
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarKent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 6f1c819c
...@@ -94,8 +94,8 @@ static int iblock_configure_device(struct se_device *dev) ...@@ -94,8 +94,8 @@ static int iblock_configure_device(struct se_device *dev)
return -EINVAL; return -EINVAL;
} }
ib_dev->ibd_bio_set = bioset_create(IBLOCK_BIO_POOL_SIZE, 0, BIOSET_NEED_BVECS); ret = bioset_init(&ib_dev->ibd_bio_set, IBLOCK_BIO_POOL_SIZE, 0, BIOSET_NEED_BVECS);
if (!ib_dev->ibd_bio_set) { if (ret) {
pr_err("IBLOCK: Unable to create bioset\n"); pr_err("IBLOCK: Unable to create bioset\n");
goto out; goto out;
} }
...@@ -141,7 +141,7 @@ static int iblock_configure_device(struct se_device *dev) ...@@ -141,7 +141,7 @@ static int iblock_configure_device(struct se_device *dev)
bi = bdev_get_integrity(bd); bi = bdev_get_integrity(bd);
if (bi) { if (bi) {
struct bio_set *bs = ib_dev->ibd_bio_set; struct bio_set *bs = &ib_dev->ibd_bio_set;
if (!strcmp(bi->profile->name, "T10-DIF-TYPE3-IP") || if (!strcmp(bi->profile->name, "T10-DIF-TYPE3-IP") ||
!strcmp(bi->profile->name, "T10-DIF-TYPE1-IP")) { !strcmp(bi->profile->name, "T10-DIF-TYPE1-IP")) {
...@@ -174,8 +174,7 @@ static int iblock_configure_device(struct se_device *dev) ...@@ -174,8 +174,7 @@ static int iblock_configure_device(struct se_device *dev)
out_blkdev_put: out_blkdev_put:
blkdev_put(ib_dev->ibd_bd, FMODE_WRITE|FMODE_READ|FMODE_EXCL); blkdev_put(ib_dev->ibd_bd, FMODE_WRITE|FMODE_READ|FMODE_EXCL);
out_free_bioset: out_free_bioset:
bioset_free(ib_dev->ibd_bio_set); bioset_exit(&ib_dev->ibd_bio_set);
ib_dev->ibd_bio_set = NULL;
out: out:
return ret; return ret;
} }
...@@ -199,8 +198,7 @@ static void iblock_destroy_device(struct se_device *dev) ...@@ -199,8 +198,7 @@ static void iblock_destroy_device(struct se_device *dev)
if (ib_dev->ibd_bd != NULL) if (ib_dev->ibd_bd != NULL)
blkdev_put(ib_dev->ibd_bd, FMODE_WRITE|FMODE_READ|FMODE_EXCL); blkdev_put(ib_dev->ibd_bd, FMODE_WRITE|FMODE_READ|FMODE_EXCL);
if (ib_dev->ibd_bio_set != NULL) bioset_exit(&ib_dev->ibd_bio_set);
bioset_free(ib_dev->ibd_bio_set);
} }
static unsigned long long iblock_emulate_read_cap_with_block_size( static unsigned long long iblock_emulate_read_cap_with_block_size(
...@@ -332,7 +330,7 @@ iblock_get_bio(struct se_cmd *cmd, sector_t lba, u32 sg_num, int op, ...@@ -332,7 +330,7 @@ iblock_get_bio(struct se_cmd *cmd, sector_t lba, u32 sg_num, int op,
if (sg_num > BIO_MAX_PAGES) if (sg_num > BIO_MAX_PAGES)
sg_num = BIO_MAX_PAGES; sg_num = BIO_MAX_PAGES;
bio = bio_alloc_bioset(GFP_NOIO, sg_num, ib_dev->ibd_bio_set); bio = bio_alloc_bioset(GFP_NOIO, sg_num, &ib_dev->ibd_bio_set);
if (!bio) { if (!bio) {
pr_err("Unable to allocate memory for bio\n"); pr_err("Unable to allocate memory for bio\n");
return NULL; return NULL;
......
...@@ -22,7 +22,7 @@ struct iblock_dev { ...@@ -22,7 +22,7 @@ struct iblock_dev {
struct se_device dev; struct se_device dev;
unsigned char ibd_udev_path[SE_UDEV_PATH_LEN]; unsigned char ibd_udev_path[SE_UDEV_PATH_LEN];
u32 ibd_flags; u32 ibd_flags;
struct bio_set *ibd_bio_set; struct bio_set ibd_bio_set;
struct block_device *ibd_bd; struct block_device *ibd_bd;
bool ibd_readonly; bool ibd_readonly;
} ____cacheline_aligned; } ____cacheline_aligned;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment