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

dm crypt: remove unnecessary crypt_context write parm

Remove write attribute from convert_context and use bio flag instead.
Signed-off-by: default avatarMilan Broz <mbroz@redhat.com>
Signed-off-by: default avatarAlasdair G Kergon <agk@redhat.com>
parent 53017030
...@@ -38,7 +38,6 @@ struct convert_context { ...@@ -38,7 +38,6 @@ struct convert_context {
unsigned int idx_in; unsigned int idx_in;
unsigned int idx_out; unsigned int idx_out;
sector_t sector; sector_t sector;
int write;
}; };
/* /*
...@@ -327,7 +326,7 @@ crypt_convert_scatterlist(struct crypt_config *cc, struct scatterlist *out, ...@@ -327,7 +326,7 @@ crypt_convert_scatterlist(struct crypt_config *cc, struct scatterlist *out,
static void crypt_convert_init(struct crypt_config *cc, static void crypt_convert_init(struct crypt_config *cc,
struct convert_context *ctx, struct convert_context *ctx,
struct bio *bio_out, struct bio *bio_in, struct bio *bio_out, struct bio *bio_in,
sector_t sector, int write) sector_t sector)
{ {
ctx->bio_in = bio_in; ctx->bio_in = bio_in;
ctx->bio_out = bio_out; ctx->bio_out = bio_out;
...@@ -336,7 +335,6 @@ static void crypt_convert_init(struct crypt_config *cc, ...@@ -336,7 +335,6 @@ static void crypt_convert_init(struct crypt_config *cc,
ctx->idx_in = bio_in ? bio_in->bi_idx : 0; ctx->idx_in = bio_in ? bio_in->bi_idx : 0;
ctx->idx_out = bio_out ? bio_out->bi_idx : 0; ctx->idx_out = bio_out ? bio_out->bi_idx : 0;
ctx->sector = sector + cc->iv_offset; ctx->sector = sector + cc->iv_offset;
ctx->write = write;
} }
/* /*
...@@ -372,7 +370,7 @@ static int crypt_convert(struct crypt_config *cc, ...@@ -372,7 +370,7 @@ static int crypt_convert(struct crypt_config *cc,
} }
r = crypt_convert_scatterlist(cc, &sg_out, &sg_in, sg_in.length, r = crypt_convert_scatterlist(cc, &sg_out, &sg_in, sg_in.length,
ctx->write, ctx->sector); bio_data_dir(ctx->bio_in) == WRITE, ctx->sector);
if (r < 0) if (r < 0)
break; break;
...@@ -587,7 +585,7 @@ static void process_write(struct dm_crypt_io *io) ...@@ -587,7 +585,7 @@ static void process_write(struct dm_crypt_io *io)
atomic_inc(&io->pending); atomic_inc(&io->pending);
crypt_convert_init(cc, &io->ctx, NULL, base_bio, sector, 1); crypt_convert_init(cc, &io->ctx, NULL, base_bio, sector);
/* /*
* The allocated buffers can be smaller than the whole bio, * The allocated buffers can be smaller than the whole bio,
...@@ -638,7 +636,7 @@ static void process_read_endio(struct dm_crypt_io *io) ...@@ -638,7 +636,7 @@ static void process_read_endio(struct dm_crypt_io *io)
struct crypt_config *cc = io->target->private; struct crypt_config *cc = io->target->private;
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->base_bio->bi_sector - io->target->begin, 0); io->base_bio->bi_sector - io->target->begin);
crypt_dec_pending(io, crypt_convert(cc, &io->ctx)); crypt_dec_pending(io, crypt_convert(cc, &io->ctx));
} }
......
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