summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMilan Broz <mbroz@redhat.com>2008-10-21 17:45:00 +0100
committerAlasdair G Kergon <agk@redhat.com>2008-10-21 17:45:00 +0100
commitb635b00e0e159d858486fd899c4021d1d67757e2 (patch)
treeceb7bb5bd97142fe4fb5412cbf1f19fa867869c1
parent586e80e6ee0d137c7d79fbae183bb37bc60ee97e (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>
-rw-r--r--drivers/md/dm-crypt.c7
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,
BUG_ON(io->ctx.idx_out < clone->bi_vcnt);
clone->bi_sector = cc->start + io->sector;
- io->sector += bio_sectors(clone);
if (async)
kcryptd_queue_io(io);
@@ -703,13 +702,14 @@ static void kcryptd_crypt_write_convert(struct dm_crypt_io *io)
int crypt_finished;
unsigned out_of_pages = 0;
unsigned remaining = io->base_bio->bi_size;
+ sector_t sector = io->sector;
int r;
/*
* Prevent io from disappearing until this function completes.
*/
crypt_inc_pending(io);
- crypt_convert_init(cc, &io->ctx, NULL, io->base_bio, io->sector);
+ crypt_convert_init(cc, &io->ctx, NULL, io->base_bio, sector);
/*
* 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)
io->ctx.idx_out = 0;
remaining -= clone->bi_size;
+ sector += bio_sectors(clone);
crypt_inc_pending(io);
r = crypt_convert(cc, &io->ctx);
@@ -741,6 +742,8 @@ static void kcryptd_crypt_write_convert(struct dm_crypt_io *io)
*/
if (unlikely(r < 0))
break;
+
+ io->sector = sector;
}
/*