summary refs log tree commit diff
path: root/drivers
diff options
context:
space:
mode:
authorAlasdair G Kergon <agk@redhat.com>2008-10-10 13:37:05 +0100
committerAlasdair G Kergon <agk@redhat.com>2008-10-10 13:37:05 +0100
commit1e37bb8e557a186d327eb4d1387953880ffc2cdd (patch)
treedfd5c65642762a69ed94136cde90e92a09d4cc15 /drivers
parentfc5a5e9aa878f86642c962b309f793fb2db0727e (diff)
downloadlinux-1e37bb8e557a186d327eb4d1387953880ffc2cdd.tar.gz
dm crypt: remove inc_pending from write_io_submit
Make the caller reponsible for incrementing the pending count before calling
kcryptd_crypt_write_io_submit() in the non-async case to bring it into line
with the async case.

Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/md/dm-crypt.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c
index 97b407582c03..0042636ad375 100644
--- a/drivers/md/dm-crypt.c
+++ b/drivers/md/dm-crypt.c
@@ -685,10 +685,8 @@ static void kcryptd_crypt_write_io_submit(struct dm_crypt_io *io,
 
 	if (async)
 		kcryptd_queue_io(io);
-	else {
-		crypt_inc_pending(io);
+	else
 		generic_make_request(clone);
-	}
 }
 
 static void kcryptd_crypt_write_convert(struct dm_crypt_io *io)
@@ -724,9 +722,12 @@ static void kcryptd_crypt_write_convert(struct dm_crypt_io *io)
 
 		if (atomic_dec_and_test(&io->ctx.pending)) {
 			/* processed, no running async crypto  */
+			crypt_inc_pending(io);
 			kcryptd_crypt_write_io_submit(io, r, 0);
-			if (unlikely(r < 0))
+			if (unlikely(r < 0)) {
+				crypt_dec_pending(io);
 				break;
+			}
 		} else
 			crypt_inc_pending(io);