[dm-devel] [PATCH 1.5/2] dm-stripe: optimize sector division

Mike Snitzer snitzer at redhat.com
Wed Jul 28 13:53:33 UTC 2010


Looking closer I'm seeing something odd:

On Tue, Jul 27 2010 at  6:12pm -0400,
Mikulas Patocka <mpatocka at redhat.com> wrote:

> @@ -212,7 +217,11 @@ static void stripe_map_sector(struct str
>  {
>  	sector_t offset = sector - sc->ti->begin;
>  	sector_t chunk = offset >> sc->chunk_shift;
> -	*stripe = sector_div(chunk, sc->stripes);
> +	if (likely(sc->stripes_shift >= 0))
> +		*stripe = chunk & ((1 << sc->stripes_shift) - 1),
> +		chunk >>= sc->stripes_shift;

What's going on here with the comma?  Shouldn't it be a semi-colon?  And
if so we need curly-braces around the if (likely...).

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




More information about the dm-devel mailing list