aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
authorKent Overstreet <koverstreet@google.com>2012-09-27 00:41:20 -0400
committerKent Overstreet <koverstreet@google.com>2013-03-23 17:15:28 -0400
commitfb9e3534768c1daa0bd09dd00d1a8828e15079c8 (patch)
tree0b601dfd5f8aa4dd95dbade3a78d6da176648c42 /drivers/md
parentf79ea4161434b31e351658283b24e92c3e570142 (diff)
md: Convert md_trim_bio() to use bio_advance()
Signed-off-by: Kent Overstreet <koverstreet@google.com> CC: Jens Axboe <axboe@kernel.dk> CC: NeilBrown <neilb@suse.de> Acked-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/md.c17
1 files changed, 4 insertions, 13 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index fcb878f88796..d323676580a9 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -194,21 +194,12 @@ void md_trim_bio(struct bio *bio, int offset, int size)
194 if (offset == 0 && size == bio->bi_size) 194 if (offset == 0 && size == bio->bi_size)
195 return; 195 return;
196 196
197 bio->bi_sector += offset;
198 bio->bi_size = size;
199 offset <<= 9;
200 clear_bit(BIO_SEG_VALID, &bio->bi_flags); 197 clear_bit(BIO_SEG_VALID, &bio->bi_flags);
201 198
202 while (bio->bi_idx < bio->bi_vcnt && 199 bio_advance(bio, offset << 9);
203 bio->bi_io_vec[bio->bi_idx].bv_len <= offset) { 200
204 /* remove this whole bio_vec */ 201 bio->bi_size = size;
205 offset -= bio->bi_io_vec[bio->bi_idx].bv_len; 202
206 bio->bi_idx++;
207 }
208 if (bio->bi_idx < bio->bi_vcnt) {
209 bio->bi_io_vec[bio->bi_idx].bv_offset += offset;
210 bio->bi_io_vec[bio->bi_idx].bv_len -= offset;
211 }
212 /* avoid any complications with bi_idx being non-zero*/ 203 /* avoid any complications with bi_idx being non-zero*/
213 if (bio->bi_idx) { 204 if (bio->bi_idx) {
214 memmove(bio->bi_io_vec, bio->bi_io_vec+bio->bi_idx, 205 memmove(bio->bi_io_vec, bio->bi_io_vec+bio->bi_idx,