aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/dm-crypt.c
diff options
context:
space:
mode:
authorMilan Broz <mbroz@redhat.com>2008-02-07 21:10:59 -0500
committerAlasdair G Kergon <agk@redhat.com>2008-02-07 21:10:59 -0500
commit84131db689ab86409315c15a3ea5daf732cb04e1 (patch)
treee7ba3d1c2b7ddb38ed14725aab699e07776627b0 /drivers/md/dm-crypt.c
parentdec1cedf9d4eabe43f3c7d6af095eff40c139a89 (diff)
dm crypt: introduce crypt_write_io_loop
Introduce crypt_write_io_loop(). 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.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c
index 4df7d2f782d8..986283c5332f 100644
--- a/drivers/md/dm-crypt.c
+++ b/drivers/md/dm-crypt.c
@@ -595,17 +595,13 @@ static void kcryptd_crypt_write_io_submit(struct dm_crypt_io *io, int error)
595 io->sector += bio_sectors(clone); 595 io->sector += bio_sectors(clone);
596} 596}
597 597
598static void kcryptd_crypt_write_convert(struct dm_crypt_io *io) 598static void kcryptd_crypt_write_convert_loop(struct dm_crypt_io *io)
599{ 599{
600 struct crypt_config *cc = io->target->private; 600 struct crypt_config *cc = io->target->private;
601 struct bio *clone; 601 struct bio *clone;
602 unsigned remaining = io->base_bio->bi_size; 602 unsigned remaining = io->base_bio->bi_size;
603 int r; 603 int r;
604 604
605 atomic_inc(&io->pending);
606
607 crypt_convert_init(cc, &io->ctx, NULL, io->base_bio, io->sector);
608
609 /* 605 /*
610 * The allocated buffers can be smaller than the whole bio, 606 * The allocated buffers can be smaller than the whole bio,
611 * so repeat the whole process until all the data can be handled. 607 * so repeat the whole process until all the data can be handled.
@@ -645,6 +641,16 @@ static void kcryptd_crypt_write_convert(struct dm_crypt_io *io)
645 } 641 }
646} 642}
647 643
644static void kcryptd_crypt_write_convert(struct dm_crypt_io *io)
645{
646 struct crypt_config *cc = io->target->private;
647
648 atomic_inc(&io->pending);
649
650 crypt_convert_init(cc, &io->ctx, NULL, io->base_bio, io->sector);
651 kcryptd_crypt_write_convert_loop(io);
652}
653
648static void kcryptd_crypt_read_done(struct dm_crypt_io *io, int error) 654static void kcryptd_crypt_read_done(struct dm_crypt_io *io, int error)
649{ 655{
650 if (unlikely(error < 0)) 656 if (unlikely(error < 0))