aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/dm-crypt.c
diff options
context:
space:
mode:
authorMilan Broz <mbroz@redhat.com>2008-10-10 08:37:04 -0400
committerAlasdair G Kergon <agk@redhat.com>2008-10-10 08:37:04 -0400
commitfc5a5e9aa878f86642c962b309f793fb2db0727e (patch)
treeca66747db5cf5897a294971f3417f19adf920028 /drivers/md/dm-crypt.c
parentdc440d1e56c481f80d5350daadc7d078a04ca729 (diff)
dm crypt: tidy write loop pending
Move kcryptd_crypt_write_convert_loop inside kcryptd_crypt_write_convert. This change is needed for a later patch. 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.c25
1 files changed, 9 insertions, 16 deletions
diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c
index cac064d4aa72..97b407582c03 100644
--- a/drivers/md/dm-crypt.c
+++ b/drivers/md/dm-crypt.c
@@ -691,7 +691,7 @@ static void kcryptd_crypt_write_io_submit(struct dm_crypt_io *io,
691 } 691 }
692} 692}
693 693
694static void kcryptd_crypt_write_convert_loop(struct dm_crypt_io *io) 694static void kcryptd_crypt_write_convert(struct dm_crypt_io *io)
695{ 695{
696 struct crypt_config *cc = io->target->private; 696 struct crypt_config *cc = io->target->private;
697 struct bio *clone; 697 struct bio *clone;
@@ -699,6 +699,12 @@ static void kcryptd_crypt_write_convert_loop(struct dm_crypt_io *io)
699 int r; 699 int r;
700 700
701 /* 701 /*
702 * Prevent io from disappearing until this function completes.
703 */
704 crypt_inc_pending(io);
705 crypt_convert_init(cc, &io->ctx, NULL, io->base_bio, io->sector);
706
707 /*
702 * The allocated buffers can be smaller than the whole bio, 708 * The allocated buffers can be smaller than the whole bio,
703 * so repeat the whole process until all the data can be handled. 709 * so repeat the whole process until all the data can be handled.
704 */ 710 */
@@ -706,7 +712,7 @@ static void kcryptd_crypt_write_convert_loop(struct dm_crypt_io *io)
706 clone = crypt_alloc_buffer(io, remaining); 712 clone = crypt_alloc_buffer(io, remaining);
707 if (unlikely(!clone)) { 713 if (unlikely(!clone)) {
708 io->error = -ENOMEM; 714 io->error = -ENOMEM;
709 return; 715 break;
710 } 716 }
711 717
712 io->ctx.bio_out = clone; 718 io->ctx.bio_out = clone;
@@ -720,7 +726,7 @@ static void kcryptd_crypt_write_convert_loop(struct dm_crypt_io *io)
720 /* processed, no running async crypto */ 726 /* processed, no running async crypto */
721 kcryptd_crypt_write_io_submit(io, r, 0); 727 kcryptd_crypt_write_io_submit(io, r, 0);
722 if (unlikely(r < 0)) 728 if (unlikely(r < 0))
723 return; 729 break;
724 } else 730 } else
725 crypt_inc_pending(io); 731 crypt_inc_pending(io);
726 732
@@ -732,19 +738,6 @@ static void kcryptd_crypt_write_convert_loop(struct dm_crypt_io *io)
732 congestion_wait(WRITE, HZ/100); 738 congestion_wait(WRITE, HZ/100);
733 } 739 }
734 } 740 }
735}
736
737static void kcryptd_crypt_write_convert(struct dm_crypt_io *io)
738{
739 struct crypt_config *cc = io->target->private;
740
741 /*
742 * Prevent io from disappearing until this function completes.
743 */
744 crypt_inc_pending(io);
745
746 crypt_convert_init(cc, &io->ctx, NULL, io->base_bio, io->sector);
747 kcryptd_crypt_write_convert_loop(io);
748 741
749 crypt_dec_pending(io); 742 crypt_dec_pending(io);
750} 743}