summaryrefslogtreecommitdiffstats
path: root/drivers/md/dm-crypt.c
diff options
context:
space:
mode:
authorMilan Broz <mbroz@redhat.com>2008-02-08 03:10:46 +0100
committerAlasdair G Kergon <agk@redhat.com>2008-02-08 03:10:46 +0100
commitee7a491e62214bfd56c97c1fef3672c09e2a700d (patch)
treeb17672c2216a93ec875da4b332b9c0d6e0348b82 /drivers/md/dm-crypt.c
parentdm crypt: move error setting outside crypt_dec_pending (diff)
downloadlinux-ee7a491e62214bfd56c97c1fef3672c09e2a700d.tar.xz
linux-ee7a491e62214bfd56c97c1fef3672c09e2a700d.zip
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/dm-crypt.c')
-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)
{
struct dm_crypt_io *io = clone->bi_private;
struct crypt_config *cc = io->target->private;
- unsigned read_io = bio_data_dir(clone) == READ;
+ unsigned rw = bio_data_dir(clone);
if (unlikely(!bio_flagged(clone, BIO_UPTODATE) && !error))
error = -EIO;
@@ -512,20 +512,15 @@ static void crypt_endio(struct bio *clone, int error)
/*
* free the processed pages
*/
- if (!read_io) {
+ if (rw == WRITE)
crypt_free_buffer_pages(cc, clone);
- goto out;
- }
-
- if (unlikely(error))
- goto out;
bio_put(clone);
- kcryptd_queue_crypt(io);
- return;
-out:
- bio_put(clone);
+ if (rw == READ && !error) {
+ kcryptd_queue_crypt(io);
+ return;
+ }
if (unlikely(error))
io->error = error;