diff options
Diffstat (limited to 'drivers/md/dm-crypt.c')
-rw-r--r-- | drivers/md/dm-crypt.c | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c index 7b0fcfc9eaa5..ece7c7c4cdbb 100644 --- a/drivers/md/dm-crypt.c +++ b/drivers/md/dm-crypt.c | |||
@@ -30,7 +30,7 @@ | |||
30 | /* | 30 | /* |
31 | * per bio private data | 31 | * per bio private data |
32 | */ | 32 | */ |
33 | struct crypt_io { | 33 | struct dm_crypt_io { |
34 | struct dm_target *target; | 34 | struct dm_target *target; |
35 | struct bio *base_bio; | 35 | struct bio *base_bio; |
36 | struct work_struct work; | 36 | struct work_struct work; |
@@ -106,7 +106,7 @@ struct crypt_config { | |||
106 | 106 | ||
107 | static struct kmem_cache *_crypt_io_pool; | 107 | static struct kmem_cache *_crypt_io_pool; |
108 | 108 | ||
109 | static void clone_init(struct crypt_io *, struct bio *); | 109 | static void clone_init(struct dm_crypt_io *, struct bio *); |
110 | 110 | ||
111 | /* | 111 | /* |
112 | * Different IV generation algorithms: | 112 | * Different IV generation algorithms: |
@@ -382,7 +382,7 @@ static int crypt_convert(struct crypt_config *cc, | |||
382 | 382 | ||
383 | static void dm_crypt_bio_destructor(struct bio *bio) | 383 | static void dm_crypt_bio_destructor(struct bio *bio) |
384 | { | 384 | { |
385 | struct crypt_io *io = bio->bi_private; | 385 | struct dm_crypt_io *io = bio->bi_private; |
386 | struct crypt_config *cc = io->target->private; | 386 | struct crypt_config *cc = io->target->private; |
387 | 387 | ||
388 | bio_free(bio, cc->bs); | 388 | bio_free(bio, cc->bs); |
@@ -393,7 +393,7 @@ static int crypt_convert(struct crypt_config *cc, | |||
393 | * This should never violate the device limitations | 393 | * This should never violate the device limitations |
394 | * May return a smaller bio when running out of pages | 394 | * May return a smaller bio when running out of pages |
395 | */ | 395 | */ |
396 | static struct bio *crypt_alloc_buffer(struct crypt_io *io, unsigned int size) | 396 | static struct bio *crypt_alloc_buffer(struct dm_crypt_io *io, unsigned size) |
397 | { | 397 | { |
398 | struct crypt_config *cc = io->target->private; | 398 | struct crypt_config *cc = io->target->private; |
399 | struct bio *clone; | 399 | struct bio *clone; |
@@ -479,7 +479,7 @@ static void crypt_free_buffer_pages(struct crypt_config *cc, | |||
479 | * One of the bios was finished. Check for completion of | 479 | * One of the bios was finished. Check for completion of |
480 | * the whole request and correctly clean up the buffer. | 480 | * the whole request and correctly clean up the buffer. |
481 | */ | 481 | */ |
482 | static void dec_pending(struct crypt_io *io, int error) | 482 | static void dec_pending(struct dm_crypt_io *io, int error) |
483 | { | 483 | { |
484 | struct crypt_config *cc = (struct crypt_config *) io->target->private; | 484 | struct crypt_config *cc = (struct crypt_config *) io->target->private; |
485 | 485 | ||
@@ -503,7 +503,7 @@ static void dec_pending(struct crypt_io *io, int error) | |||
503 | static struct workqueue_struct *_kcryptd_workqueue; | 503 | static struct workqueue_struct *_kcryptd_workqueue; |
504 | static void kcryptd_do_work(struct work_struct *work); | 504 | static void kcryptd_do_work(struct work_struct *work); |
505 | 505 | ||
506 | static void kcryptd_queue_io(struct crypt_io *io) | 506 | static void kcryptd_queue_io(struct dm_crypt_io *io) |
507 | { | 507 | { |
508 | INIT_WORK(&io->work, kcryptd_do_work); | 508 | INIT_WORK(&io->work, kcryptd_do_work); |
509 | queue_work(_kcryptd_workqueue, &io->work); | 509 | queue_work(_kcryptd_workqueue, &io->work); |
@@ -511,7 +511,7 @@ static void kcryptd_queue_io(struct crypt_io *io) | |||
511 | 511 | ||
512 | static int crypt_endio(struct bio *clone, unsigned int done, int error) | 512 | static int crypt_endio(struct bio *clone, unsigned int done, int error) |
513 | { | 513 | { |
514 | struct crypt_io *io = clone->bi_private; | 514 | struct dm_crypt_io *io = clone->bi_private; |
515 | struct crypt_config *cc = io->target->private; | 515 | struct crypt_config *cc = io->target->private; |
516 | unsigned read_io = bio_data_dir(clone) == READ; | 516 | unsigned read_io = bio_data_dir(clone) == READ; |
517 | 517 | ||
@@ -545,7 +545,7 @@ out: | |||
545 | return error; | 545 | return error; |
546 | } | 546 | } |
547 | 547 | ||
548 | static void clone_init(struct crypt_io *io, struct bio *clone) | 548 | static void clone_init(struct dm_crypt_io *io, struct bio *clone) |
549 | { | 549 | { |
550 | struct crypt_config *cc = io->target->private; | 550 | struct crypt_config *cc = io->target->private; |
551 | 551 | ||
@@ -556,7 +556,7 @@ static void clone_init(struct crypt_io *io, struct bio *clone) | |||
556 | clone->bi_destructor = dm_crypt_bio_destructor; | 556 | clone->bi_destructor = dm_crypt_bio_destructor; |
557 | } | 557 | } |
558 | 558 | ||
559 | static void process_read(struct crypt_io *io) | 559 | static void process_read(struct dm_crypt_io *io) |
560 | { | 560 | { |
561 | struct crypt_config *cc = io->target->private; | 561 | struct crypt_config *cc = io->target->private; |
562 | struct bio *base_bio = io->base_bio; | 562 | struct bio *base_bio = io->base_bio; |
@@ -587,7 +587,7 @@ static void process_read(struct crypt_io *io) | |||
587 | generic_make_request(clone); | 587 | generic_make_request(clone); |
588 | } | 588 | } |
589 | 589 | ||
590 | static void process_write(struct crypt_io *io) | 590 | static void process_write(struct dm_crypt_io *io) |
591 | { | 591 | { |
592 | struct crypt_config *cc = io->target->private; | 592 | struct crypt_config *cc = io->target->private; |
593 | struct bio *base_bio = io->base_bio; | 593 | struct bio *base_bio = io->base_bio; |
@@ -644,7 +644,7 @@ static void process_write(struct crypt_io *io) | |||
644 | } | 644 | } |
645 | } | 645 | } |
646 | 646 | ||
647 | static void process_read_endio(struct crypt_io *io) | 647 | static void process_read_endio(struct dm_crypt_io *io) |
648 | { | 648 | { |
649 | struct crypt_config *cc = io->target->private; | 649 | struct crypt_config *cc = io->target->private; |
650 | struct convert_context ctx; | 650 | struct convert_context ctx; |
@@ -657,7 +657,7 @@ static void process_read_endio(struct crypt_io *io) | |||
657 | 657 | ||
658 | static void kcryptd_do_work(struct work_struct *work) | 658 | static void kcryptd_do_work(struct work_struct *work) |
659 | { | 659 | { |
660 | struct crypt_io *io = container_of(work, struct crypt_io, work); | 660 | struct dm_crypt_io *io = container_of(work, struct dm_crypt_io, work); |
661 | 661 | ||
662 | if (io->post_process) | 662 | if (io->post_process) |
663 | process_read_endio(io); | 663 | process_read_endio(io); |
@@ -939,7 +939,7 @@ static int crypt_map(struct dm_target *ti, struct bio *bio, | |||
939 | union map_info *map_context) | 939 | union map_info *map_context) |
940 | { | 940 | { |
941 | struct crypt_config *cc = ti->private; | 941 | struct crypt_config *cc = ti->private; |
942 | struct crypt_io *io; | 942 | struct dm_crypt_io *io; |
943 | 943 | ||
944 | if (bio_barrier(bio)) | 944 | if (bio_barrier(bio)) |
945 | return -EOPNOTSUPP; | 945 | return -EOPNOTSUPP; |
@@ -1062,9 +1062,7 @@ static int __init dm_crypt_init(void) | |||
1062 | { | 1062 | { |
1063 | int r; | 1063 | int r; |
1064 | 1064 | ||
1065 | _crypt_io_pool = kmem_cache_create("dm-crypt_io", | 1065 | _crypt_io_pool = KMEM_CACHE(dm_crypt_io, 0); |
1066 | sizeof(struct crypt_io), | ||
1067 | 0, 0, NULL, NULL); | ||
1068 | if (!_crypt_io_pool) | 1066 | if (!_crypt_io_pool) |
1069 | return -ENOMEM; | 1067 | return -ENOMEM; |
1070 | 1068 | ||