Commit 3e1a8bdd authored by Milan Broz's avatar Milan Broz Committed by Alasdair G Kergon

dm crypt: tidy inc pending

Move io pending to one place.

No functional change, usefull to simplify debugging.
Signed-off-by: default avatarMilan Broz <mbroz@redhat.com>
Signed-off-by: default avatarAlasdair G Kergon <agk@redhat.com>
parent fd14acf6
...@@ -517,6 +517,11 @@ static void crypt_free_buffer_pages(struct crypt_config *cc, struct bio *clone) ...@@ -517,6 +517,11 @@ static void crypt_free_buffer_pages(struct crypt_config *cc, struct bio *clone)
} }
} }
static void crypt_inc_pending(struct dm_crypt_io *io)
{
atomic_inc(&io->pending);
}
/* /*
* One of the bios was finished. Check for completion of * One of the bios was finished. Check for completion of
* the whole request and correctly clean up the buffer. * the whole request and correctly clean up the buffer.
...@@ -591,7 +596,7 @@ static void kcryptd_io_read(struct dm_crypt_io *io) ...@@ -591,7 +596,7 @@ static void kcryptd_io_read(struct dm_crypt_io *io)
struct bio *base_bio = io->base_bio; struct bio *base_bio = io->base_bio;
struct bio *clone; struct bio *clone;
atomic_inc(&io->pending); crypt_inc_pending(io);
/* /*
* The block layer might modify the bvec array, so always * 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,7 +670,7 @@ static void kcryptd_crypt_write_io_submit(struct dm_crypt_io *io,
if (async) if (async)
kcryptd_queue_io(io); kcryptd_queue_io(io);
else { else {
atomic_inc(&io->pending); crypt_inc_pending(io);
generic_make_request(clone); generic_make_request(clone);
} }
} }
...@@ -701,7 +706,7 @@ static void kcryptd_crypt_write_convert_loop(struct dm_crypt_io *io) ...@@ -701,7 +706,7 @@ static void kcryptd_crypt_write_convert_loop(struct dm_crypt_io *io)
if (unlikely(r < 0)) if (unlikely(r < 0))
return; return;
} else } else
atomic_inc(&io->pending); crypt_inc_pending(io);
/* out of memory -> run queues */ /* out of memory -> run queues */
if (unlikely(remaining)) { if (unlikely(remaining)) {
...@@ -720,7 +725,7 @@ static void kcryptd_crypt_write_convert(struct dm_crypt_io *io) ...@@ -720,7 +725,7 @@ static void kcryptd_crypt_write_convert(struct dm_crypt_io *io)
/* /*
* Prevent io from disappearing until this function completes. * Prevent io from disappearing until this function completes.
*/ */
atomic_inc(&io->pending); crypt_inc_pending(io);
crypt_convert_init(cc, &io->ctx, NULL, io->base_bio, io->sector); crypt_convert_init(cc, &io->ctx, NULL, io->base_bio, io->sector);
kcryptd_crypt_write_convert_loop(io); kcryptd_crypt_write_convert_loop(io);
...@@ -741,7 +746,7 @@ static void kcryptd_crypt_read_convert(struct dm_crypt_io *io) ...@@ -741,7 +746,7 @@ static void kcryptd_crypt_read_convert(struct dm_crypt_io *io)
struct crypt_config *cc = io->target->private; struct crypt_config *cc = io->target->private;
int r = 0; int r = 0;
atomic_inc(&io->pending); crypt_inc_pending(io);
crypt_convert_init(cc, &io->ctx, io->base_bio, io->base_bio, crypt_convert_init(cc, &io->ctx, io->base_bio, io->base_bio,
io->sector); io->sector);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment