diff options
author | Milan Broz <mbroz@redhat.com> | 2008-10-21 12:45:00 -0400 |
---|---|---|
committer | Alasdair G Kergon <agk@redhat.com> | 2008-10-21 12:45:00 -0400 |
commit | b635b00e0e159d858486fd899c4021d1d67757e2 (patch) | |
tree | ceb7bb5bd97142fe4fb5412cbf1f19fa867869c1 /drivers/md/dm-crypt.c | |
parent | 586e80e6ee0d137c7d79fbae183bb37bc60ee97e (diff) |
dm crypt: tidy sector
Prepare local sector variable (offset) for later patch.
Do not update io->sector for still-running I/O.
No functional change.
Signed-off-by: Milan Broz <mbroz@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Diffstat (limited to 'drivers/md/dm-crypt.c')
-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 | /* |