[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [linux-lvm] FW: LVM on Linux

On Tue, Jul 17, 2001 at 12:23:18PM -0700, Ralph Jennings wrote:
> On Tue, Jul 17, 2001 at 05:40:08PM +0100, Joe Thornber wrote:
> [snip]
> >    Here there's one % that we can't get rid of (we could also do chunk = 
> >    sector - (pe_size * index)), for the simple fact that the number of
> >    stripes is not a power of 2, so we can't replace with shifts and masks.
> > 
> >    I just had a chat with one of the EVMS guys, EVMS *does* have this
> >    exact same problem.
> > 
> >    Should we restrict stripes sets to powers of 2 ?
> [snip]
> Why not just make a mod function?
> Preceeding code not tested, but should work?
> It's been a while since I wrote C code.
> BTW, what is a u64 (unsigned 64bit integer) in C called?
> Is there any uniform cross platform way to say it (like
> u64 perhaps)?

long long ?

> u64 mod_64(u64 number, u64 modNum) {
>     while (number > modNum) {
>         number -= modNum;
>     }
>     return number;
> }

I'd like to see the flames if I put this into the driver :) The map
function is called on every io block to an LVM device, it needs to be
quick !  Since we know modNum is smallish, certainly less than 2^32,
and 'number' is 64 bit we could be running around your loop a few
times :)

On a more serious note this function should be provided by the
compiler, since it supports the 64 bit type.  I guess it is normally
implemented in a function that gets linked automatically - it would still
be good to get rid of it.

- Joe

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]