diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/md/dm-crypt.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c index 13956437bc81..6b9be99eff5b 100644 --- a/drivers/md/dm-crypt.c +++ b/drivers/md/dm-crypt.c | |||
@@ -517,6 +517,11 @@ static void crypt_free_buffer_pages(struct crypt_config *cc, struct bio *clone) | |||
517 | } | 517 | } |
518 | } | 518 | } |
519 | 519 | ||
520 | static void crypt_inc_pending(struct dm_crypt_io *io) | ||
521 | { | ||
522 | atomic_inc(&io->pending); | ||
523 | } | ||
524 | |||
520 | /* | 525 | /* |
521 | * One of the bios was finished. Check for completion of | 526 | * One of the bios was finished. Check for completion of |
522 | * the whole request and correctly clean up the buffer. | 527 | * the whole request and correctly clean up the buffer. |
@@ -591,7 +596,7 @@ static void kcryptd_io_read(struct dm_crypt_io *io) | |||
591 | struct bio *base_bio = io->base_bio; | 596 | struct bio *base_bio = io->base_bio; |
592 | struct bio *clone; | 597 | struct bio *clone; |
593 | 598 | ||
594 | atomic_inc(&io->pending); | 599 | crypt_inc_pending(io); |
595 | 600 | ||
596 | /* | 601 | /* |
597 | * The block layer might modify the bvec array, so always | 602 | * The block layer might modify the bvec array, so always |
@@ -665,7 +670,7 @@ static void kcryptd_crypt_write_io_submit(struct dm_crypt_io *io, | |||
665 | if (async) | 670 | if (async) |
666 | kcryptd_queue_io(io); | 671 | kcryptd_queue_io(io); |
667 | else { | 672 | else { |
668 | atomic_inc(&io->pending); | 673 | crypt_inc_pending(io); |
669 | generic_make_request(clone); | 674 | generic_make_request(clone); |
670 | } | 675 | } |
671 | } | 676 | } |
@@ -701,7 +706,7 @@ static void kcryptd_crypt_write_convert_loop(struct dm_crypt_io *io) | |||
701 | if (unlikely(r < 0)) | 706 | if (unlikely(r < 0)) |
702 | return; | 707 | return; |
703 | } else | 708 | } else |
704 | atomic_inc(&io->pending); | 709 | crypt_inc_pending(io); |
705 | 710 | ||
706 | /* out of memory -> run queues */ | 711 | /* out of memory -> run queues */ |
707 | if (unlikely(remaining)) { | 712 | if (unlikely(remaining)) { |
@@ -720,7 +725,7 @@ static void kcryptd_crypt_write_convert(struct dm_crypt_io *io) | |||
720 | /* | 725 | /* |
721 | * Prevent io from disappearing until this function completes. | 726 | * Prevent io from disappearing until this function completes. |
722 | */ | 727 | */ |
723 | atomic_inc(&io->pending); | 728 | crypt_inc_pending(io); |
724 | 729 | ||
725 | crypt_convert_init(cc, &io->ctx, NULL, io->base_bio, io->sector); | 730 | crypt_convert_init(cc, &io->ctx, NULL, io->base_bio, io->sector); |
726 | kcryptd_crypt_write_convert_loop(io); | 731 | kcryptd_crypt_write_convert_loop(io); |
@@ -741,7 +746,7 @@ static void kcryptd_crypt_read_convert(struct dm_crypt_io *io) | |||
741 | struct crypt_config *cc = io->target->private; | 746 | struct crypt_config *cc = io->target->private; |
742 | int r = 0; | 747 | int r = 0; |
743 | 748 | ||
744 | atomic_inc(&io->pending); | 749 | crypt_inc_pending(io); |
745 | 750 | ||
746 | crypt_convert_init(cc, &io->ctx, io->base_bio, io->base_bio, | 751 | crypt_convert_init(cc, &io->ctx, io->base_bio, io->base_bio, |
747 | io->sector); | 752 | io->sector); |