diff options
author | NeilBrown <neilb@suse.com> | 2017-06-18 00:38:58 -0400 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2017-06-18 14:40:59 -0400 |
commit | b25d52379ad87800a93311c42e36f8dd1d7d8e98 (patch) | |
tree | 7bf333a9a4dc42d1f143b8cc8ee249bdb7d3563b /drivers/lightnvm/pblk-init.c | |
parent | a1d91404cb69daee07282b331ce58c4ab2e7a620 (diff) |
lightnvm/pblk-read: use bio_clone_fast()
pblk_submit_read() uses bio_clone_bioset() but doesn't change the
io_vec, so bio_clone_fast() is a better choice.
It also uses fs_bio_set which is intended for filesystems. Using it
in a device driver can deadlock.
So allocate a new bioset, and and use bio_clone_fast().
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Javier González <javier@cnexlabs.com>
Tested-by: Javier González <javier@cnexlabs.com>
Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/lightnvm/pblk-init.c')
-rw-r--r-- | drivers/lightnvm/pblk-init.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/drivers/lightnvm/pblk-init.c b/drivers/lightnvm/pblk-init.c index b3fec8ec55b8..aaefbccce30e 100644 --- a/drivers/lightnvm/pblk-init.c +++ b/drivers/lightnvm/pblk-init.c | |||
@@ -23,6 +23,7 @@ | |||
23 | static struct kmem_cache *pblk_blk_ws_cache, *pblk_rec_cache, *pblk_r_rq_cache, | 23 | static struct kmem_cache *pblk_blk_ws_cache, *pblk_rec_cache, *pblk_r_rq_cache, |
24 | *pblk_w_rq_cache, *pblk_line_meta_cache; | 24 | *pblk_w_rq_cache, *pblk_line_meta_cache; |
25 | static DECLARE_RWSEM(pblk_lock); | 25 | static DECLARE_RWSEM(pblk_lock); |
26 | struct bio_set *pblk_bio_set; | ||
26 | 27 | ||
27 | static int pblk_rw_io(struct request_queue *q, struct pblk *pblk, | 28 | static int pblk_rw_io(struct request_queue *q, struct pblk *pblk, |
28 | struct bio *bio) | 29 | struct bio *bio) |
@@ -946,11 +947,20 @@ static struct nvm_tgt_type tt_pblk = { | |||
946 | 947 | ||
947 | static int __init pblk_module_init(void) | 948 | static int __init pblk_module_init(void) |
948 | { | 949 | { |
949 | return nvm_register_tgt_type(&tt_pblk); | 950 | int ret; |
951 | |||
952 | pblk_bio_set = bioset_create(BIO_POOL_SIZE, 0, 0); | ||
953 | if (!pblk_bio_set) | ||
954 | return -ENOMEM; | ||
955 | ret = nvm_register_tgt_type(&tt_pblk); | ||
956 | if (ret) | ||
957 | bioset_free(pblk_bio_set); | ||
958 | return ret; | ||
950 | } | 959 | } |
951 | 960 | ||
952 | static void pblk_module_exit(void) | 961 | static void pblk_module_exit(void) |
953 | { | 962 | { |
963 | bioset_free(pblk_bio_set); | ||
954 | nvm_unregister_tgt_type(&tt_pblk); | 964 | nvm_unregister_tgt_type(&tt_pblk); |
955 | } | 965 | } |
956 | 966 | ||