+static void kcryptd_async_done(struct crypto_async_request *async_req,
+ int error)
+{
+ struct convert_context *ctx = async_req->data;
+ struct dm_crypt_io *io = container_of(ctx, struct dm_crypt_io, ctx);
+ struct crypt_config *cc = io->target->private;
+
+ if (error == -EINPROGRESS) {
+ complete(&ctx->restart);
+ return;
+ }
+
+ mempool_free(ablkcipher_request_cast(async_req), cc->req_pool);
+
+ if (!atomic_dec_and_test(&ctx->pending))
+ return;
+
+ if (bio_data_dir(io->base_bio) == READ)
+ kcryptd_crypt_read_done(io, error);
+ else
+ kcryptd_crypt_write_io_submit(io, error, 1);
+}
+