|
@@ -120,7 +120,6 @@ struct crypt_config {
|
|
* pool for per bio private data, crypto requests and
|
|
* pool for per bio private data, crypto requests and
|
|
* encryption requeusts/buffer pages
|
|
* encryption requeusts/buffer pages
|
|
*/
|
|
*/
|
|
- mempool_t *io_pool;
|
|
|
|
mempool_t *req_pool;
|
|
mempool_t *req_pool;
|
|
mempool_t *page_pool;
|
|
mempool_t *page_pool;
|
|
struct bio_set *bs;
|
|
struct bio_set *bs;
|
|
@@ -173,8 +172,6 @@ struct crypt_config {
|
|
|
|
|
|
#define MIN_IOS 16
|
|
#define MIN_IOS 16
|
|
|
|
|
|
-static struct kmem_cache *_crypt_io_pool;
|
|
|
|
-
|
|
|
|
static void clone_init(struct dm_crypt_io *, struct bio *);
|
|
static void clone_init(struct dm_crypt_io *, struct bio *);
|
|
static void kcryptd_queue_crypt(struct dm_crypt_io *io);
|
|
static void kcryptd_queue_crypt(struct dm_crypt_io *io);
|
|
static u8 *iv_of_dmreq(struct crypt_config *cc, struct dm_crypt_request *dmreq);
|
|
static u8 *iv_of_dmreq(struct crypt_config *cc, struct dm_crypt_request *dmreq);
|
|
@@ -1056,8 +1053,6 @@ static void crypt_dec_pending(struct dm_crypt_io *io)
|
|
|
|
|
|
if (io->ctx.req)
|
|
if (io->ctx.req)
|
|
crypt_free_req(cc, io->ctx.req, base_bio);
|
|
crypt_free_req(cc, io->ctx.req, base_bio);
|
|
- if (io != dm_per_bio_data(base_bio, cc->per_bio_data_size))
|
|
|
|
- mempool_free(io, cc->io_pool);
|
|
|
|
|
|
|
|
bio_endio(base_bio, error);
|
|
bio_endio(base_bio, error);
|
|
}
|
|
}
|
|
@@ -1445,8 +1440,6 @@ static void crypt_dtr(struct dm_target *ti)
|
|
mempool_destroy(cc->page_pool);
|
|
mempool_destroy(cc->page_pool);
|
|
if (cc->req_pool)
|
|
if (cc->req_pool)
|
|
mempool_destroy(cc->req_pool);
|
|
mempool_destroy(cc->req_pool);
|
|
- if (cc->io_pool)
|
|
|
|
- mempool_destroy(cc->io_pool);
|
|
|
|
|
|
|
|
if (cc->iv_gen_ops && cc->iv_gen_ops->dtr)
|
|
if (cc->iv_gen_ops && cc->iv_gen_ops->dtr)
|
|
cc->iv_gen_ops->dtr(cc);
|
|
cc->iv_gen_ops->dtr(cc);
|
|
@@ -1660,13 +1653,6 @@ static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv)
|
|
if (ret < 0)
|
|
if (ret < 0)
|
|
goto bad;
|
|
goto bad;
|
|
|
|
|
|
- ret = -ENOMEM;
|
|
|
|
- cc->io_pool = mempool_create_slab_pool(MIN_IOS, _crypt_io_pool);
|
|
|
|
- if (!cc->io_pool) {
|
|
|
|
- ti->error = "Cannot allocate crypt io mempool";
|
|
|
|
- goto bad;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
cc->dmreq_start = sizeof(struct ablkcipher_request);
|
|
cc->dmreq_start = sizeof(struct ablkcipher_request);
|
|
cc->dmreq_start += crypto_ablkcipher_reqsize(any_tfm(cc));
|
|
cc->dmreq_start += crypto_ablkcipher_reqsize(any_tfm(cc));
|
|
cc->dmreq_start = ALIGN(cc->dmreq_start, __alignof__(struct dm_crypt_request));
|
|
cc->dmreq_start = ALIGN(cc->dmreq_start, __alignof__(struct dm_crypt_request));
|
|
@@ -1684,6 +1670,7 @@ static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv)
|
|
iv_size_padding = crypto_ablkcipher_alignmask(any_tfm(cc));
|
|
iv_size_padding = crypto_ablkcipher_alignmask(any_tfm(cc));
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ ret = -ENOMEM;
|
|
cc->req_pool = mempool_create_kmalloc_pool(MIN_IOS, cc->dmreq_start +
|
|
cc->req_pool = mempool_create_kmalloc_pool(MIN_IOS, cc->dmreq_start +
|
|
sizeof(struct dm_crypt_request) + iv_size_padding + cc->iv_size);
|
|
sizeof(struct dm_crypt_request) + iv_size_padding + cc->iv_size);
|
|
if (!cc->req_pool) {
|
|
if (!cc->req_pool) {
|
|
@@ -1965,15 +1952,9 @@ static int __init dm_crypt_init(void)
|
|
{
|
|
{
|
|
int r;
|
|
int r;
|
|
|
|
|
|
- _crypt_io_pool = KMEM_CACHE(dm_crypt_io, 0);
|
|
|
|
- if (!_crypt_io_pool)
|
|
|
|
- return -ENOMEM;
|
|
|
|
-
|
|
|
|
r = dm_register_target(&crypt_target);
|
|
r = dm_register_target(&crypt_target);
|
|
- if (r < 0) {
|
|
|
|
|
|
+ if (r < 0)
|
|
DMERR("register failed %d", r);
|
|
DMERR("register failed %d", r);
|
|
- kmem_cache_destroy(_crypt_io_pool);
|
|
|
|
- }
|
|
|
|
|
|
|
|
return r;
|
|
return r;
|
|
}
|
|
}
|
|
@@ -1981,7 +1962,6 @@ static int __init dm_crypt_init(void)
|
|
static void __exit dm_crypt_exit(void)
|
|
static void __exit dm_crypt_exit(void)
|
|
{
|
|
{
|
|
dm_unregister_target(&crypt_target);
|
|
dm_unregister_target(&crypt_target);
|
|
- kmem_cache_destroy(_crypt_io_pool);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
module_init(dm_crypt_init);
|
|
module_init(dm_crypt_init);
|