@@ -580,7 +580,7 @@ EXPORT_SYMBOL(blk_rq_map_user);
/* Unlike blk_rq_map_user () this is only for fixed-buffer async passthrough. */
int blk_rq_map_user_fixedb(struct request_queue *q, struct request *rq,
- u64 ubuf, unsigned long len, gfp_t gfp_mask,
+ u64 ubuf, unsigned long len, struct bio_set *bs,
struct io_uring_cmd *ioucmd)
{
struct iov_iter iter;
@@ -604,7 +604,7 @@ int blk_rq_map_user_fixedb(struct request_queue *q, struct request *rq,
if (nr_segs > queue_max_segments(q))
return -EINVAL;
/* no iovecs to alloc, as we already have a BVEC iterator */
- bio = bio_alloc(gfp_mask, 0);
+ bio = bio_from_cache(0, bs);
if (!bio)
return -ENOMEM;
@@ -30,6 +30,9 @@
#define NVME_MINORS (1U << MINORBITS)
+#define NVME_BIO_POOL_SZ (4)
+struct bio_set nvme_bio_pool;
+
unsigned int admin_timeout = 60;
module_param(admin_timeout, uint, 0644);
MODULE_PARM_DESC(admin_timeout, "timeout in seconds for admin commands");
@@ -4797,6 +4800,11 @@ static int __init nvme_core_init(void)
goto unregister_generic_ns;
}
+ result = bioset_init(&nvme_bio_pool, NVME_BIO_POOL_SZ, 0,
+ BIOSET_NEED_BVECS | BIOSET_PERCPU_CACHE);
+ if (result < 0)
+ goto unregister_generic_ns;
+
return 0;
unregister_generic_ns:
@@ -4819,6 +4827,7 @@ static int __init nvme_core_init(void)
static void __exit nvme_core_exit(void)
{
+ bioset_exit(&nvme_bio_pool);
class_destroy(nvme_ns_chr_class);
class_destroy(nvme_subsys_class);
class_destroy(nvme_class);
@@ -159,7 +159,7 @@ static int nvme_submit_user_cmd(struct request_queue *q,
if (ubuffer && bufflen) {
if (likely(nvme_is_fixedb_passthru(ioucmd)))
ret = blk_rq_map_user_fixedb(q, req, ubuffer, bufflen,
- GFP_KERNEL, ioucmd);
+ &nvme_bio_pool, ioucmd);
else
ret = blk_rq_map_user(q, req, NULL, nvme_to_user_ptr(ubuffer),
bufflen, GFP_KERNEL);
@@ -47,6 +47,7 @@ extern unsigned int admin_timeout;
extern struct workqueue_struct *nvme_wq;
extern struct workqueue_struct *nvme_reset_wq;
extern struct workqueue_struct *nvme_delete_wq;
+extern struct bio_set nvme_bio_pool;
/*
* List of workarounds for devices that required behavior not specified in
@@ -967,7 +967,8 @@ struct rq_map_data {
int blk_rq_map_user(struct request_queue *, struct request *,
struct rq_map_data *, void __user *, unsigned long, gfp_t);
int blk_rq_map_user_fixedb(struct request_queue *, struct request *,
- u64 ubuf, unsigned long, gfp_t, struct io_uring_cmd *);
+ u64 ubuf, unsigned long, struct bio_set *,
+ struct io_uring_cmd *);
int blk_rq_map_user_iov(struct request_queue *, struct request *,
struct rq_map_data *, const struct iov_iter *, gfp_t);
int blk_rq_unmap_user(struct bio *);
Since we do submission/completion in task, we can have this up. Add a bio-set for nvme as we need that for bio-cache. Signed-off-by: Kanchan Joshi <joshi.k@samsung.com> --- block/blk-map.c | 4 ++-- drivers/nvme/host/core.c | 9 +++++++++ drivers/nvme/host/ioctl.c | 2 +- drivers/nvme/host/nvme.h | 1 + include/linux/blk-mq.h | 3 ++- 5 files changed, 15 insertions(+), 4 deletions(-)