aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/md.c
diff options
context:
space:
mode:
authorKent Overstreet <koverstreet@google.com>2012-09-26 21:41:20 -0700
committerKent Overstreet <koverstreet@google.com>2013-03-23 14:15:28 -0700
commitfb9e3534768c1daa0bd09dd00d1a8828e15079c8 (patch)
tree0b601dfd5f8aa4dd95dbade3a78d6da176648c42 /drivers/md/md.c
parentf79ea4161434b31e351658283b24e92c3e570142 (diff)
downloadkernel_goldelico_gta04-fb9e3534768c1daa0bd09dd00d1a8828e15079c8.zip
kernel_goldelico_gta04-fb9e3534768c1daa0bd09dd00d1a8828e15079c8.tar.gz
kernel_goldelico_gta04-fb9e3534768c1daa0bd09dd00d1a8828e15079c8.tar.bz2
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/md.c')
-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 fcb878f..d323676 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)
if (offset == 0 && size == bio->bi_size)
return;
- bio->bi_sector += offset;
- bio->bi_size = size;
- offset <<= 9;
clear_bit(BIO_SEG_VALID, &bio->bi_flags);
- while (bio->bi_idx < bio->bi_vcnt &&
- bio->bi_io_vec[bio->bi_idx].bv_len <= offset) {
- /* remove this whole bio_vec */
- offset -= bio->bi_io_vec[bio->bi_idx].bv_len;
- bio->bi_idx++;
- }
- if (bio->bi_idx < bio->bi_vcnt) {
- bio->bi_io_vec[bio->bi_idx].bv_offset += offset;
- bio->bi_io_vec[bio->bi_idx].bv_len -= offset;
- }
+ bio_advance(bio, offset << 9);
+
+ bio->bi_size = size;
+
/* avoid any complications with bi_idx being non-zero*/
if (bio->bi_idx) {
memmove(bio->bi_io_vec, bio->bi_io_vec+bio->bi_idx,