From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mike Snitzer Subject: Re: [PATCH 1.5/2] dm-stripe: optimize sector division Date: Wed, 28 Jul 2010 09:53:33 -0400 Message-ID: <20100728135332.GA31387@redhat.com> References: Reply-To: device-mapper development Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com To: Mikulas Patocka Cc: dm-devel@redhat.com, Alasdair G Kergon List-Id: dm-devel.ids Looking closer I'm seeing something odd: On Tue, Jul 27 2010 at 6:12pm -0400, Mikulas Patocka 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); > }