From fb19eed246c4b9463a90fbfc7bafdc0ccd6f646c Mon Sep 17 00:00:00 2001 From: Mike Snitzer Date: Fri, 9 May 2014 17:03:15 -0400 Subject: [RHEL6.6 PATCH 07/11] dm crypt: rename pending field BZ: 1076147 Upstream commit 40b6229b69211e24b46868675d4db1dab1a51d96 Author: Mikulas Patocka Date: Fri Jul 27 15:08:04 2012 +0100 dm crypt: rename pending field There are two dm crypt structures that have a field called "pending". This patch renames them to "cc_pending" and "io_pending" to reduce confusion and ease searching the code. Also remove unnecessary initialisation of r in crypt_convert_block(). Signed-off-by: Mikulas Patocka Signed-off-by: Alasdair G Kergon --- drivers/md/dm-crypt.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) Index: rhel6-compile/drivers/md/dm-crypt.c =================================================================== --- rhel6-compile.orig/drivers/md/dm-crypt.c 2014-05-10 16:55:10.000000000 +0200 +++ rhel6-compile/drivers/md/dm-crypt.c 2014-05-10 16:55:11.000000000 +0200 @@ -40,7 +40,7 @@ struct convert_context { unsigned int idx_in; unsigned int idx_out; sector_t sector; - atomic_t pending; + atomic_t cc_pending; }; /* @@ -53,7 +53,7 @@ struct dm_crypt_io { struct convert_context ctx; - atomic_t pending; + atomic_t io_pending; int error; sector_t sector; struct dm_crypt_io *base_io; @@ -512,7 +512,7 @@ static int crypt_convert_block(struct cr struct bio_vec *bv_out = bio_iovec_idx(ctx->bio_out, ctx->idx_out); struct dm_crypt_request *dmreq; u8 *iv; - int r = 0; + int r; dmreq = dmreq_of_req(cc, req); iv = iv_of_dmreq(cc, dmreq); @@ -586,14 +586,14 @@ static int crypt_convert(struct crypt_co struct crypt_cpu *this_cc = this_crypt_config(cc); int r; - atomic_set(&ctx->pending, 1); + atomic_set(&ctx->cc_pending, 1); while(ctx->idx_in < ctx->bio_in->bi_vcnt && ctx->idx_out < ctx->bio_out->bi_vcnt) { crypt_alloc_req(cc, ctx); - atomic_inc(&ctx->pending); + atomic_inc(&ctx->cc_pending); r = crypt_convert_block(cc, ctx, this_cc->req); @@ -610,14 +610,14 @@ static int crypt_convert(struct crypt_co /* sync */ case 0: - atomic_dec(&ctx->pending); + atomic_dec(&ctx->cc_pending); ctx->sector++; cond_resched(); continue; /* error */ default: - atomic_dec(&ctx->pending); + atomic_dec(&ctx->cc_pending); return r; } } @@ -713,14 +713,14 @@ static struct dm_crypt_io *crypt_io_allo io->sector = sector; io->error = 0; io->base_io = NULL; - atomic_set(&io->pending, 0); + atomic_set(&io->io_pending, 0); return io; } static void crypt_inc_pending(struct dm_crypt_io *io) { - atomic_inc(&io->pending); + atomic_inc(&io->io_pending); } /* @@ -735,7 +735,7 @@ static void crypt_dec_pending(struct dm_ struct dm_crypt_io *base_io = io->base_io; int error = io->error; - if (!atomic_dec_and_test(&io->pending)) + if (!atomic_dec_and_test(&io->io_pending)) return; mempool_free(io, cc->io_pool); @@ -931,7 +931,7 @@ static void kcryptd_crypt_write_convert( if (r < 0) io->error = -EIO; - crypt_finished = atomic_dec_and_test(&io->ctx.pending); + crypt_finished = atomic_dec_and_test(&io->ctx.cc_pending); /* Encryption was already finished, submit io now */ if (crypt_finished) { @@ -1005,7 +1005,7 @@ static void kcryptd_crypt_read_convert(s if (r < 0) io->error = -EIO; - if (atomic_dec_and_test(&io->ctx.pending)) + if (atomic_dec_and_test(&io->ctx.cc_pending)) kcryptd_crypt_read_done(io); crypt_dec_pending(io); @@ -1032,7 +1032,7 @@ static void kcryptd_async_done(struct cr mempool_free(req_of_dmreq(cc, dmreq), cc->req_pool); - if (!atomic_dec_and_test(&ctx->pending)) + if (!atomic_dec_and_test(&ctx->cc_pending)) return; if (bio_data_dir(io->base_bio) == READ)