<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">From: Milan Broz &lt;mbroz@redhat.com&gt;

Remove write attribute from convert_context and use bio flag instead.

Signed-off-by: Milan Broz &lt;mbroz@redhat.com&gt;
Signed-off-by: Alasdair G Kergon &lt;agk@redhat.com&gt;
---
 drivers/md/dm-crypt.c |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)

Index: linux-2.6.24/drivers/md/dm-crypt.c
===================================================================
--- linux-2.6.24.orig/drivers/md/dm-crypt.c	2008-02-07 13:48:27.000000000 +0000
+++ linux-2.6.24/drivers/md/dm-crypt.c	2008-02-07 13:48:28.000000000 +0000
@@ -38,7 +38,6 @@ struct convert_context {
 	unsigned int idx_in;
 	unsigned int idx_out;
 	sector_t sector;
-	int write;
 };
 
 /*
@@ -327,7 +326,7 @@ crypt_convert_scatterlist(struct crypt_c
 static void crypt_convert_init(struct crypt_config *cc,
 			       struct convert_context *ctx,
 			       struct bio *bio_out, struct bio *bio_in,
-			       sector_t sector, int write)
+			       sector_t sector)
 {
 	ctx-&gt;bio_in = bio_in;
 	ctx-&gt;bio_out = bio_out;
@@ -336,7 +335,6 @@ static void crypt_convert_init(struct cr
 	ctx-&gt;idx_in = bio_in ? bio_in-&gt;bi_idx : 0;
 	ctx-&gt;idx_out = bio_out ? bio_out-&gt;bi_idx : 0;
 	ctx-&gt;sector = sector + cc-&gt;iv_offset;
-	ctx-&gt;write = write;
 }
 
 /*
@@ -372,7 +370,7 @@ static int crypt_convert(struct crypt_co
 		}
 
 		r = crypt_convert_scatterlist(cc, &amp;sg_out, &amp;sg_in, sg_in.length,
-					      ctx-&gt;write, ctx-&gt;sector);
+			bio_data_dir(ctx-&gt;bio_in) == WRITE, ctx-&gt;sector);
 		if (r &lt; 0)
 			break;
 
@@ -587,7 +585,7 @@ static void process_write(struct dm_cryp
 
 	atomic_inc(&amp;io-&gt;pending);
 
-	crypt_convert_init(cc, &amp;io-&gt;ctx, NULL, base_bio, sector, 1);
+	crypt_convert_init(cc, &amp;io-&gt;ctx, NULL, base_bio, sector);
 
 	/*
 	 * The allocated buffers can be smaller than the whole bio,
@@ -638,7 +636,7 @@ static void process_read_endio(struct dm
 	struct crypt_config *cc = io-&gt;target-&gt;private;
 
 	crypt_convert_init(cc, &amp;io-&gt;ctx, io-&gt;base_bio, io-&gt;base_bio,
-			   io-&gt;base_bio-&gt;bi_sector - io-&gt;target-&gt;begin, 0);
+			   io-&gt;base_bio-&gt;bi_sector - io-&gt;target-&gt;begin);
 
 	crypt_dec_pending(io, crypt_convert(cc, &amp;io-&gt;ctx));
 }
</pre></body></html>