static kmem_cache_t *_crypt_io_pool;
+/*
+ * Mempool alloc and free functions for the page
+ */
+static void *mempool_alloc_page(gfp_t gfp_mask, void *data)
+{
+ return alloc_page(gfp_mask);
+}
+
+static void mempool_free_page(void *page, void *data)
+{
+ __free_page(page);
+}
+
+
/*
* Different IV generation algorithms:
*
char *ivopts;
unsigned int crypto_flags;
unsigned int key_size;
- unsigned long long tmpll;
if (argc != 5) {
ti->error = PFX "Not enough arguments";
}
}
- cc->io_pool = mempool_create_slab_pool(MIN_IOS, _crypt_io_pool);
+ cc->io_pool = mempool_create(MIN_IOS, mempool_alloc_slab,
+ mempool_free_slab, _crypt_io_pool);
if (!cc->io_pool) {
ti->error = PFX "Cannot allocate crypt io mempool";
goto bad3;
}
- cc->page_pool = mempool_create_page_pool(MIN_POOL_PAGES, 0);
+ cc->page_pool = mempool_create(MIN_POOL_PAGES, mempool_alloc_page,
+ mempool_free_page, NULL);
if (!cc->page_pool) {
ti->error = PFX "Cannot allocate page mempool";
goto bad4;
goto bad5;
}
- if (sscanf(argv[2], "%llu", &tmpll) != 1) {
+ if (sscanf(argv[2], SECTOR_FORMAT, &cc->iv_offset) != 1) {
ti->error = PFX "Invalid iv_offset sector";
goto bad5;
}
- cc->iv_offset = tmpll;
- if (sscanf(argv[4], "%llu", &tmpll) != 1) {
+ if (sscanf(argv[4], SECTOR_FORMAT, &cc->start) != 1) {
ti->error = PFX "Invalid device sector";
goto bad5;
}
- cc->start = tmpll;
if (dm_get_device(ti, argv[3], cc->start, ti->len,
dm_table_get_mode(ti->table), &cc->dev)) {
if (bio->bi_size)
return 1;
+ if (!bio_flagged(bio, BIO_UPTODATE) && !error)
+ error = -EIO;
+
bio_put(bio);
/*
* successful reads are decrypted by the worker thread
*/
- if ((bio_data_dir(bio) == READ)
- && bio_flagged(bio, BIO_UPTODATE)) {
+ if (bio_data_dir(io->bio) == READ && !error) {
kcryptd_queue_io(io);
return 0;
}
result[sz++] = '-';
}
- DMEMIT(" %llu %s %llu", (unsigned long long)cc->iv_offset,
- cc->dev->name, (unsigned long long)cc->start);
+ DMEMIT(" " SECTOR_FORMAT " %s " SECTOR_FORMAT,
+ cc->iv_offset, cc->dev->name, cc->start);
break;
}
return 0;