Re: [Patch 09/18] fs/logfs/gc.c

From: JÃrn Engel
Date: Mon Jun 04 2007 - 05:06:22 EST


On Mon, 4 June 2007 00:07:36 +0200, Arnd Bergmann wrote:
> On Sunday 03 June 2007, JÃrn Engel wrote:
> > +static long decay(long t0, long t, long theta)
> > +{
> > +ÂÂÂÂÂÂÂlong shift, fac;
> > +
> > +ÂÂÂÂÂÂÂif (t >= 32*theta)
> > +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂreturn 0;
> > +
> > +ÂÂÂÂÂÂÂshift = t/theta;
> > +ÂÂÂÂÂÂÂfac = theta - (t%theta)/2;
> > +ÂÂÂÂÂÂÂreturn (t0 >> shift) * fac / theta;
> > +}
>
> I think it's confusion to work with 'long' arguments
> here. If you actually allow larger than 32 bit arguments,
> that means that the gc logic behaves differently on
> 32 and 64 bit CPUs, which I don't think is what you
> intended.

Different behaviour would be fine. This function will be used to pick
good candidates for garbage collection. If one segment will get chosen
over another depending on BITS_PER_LONG, either one would have been a
good candidate anyway.

Hmm. Maybe I should s/32/BITS_PER_LONG/ in the function.

> Also, can any of the arguments be negative? How about
> making them all explicit u32 and u64 variables?

That would make sense, yes.

JÃrn

--
I've never met a human being who would want to read 17,000 pages of
documentation, and if there was, I'd kill him to get him out of the
gene pool.
-- Joseph Costello
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/