--- drivers/md/dm-crypt.c | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) Index: linux-3.2-fast/drivers/md/dm-crypt.c =================================================================== --- linux-3.2-fast.orig/drivers/md/dm-crypt.c 2012-01-31 02:30:50.000000000 +0100 +++ linux-3.2-fast/drivers/md/dm-crypt.c 2012-01-31 02:30:52.000000000 +0100 @@ -823,16 +823,16 @@ static void crypt_dec_cc_pending(struct /* * Encrypt / decrypt data from one bio to another one (can be the same one) */ -static int crypt_convert(struct crypt_config *cc, - struct dm_crypt_io *io) +static void crypt_convert(struct crypt_config *cc, + struct dm_crypt_io *io) { - int r; LIST_HEAD(batch); unsigned batch_count = 0; atomic_set(&io->cc_pending, 1); while (1) { + int r; struct ablkcipher_request *req = crypt_alloc_req(cc, io, GFP_NOWAIT); if (!req) { /* @@ -847,8 +847,9 @@ static int crypt_convert(struct crypt_co r = crypt_convert_block(cc, io, req, &batch); if (unlikely(r < 0)) { crypt_flush_batch(cc, &batch); + io->error = -EIO; crypt_dec_cc_pending(io); - goto ret; + return; } io->cc_sector++; @@ -864,12 +865,8 @@ static int crypt_convert(struct crypt_co } break; } - r = 0; crypt_flush_batch(cc, &batch); -ret: - - return r; } static void dm_crypt_bio_destructor(struct bio *bio) @@ -1108,7 +1105,6 @@ static void kcryptd_crypt_write_convert( struct bio *clone; unsigned remaining = io->base_bio->bi_size; sector_t sector = io->sector; - int r; /* * Prevent io from disappearing until this function completes. @@ -1129,9 +1125,7 @@ static void kcryptd_crypt_write_convert( sector += bio_sectors(clone); crypt_inc_pending(io); - r = crypt_convert(cc, io); - if (r) - io->error = -EIO; + crypt_convert(cc, io); dec: crypt_dec_pending(io); @@ -1140,17 +1134,13 @@ dec: static void kcryptd_crypt_read_convert(struct dm_crypt_io *io) { struct crypt_config *cc = io->cc; - int r = 0; crypt_inc_pending(io); crypt_convert_init(cc, io, io->base_bio, io->base_bio, io->sector); - r = crypt_convert(cc, io); - - if (r < 0) - io->error = -EIO; + crypt_convert(cc, io); crypt_dec_pending(io); }