Re: do_div vs sector_t

Andrew Morton (akpm@osdl.org)
Fri, 11 Jul 2003 23:58:22 -0700


Christoph Hellwig <hch@infradead.org> wrote:
>
> On Fri, Jul 11, 2003 at 11:33:59PM +0100, Matthew Wilcox wrote:
> > aic->seek_mean = aic->seek_total + 128;
> > do_div(aic->seek_mean, aic->seek_samples);
> > }
> >
> > seek_mean is a sector_t so sometimes it's 64-bit on a 32-bit platform.
> > so we can't avoid calling do_div().
>
> That's why we have sector_div, never use do_div on a sector_t.

Thing is, the arith in there can overflow with 32-bit sector_t anyway, so
we need 64-bit quantities regardless of the CONFIG_LBD setting.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/