[dm-devel] [PATCH v5] dm: add unstriped target

Scott Bauer scott.bauer at intel.com
Tue Dec 19 18:13:30 UTC 2017


> +static sector_t map_to_core(struct dm_target *ti, struct bio *bio)
> +{
> +	struct unstripe_c *uc = ti->private;
> +	sector_t sector = bio->bi_iter.bi_sector;
> +
> +	/* Account for what stripe we're operating on */
> +	sector += uc->unstripe_offset;
> +
> +	/* Shift us up to the right "row" on the stripe */
> +	sector += uc->unstripe_width * (sector >> uc->chunk_shift);
> +	return sector;
> +}

This doesn't work anymore, previously we had a "group" local variable,
but removed it out. Now we're calculating the group based *after* we
switch up the stripe.

we need to swap the two sector +=  then it will work:

     /* Shift us up to the right "row" on the stripe */
     sector += uc->unstripe_width * (sector >> uc->chunk_shift);

     /* Account for what stripe we're operating on */
     sector += uc->unstripe_offset;




More information about the dm-devel mailing list