Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 319474
b: refs/heads/master
c: 40b6229
h: refs/heads/master
v: v3
  • Loading branch information
Mikulas Patocka authored and Alasdair G Kergon committed Jul 27, 2012
1 parent 33aa47b commit cd0c6fd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c039c332f23e794deb6d6f37b9f07ff3b27fb2cf
refs/heads/master: 40b6229b69211e24b46868675d4db1dab1a51d96
26 changes: 13 additions & 13 deletions trunk/drivers/md/dm-crypt.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ struct convert_context {
unsigned int idx_in;
unsigned int idx_out;
sector_t sector;
atomic_t pending;
atomic_t cc_pending;
};

/*
Expand All @@ -56,7 +56,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;
Expand Down Expand Up @@ -695,7 +695,7 @@ static int crypt_convert_block(struct crypt_config *cc,
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);
Expand Down Expand Up @@ -769,14 +769,14 @@ static int crypt_convert(struct crypt_config *cc,
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);

Expand All @@ -793,14 +793,14 @@ static int crypt_convert(struct crypt_config *cc,

/* 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;
}
}
Expand Down Expand Up @@ -896,14 +896,14 @@ static struct dm_crypt_io *crypt_io_alloc(struct dm_target *ti,
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);
}

/*
Expand All @@ -918,7 +918,7 @@ static void crypt_dec_pending(struct dm_crypt_io *io)
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);
Expand Down Expand Up @@ -1107,7 +1107,7 @@ static void kcryptd_crypt_write_convert(struct dm_crypt_io *io)
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) {
Expand Down Expand Up @@ -1181,7 +1181,7 @@ static void kcryptd_crypt_read_convert(struct dm_crypt_io *io)
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);
Expand All @@ -1208,7 +1208,7 @@ static void kcryptd_async_done(struct crypto_async_request *async_req,

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)
Expand Down

0 comments on commit cd0c6fd

Please sign in to comment.