Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 209171
b: refs/heads/master
c: 6598852
h: refs/heads/master
i:
  209169: 20692f9
  209167: 8151a19
v: v3
  • Loading branch information
Mikulas Patocka authored and Alasdair G Kergon committed Aug 12, 2010
1 parent 03eb749 commit af4cd78
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 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: 38e1b257fd7b4f3eee667d29a5e44ec15e253c1c
refs/heads/master: 65988525abde0b0a5833c4e20f32967184a5dcf0
21 changes: 14 additions & 7 deletions trunk/drivers/md/dm-stripe.c
Original file line number Diff line number Diff line change
Expand Up @@ -207,11 +207,20 @@ static void stripe_dtr(struct dm_target *ti)
kfree(sc);
}

static void stripe_map_sector(struct stripe_c *sc, sector_t sector,
uint32_t *stripe, sector_t *result)
{
sector_t offset = dm_target_offset(sc->ti, sector);
sector_t chunk = offset >> sc->chunk_shift;

*stripe = sector_div(chunk, sc->stripes);
*result = (chunk << sc->chunk_shift) | (offset & sc->chunk_mask);
}

static int stripe_map(struct dm_target *ti, struct bio *bio,
union map_info *map_context)
{
struct stripe_c *sc = (struct stripe_c *) ti->private;
sector_t offset, chunk;
struct stripe_c *sc = ti->private;
uint32_t stripe;
unsigned target_request_nr;

Expand All @@ -222,13 +231,11 @@ static int stripe_map(struct dm_target *ti, struct bio *bio,
return DM_MAPIO_REMAPPED;
}

offset = dm_target_offset(ti, bio->bi_sector);
chunk = offset >> sc->chunk_shift;
stripe = sector_div(chunk, sc->stripes);
stripe_map_sector(sc, bio->bi_sector, &stripe, &bio->bi_sector);

bio->bi_sector += sc->stripe[stripe].physical_start;
bio->bi_bdev = sc->stripe[stripe].dev->bdev;
bio->bi_sector = sc->stripe[stripe].physical_start +
(chunk << sc->chunk_shift) + (offset & sc->chunk_mask);

return DM_MAPIO_REMAPPED;
}

Expand Down

0 comments on commit af4cd78

Please sign in to comment.