diff options
-rw-r--r-- | drivers/md/dm-crypt.c | 40 |
1 files changed, 25 insertions, 15 deletions
diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c index 278659975d72..5b83204b6594 100644 --- a/drivers/md/dm-crypt.c +++ b/drivers/md/dm-crypt.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2003 Christophe Saout <christophe@saout.de> | 2 | * Copyright (C) 2003 Christophe Saout <christophe@saout.de> |
3 | * Copyright (C) 2004 Clemens Fruhwirth <clemens@endorphin.org> | 3 | * Copyright (C) 2004 Clemens Fruhwirth <clemens@endorphin.org> |
4 | * Copyright (C) 2006 Red Hat, Inc. All rights reserved. | 4 | * Copyright (C) 2006-2007 Red Hat, Inc. All rights reserved. |
5 | * | 5 | * |
6 | * This file is released under the GPL. | 6 | * This file is released under the GPL. |
7 | */ | 7 | */ |
@@ -481,14 +481,14 @@ static void crypt_dec_pending(struct dm_crypt_io *io) | |||
481 | * starved by new requests which can block in the first stages due | 481 | * starved by new requests which can block in the first stages due |
482 | * to memory allocation. | 482 | * to memory allocation. |
483 | */ | 483 | */ |
484 | static void kcryptd_do_work(struct work_struct *work); | 484 | static void kcryptd_io(struct work_struct *work); |
485 | static void kcryptd_do_crypt(struct work_struct *work); | 485 | static void kcryptd_crypt(struct work_struct *work); |
486 | 486 | ||
487 | static void kcryptd_queue_io(struct dm_crypt_io *io) | 487 | static void kcryptd_queue_io(struct dm_crypt_io *io) |
488 | { | 488 | { |
489 | struct crypt_config *cc = io->target->private; | 489 | struct crypt_config *cc = io->target->private; |
490 | 490 | ||
491 | INIT_WORK(&io->work, kcryptd_do_work); | 491 | INIT_WORK(&io->work, kcryptd_io); |
492 | queue_work(cc->io_queue, &io->work); | 492 | queue_work(cc->io_queue, &io->work); |
493 | } | 493 | } |
494 | 494 | ||
@@ -496,7 +496,7 @@ static void kcryptd_queue_crypt(struct dm_crypt_io *io) | |||
496 | { | 496 | { |
497 | struct crypt_config *cc = io->target->private; | 497 | struct crypt_config *cc = io->target->private; |
498 | 498 | ||
499 | INIT_WORK(&io->work, kcryptd_do_crypt); | 499 | INIT_WORK(&io->work, kcryptd_crypt); |
500 | queue_work(cc->crypt_queue, &io->work); | 500 | queue_work(cc->crypt_queue, &io->work); |
501 | } | 501 | } |
502 | 502 | ||
@@ -539,7 +539,7 @@ static void clone_init(struct dm_crypt_io *io, struct bio *clone) | |||
539 | clone->bi_destructor = dm_crypt_bio_destructor; | 539 | clone->bi_destructor = dm_crypt_bio_destructor; |
540 | } | 540 | } |
541 | 541 | ||
542 | static void process_read(struct dm_crypt_io *io) | 542 | static void kcryptd_io_read(struct dm_crypt_io *io) |
543 | { | 543 | { |
544 | struct crypt_config *cc = io->target->private; | 544 | struct crypt_config *cc = io->target->private; |
545 | struct bio *base_bio = io->base_bio; | 545 | struct bio *base_bio = io->base_bio; |
@@ -571,7 +571,15 @@ static void process_read(struct dm_crypt_io *io) | |||
571 | generic_make_request(clone); | 571 | generic_make_request(clone); |
572 | } | 572 | } |
573 | 573 | ||
574 | static void process_write(struct dm_crypt_io *io) | 574 | static void kcryptd_io_write(struct dm_crypt_io *io) |
575 | { | ||
576 | } | ||
577 | |||
578 | static void kcryptd_crypt_write_io_submit(struct dm_crypt_io *io, int error) | ||
579 | { | ||
580 | } | ||
581 | |||
582 | static void kcryptd_crypt_write_convert(struct dm_crypt_io *io) | ||
575 | { | 583 | { |
576 | struct crypt_config *cc = io->target->private; | 584 | struct crypt_config *cc = io->target->private; |
577 | struct bio *base_bio = io->base_bio; | 585 | struct bio *base_bio = io->base_bio; |
@@ -629,7 +637,7 @@ static void process_write(struct dm_crypt_io *io) | |||
629 | } | 637 | } |
630 | } | 638 | } |
631 | 639 | ||
632 | static void crypt_read_done(struct dm_crypt_io *io, int error) | 640 | static void kcryptd_crypt_read_done(struct dm_crypt_io *io, int error) |
633 | { | 641 | { |
634 | if (unlikely(error < 0)) | 642 | if (unlikely(error < 0)) |
635 | io->error = -EIO; | 643 | io->error = -EIO; |
@@ -637,7 +645,7 @@ static void crypt_read_done(struct dm_crypt_io *io, int error) | |||
637 | crypt_dec_pending(io); | 645 | crypt_dec_pending(io); |
638 | } | 646 | } |
639 | 647 | ||
640 | static void process_read_endio(struct dm_crypt_io *io) | 648 | static void kcryptd_crypt_read_convert(struct dm_crypt_io *io) |
641 | { | 649 | { |
642 | struct crypt_config *cc = io->target->private; | 650 | struct crypt_config *cc = io->target->private; |
643 | int r = 0; | 651 | int r = 0; |
@@ -647,25 +655,27 @@ static void process_read_endio(struct dm_crypt_io *io) | |||
647 | 655 | ||
648 | r = crypt_convert(cc, &io->ctx); | 656 | r = crypt_convert(cc, &io->ctx); |
649 | 657 | ||
650 | crypt_read_done(io, r); | 658 | kcryptd_crypt_read_done(io, r); |
651 | } | 659 | } |
652 | 660 | ||
653 | static void kcryptd_do_work(struct work_struct *work) | 661 | static void kcryptd_io(struct work_struct *work) |
654 | { | 662 | { |
655 | struct dm_crypt_io *io = container_of(work, struct dm_crypt_io, work); | 663 | struct dm_crypt_io *io = container_of(work, struct dm_crypt_io, work); |
656 | 664 | ||
657 | if (bio_data_dir(io->base_bio) == READ) | 665 | if (bio_data_dir(io->base_bio) == READ) |
658 | process_read(io); | 666 | kcryptd_io_read(io); |
667 | else | ||
668 | kcryptd_io_write(io); | ||
659 | } | 669 | } |
660 | 670 | ||
661 | static void kcryptd_do_crypt(struct work_struct *work) | 671 | static void kcryptd_crypt(struct work_struct *work) |
662 | { | 672 | { |
663 | struct dm_crypt_io *io = container_of(work, struct dm_crypt_io, work); | 673 | struct dm_crypt_io *io = container_of(work, struct dm_crypt_io, work); |
664 | 674 | ||
665 | if (bio_data_dir(io->base_bio) == READ) | 675 | if (bio_data_dir(io->base_bio) == READ) |
666 | process_read_endio(io); | 676 | kcryptd_crypt_read_convert(io); |
667 | else | 677 | else |
668 | process_write(io); | 678 | kcryptd_crypt_write_convert(io); |
669 | } | 679 | } |
670 | 680 | ||
671 | /* | 681 | /* |