Commit ee7a491e62214bfd56c97c1fef3672c09e2a700d

Authored by Milan Broz
Committed by Alasdair G Kergon
1 parent 5742fd7775

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>

Showing 1 changed file with 6 additions and 11 deletions Side-by-side Diff

drivers/md/dm-crypt.c
... ... @@ -504,7 +504,7 @@
504 504 {
505 505 struct dm_crypt_io *io = clone->bi_private;
506 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 509 if (unlikely(!bio_flagged(clone, BIO_UPTODATE) && !error))
510 510 error = -EIO;
511 511  
512 512  
513 513  
514 514  
... ... @@ -512,20 +512,15 @@
512 512 /*
513 513 * free the processed pages
514 514 */
515   - if (!read_io) {
  515 + if (rw == WRITE)
516 516 crypt_free_buffer_pages(cc, clone);
517   - goto out;
518   - }
519 517  
520   - if (unlikely(error))
521   - goto out;
522   -
523 518 bio_put(clone);
524   - kcryptd_queue_crypt(io);
525   - return;
526 519  
527   -out:
528   - bio_put(clone);
  520 + if (rw == READ && !error) {
  521 + kcryptd_queue_crypt(io);
  522 + return;
  523 + }
529 524  
530 525 if (unlikely(error))
531 526 io->error = error;