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

Arnd Bergmann arnd at arndb.de
Sun Jun 3 18:07:36 EDT 2007


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.

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

	Arnd <><


More information about the linux-mtd mailing list