diff options
-rw-r--r-- | drivers/md/dm-crypt.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c index 8939cba6e748..ad98ded3008c 100644 --- a/drivers/md/dm-crypt.c +++ b/drivers/md/dm-crypt.c | |||
@@ -688,7 +688,6 @@ static void kcryptd_crypt_write_io_submit(struct dm_crypt_io *io, | |||
688 | BUG_ON(io->ctx.idx_out < clone->bi_vcnt); | 688 | BUG_ON(io->ctx.idx_out < clone->bi_vcnt); |
689 | 689 | ||
690 | clone->bi_sector = cc->start + io->sector; | 690 | clone->bi_sector = cc->start + io->sector; |
691 | io->sector += bio_sectors(clone); | ||
692 | 691 | ||
693 | if (async) | 692 | if (async) |
694 | kcryptd_queue_io(io); | 693 | kcryptd_queue_io(io); |
@@ -703,13 +702,14 @@ static void kcryptd_crypt_write_convert(struct dm_crypt_io *io) | |||
703 | int crypt_finished; | 702 | int crypt_finished; |
704 | unsigned out_of_pages = 0; | 703 | unsigned out_of_pages = 0; |
705 | unsigned remaining = io->base_bio->bi_size; | 704 | unsigned remaining = io->base_bio->bi_size; |
705 | sector_t sector = io->sector; | ||
706 | int r; | 706 | int r; |
707 | 707 | ||
708 | /* | 708 | /* |
709 | * Prevent io from disappearing until this function completes. | 709 | * Prevent io from disappearing until this function completes. |
710 | */ | 710 | */ |
711 | crypt_inc_pending(io); | 711 | crypt_inc_pending(io); |
712 | crypt_convert_init(cc, &io->ctx, NULL, io->base_bio, io->sector); | 712 | crypt_convert_init(cc, &io->ctx, NULL, io->base_bio, sector); |
713 | 713 | ||
714 | /* | 714 | /* |
715 | * The allocated buffers can be smaller than the whole bio, | 715 | * The allocated buffers can be smaller than the whole bio, |
@@ -726,6 +726,7 @@ static void kcryptd_crypt_write_convert(struct dm_crypt_io *io) | |||
726 | io->ctx.idx_out = 0; | 726 | io->ctx.idx_out = 0; |
727 | 727 | ||
728 | remaining -= clone->bi_size; | 728 | remaining -= clone->bi_size; |
729 | sector += bio_sectors(clone); | ||
729 | 730 | ||
730 | crypt_inc_pending(io); | 731 | crypt_inc_pending(io); |
731 | r = crypt_convert(cc, &io->ctx); | 732 | r = crypt_convert(cc, &io->ctx); |
@@ -741,6 +742,8 @@ static void kcryptd_crypt_write_convert(struct dm_crypt_io *io) | |||
741 | */ | 742 | */ |
742 | if (unlikely(r < 0)) | 743 | if (unlikely(r < 0)) |
743 | break; | 744 | break; |
745 | |||
746 | io->sector = sector; | ||
744 | } | 747 | } |
745 | 748 | ||
746 | /* | 749 | /* |