aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
authorMilan Broz <mbroz@redhat.com>2008-02-07 21:10:41 -0500
committerAlasdair G Kergon <agk@redhat.com>2008-02-07 21:10:41 -0500
commitfcd369daa36d547607dbedd0b41099d6dfc1d1c7 (patch)
tree456f6369cb9f16bd4575442d5729f9d03efb4620 /drivers/md
parent53017030e2548dffbe481fb4ab6b587abbee6f8b (diff)
dm crypt: remove unnecessary crypt_context write parm
Remove write attribute from convert_context and use bio flag instead. Signed-off-by: Milan Broz <mbroz@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/dm-crypt.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c
index af8cd99daa5b..862ce9f6faac 100644
--- a/drivers/md/dm-crypt.c
+++ b/drivers/md/dm-crypt.c
@@ -38,7 +38,6 @@ struct convert_context {
38 unsigned int idx_in; 38 unsigned int idx_in;
39 unsigned int idx_out; 39 unsigned int idx_out;
40 sector_t sector; 40 sector_t sector;
41 int write;
42}; 41};
43 42
44/* 43/*
@@ -327,7 +326,7 @@ crypt_convert_scatterlist(struct crypt_config *cc, struct scatterlist *out,
327static void crypt_convert_init(struct crypt_config *cc, 326static void crypt_convert_init(struct crypt_config *cc,
328 struct convert_context *ctx, 327 struct convert_context *ctx,
329 struct bio *bio_out, struct bio *bio_in, 328 struct bio *bio_out, struct bio *bio_in,
330 sector_t sector, int write) 329 sector_t sector)
331{ 330{
332 ctx->bio_in = bio_in; 331 ctx->bio_in = bio_in;
333 ctx->bio_out = bio_out; 332 ctx->bio_out = bio_out;
@@ -336,7 +335,6 @@ static void crypt_convert_init(struct crypt_config *cc,
336 ctx->idx_in = bio_in ? bio_in->bi_idx : 0; 335 ctx->idx_in = bio_in ? bio_in->bi_idx : 0;
337 ctx->idx_out = bio_out ? bio_out->bi_idx : 0; 336 ctx->idx_out = bio_out ? bio_out->bi_idx : 0;
338 ctx->sector = sector + cc->iv_offset; 337 ctx->sector = sector + cc->iv_offset;
339 ctx->write = write;
340} 338}
341 339
342/* 340/*
@@ -372,7 +370,7 @@ static int crypt_convert(struct crypt_config *cc,
372 } 370 }
373 371
374 r = crypt_convert_scatterlist(cc, &sg_out, &sg_in, sg_in.length, 372 r = crypt_convert_scatterlist(cc, &sg_out, &sg_in, sg_in.length,
375 ctx->write, ctx->sector); 373 bio_data_dir(ctx->bio_in) == WRITE, ctx->sector);
376 if (r < 0) 374 if (r < 0)
377 break; 375 break;
378 376
@@ -587,7 +585,7 @@ static void process_write(struct dm_crypt_io *io)
587 585
588 atomic_inc(&io->pending); 586 atomic_inc(&io->pending);
589 587
590 crypt_convert_init(cc, &io->ctx, NULL, base_bio, sector, 1); 588 crypt_convert_init(cc, &io->ctx, NULL, base_bio, sector);
591 589
592 /* 590 /*
593 * The allocated buffers can be smaller than the whole bio, 591 * 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 struct crypt_config *cc = io->target->private; 636 struct crypt_config *cc = io->target->private;
639 637
640 crypt_convert_init(cc, &io->ctx, io->base_bio, io->base_bio, 638 crypt_convert_init(cc, &io->ctx, io->base_bio, io->base_bio,
641 io->base_bio->bi_sector - io->target->begin, 0); 639 io->base_bio->bi_sector - io->target->begin);
642 640
643 crypt_dec_pending(io, crypt_convert(cc, &io->ctx)); 641 crypt_dec_pending(io, crypt_convert(cc, &io->ctx));
644} 642}