Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 22427
b: refs/heads/master
c: d2044a9
h: refs/heads/master
i:
  22425: 3eacfa1
  22423: a450c9b
v: v3
  • Loading branch information
Alasdair G Kergon authored and Linus Torvalds committed Mar 22, 2006
1 parent b7a89a3 commit 5aa4186
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 20 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 06f9d4f94a075285d25253edbf57f2cda07d4ff3
refs/heads/master: d2044a94e80b61f68ee7456f82d9b443e9ff6ac7
43 changes: 24 additions & 19 deletions trunk/drivers/md/dm.c
Original file line number Diff line number Diff line change
Expand Up @@ -533,30 +533,35 @@ static void __clone_and_map(struct clone_info *ci)

} else {
/*
* Create two copy bios to deal with io that has
* been split across a target.
* Handle a bvec that must be split between two or more targets.
*/
struct bio_vec *bv = bio->bi_io_vec + ci->idx;
sector_t remaining = to_sector(bv->bv_len);
unsigned int offset = 0;

clone = split_bvec(bio, ci->sector, ci->idx,
bv->bv_offset, max);
__map_bio(ti, clone, tio);
do {
if (offset) {
ti = dm_table_find_target(ci->map, ci->sector);
max = max_io_len(ci->md, ci->sector, ti);

ci->sector += max;
ci->sector_count -= max;
ti = dm_table_find_target(ci->map, ci->sector);

len = to_sector(bv->bv_len) - max;
clone = split_bvec(bio, ci->sector, ci->idx,
bv->bv_offset + to_bytes(max), len);
tio = alloc_tio(ci->md);
tio->io = ci->io;
tio->ti = ti;
memset(&tio->info, 0, sizeof(tio->info));
__map_bio(ti, clone, tio);
tio = alloc_tio(ci->md);
tio->io = ci->io;
tio->ti = ti;
memset(&tio->info, 0, sizeof(tio->info));
}

len = min(remaining, max);

clone = split_bvec(bio, ci->sector, ci->idx,
bv->bv_offset + offset, len);

__map_bio(ti, clone, tio);

ci->sector += len;
ci->sector_count -= len;
offset += to_bytes(len);
} while (remaining -= len);

ci->sector += len;
ci->sector_count -= len;
ci->idx++;
}
}
Expand Down

0 comments on commit 5aa4186

Please sign in to comment.