uint32_t stripes;
/* The size of this target / num. stripes */
- uint32_t stripe_width;
+ sector_t stripe_width;
/* stripe chunk size */
uint32_t chunk_shift;
return -EINVAL;
}
+ if (((uint32_t)ti->len) & (chunk_size - 1)) {
+ ti->error = "dm-stripe: Target length not divisible by "
+ "chunk size";
+ return -EINVAL;
+ }
+
width = ti->len;
if (sector_div(width, stripes)) {
- ti->error = "dm-stripe: Target length not divisable by "
+ ti->error = "dm-stripe: Target length not divisible by "
"number of stripes";
return -EINVAL;
}
struct stripe_c *sc = (struct stripe_c *) ti->private;
sector_t offset = bio->bi_sector - ti->begin;
- uint32_t chunk = (uint32_t) (offset >> sc->chunk_shift);
- uint32_t stripe = chunk % sc->stripes; /* 32bit modulus */
- chunk = chunk / sc->stripes;
+ sector_t chunk = offset >> sc->chunk_shift;
+ uint32_t stripe = sector_div(chunk, sc->stripes);
bio->bi_bdev = sc->stripe[stripe].dev->bdev;
bio->bi_sector = sc->stripe[stripe].physical_start +
struct stripe_c *sc = (struct stripe_c *) ti->private;
unsigned int sz = 0;
unsigned int i;
- char buffer[32];
switch (type) {
case STATUSTYPE_INFO:
case STATUSTYPE_TABLE:
DMEMIT("%d " SECTOR_FORMAT, sc->stripes, sc->chunk_mask + 1);
- for (i = 0; i < sc->stripes; i++) {
- format_dev_t(buffer, sc->stripe[i].dev->bdev->bd_dev);
- DMEMIT(" %s " SECTOR_FORMAT, buffer,
+ for (i = 0; i < sc->stripes; i++)
+ DMEMIT(" %s " SECTOR_FORMAT, sc->stripe[i].dev->name,
sc->stripe[i].physical_start);
- }
break;
}
return 0;
static struct target_type stripe_target = {
.name = "striped",
- .version= {1, 0, 1},
+ .version= {1, 0, 2},
.module = THIS_MODULE,
.ctr = stripe_ctr,
.dtr = stripe_dtr,