Skip to content

Commit

Permalink
dm crypt: tidy crypt_endio
Browse files Browse the repository at this point in the history
Simplify crypt_endio function.

Signed-off-by: Milan Broz <mbroz@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
  • Loading branch information
Milan Broz authored and Alasdair G Kergon committed Feb 8, 2008
1 parent 5742fd7 commit ee7a491
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions drivers/md/dm-crypt.c
Original file line number Diff line number Diff line change
Expand Up @@ -504,28 +504,23 @@ 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;

/*
* 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;
Expand Down

0 comments on commit ee7a491

Please sign in to comment.