aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
authorMilan Broz <mbroz@redhat.com>2008-02-07 21:10:46 -0500
committerAlasdair G Kergon <agk@redhat.com>2008-02-07 21:10:46 -0500
commitee7a491e62214bfd56c97c1fef3672c09e2a700d (patch)
treeb17672c2216a93ec875da4b332b9c0d6e0348b82 /drivers/md
parent5742fd77757894ebb5e441afbdac1fb666e782f7 (diff)
dm crypt: tidy crypt_endio
Simplify crypt_endio function. Signed-off-by: Milan Broz <mbroz@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/dm-crypt.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c
index cc189a2bc533..278659975d72 100644
--- a/drivers/md/dm-crypt.c
+++ b/drivers/md/dm-crypt.c
@@ -504,7 +504,7 @@ static void crypt_endio(struct bio *clone, int error)
504{ 504{
505 struct dm_crypt_io *io = clone->bi_private; 505 struct dm_crypt_io *io = clone->bi_private;
506 struct crypt_config *cc = io->target->private; 506 struct crypt_config *cc = io->target->private;
507 unsigned read_io = bio_data_dir(clone) == READ; 507 unsigned rw = bio_data_dir(clone);
508 508
509 if (unlikely(!bio_flagged(clone, BIO_UPTODATE) && !error)) 509 if (unlikely(!bio_flagged(clone, BIO_UPTODATE) && !error))
510 error = -EIO; 510 error = -EIO;
@@ -512,20 +512,15 @@ static void crypt_endio(struct bio *clone, int error)
512 /* 512 /*
513 * free the processed pages 513 * free the processed pages
514 */ 514 */
515 if (!read_io) { 515 if (rw == WRITE)
516 crypt_free_buffer_pages(cc, clone); 516 crypt_free_buffer_pages(cc, clone);
517 goto out;
518 }
519
520 if (unlikely(error))
521 goto out;
522 517
523 bio_put(clone); 518 bio_put(clone);
524 kcryptd_queue_crypt(io);
525 return;
526 519
527out: 520 if (rw == READ && !error) {
528 bio_put(clone); 521 kcryptd_queue_crypt(io);
522 return;
523 }
529 524
530 if (unlikely(error)) 525 if (unlikely(error))
531 io->error = error; 526 io->error = error;