lkml.org 
[lkml]   [2003]   [Jul]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: 2.5.75 as-iosched.c & asm-generic/div64.h breakage
Hi!

Paul Mackerras wrote:

>Andrew Morton writes:
>
>
>>Mikael Pettersson <mikpe@csd.uu.se> wrote:
>>
>>>drivers/block/as-iosched.c: In function `as_update_iohist':
>>>drivers/block/as-iosched.c:840: warning: right shift count >= width of type
>>>drivers/block/as-iosched.c:840: warning: passing arg 1 of `__div64_32' from incompatible pointer type
>>>
>>You mean that code was in -mm for all those months and no ppc32 person
>>bothered testing it? Bah.
>>
>
>We've only been getting those warnings since the changeover to the new
>asm-generic/div64.h. Settle down. :)
>
>
>>Something like this? (Could be sped up for 32-bit sector_t)
>>
>>diff -puN drivers/block/as-iosched.c~as-do_div-fix drivers/block/as-iosched.c
>>--- 25/drivers/block/as-iosched.c~as-do_div-fix Fri Jul 11 14:00:55 2003
>>+++ 25-akpm/drivers/block/as-iosched.c Fri Jul 11 14:00:58 2003
>>@@ -836,8 +836,10 @@ static void as_update_iohist(struct as_i
>> aic->seek_samples += 256;
>> aic->seek_total += 256*seek_dist;
>> if (aic->seek_samples) {
>>- aic->seek_mean = aic->seek_total + 128;
>>- do_div(aic->seek_mean, aic->seek_samples);
>>+ u64 seek_mean = aic->seek_total + 128;
>>+
>>+ do_div(seek_mean, aic->seek_samples);
>>+ aic->seek_mean = seek_mean;
>> }
>>
>
>There are several interesting aspects to this:
>
>1. For some reason the LBD config option in drivers/block/Kconfig
> depends on X86. (CONFIG_LBD is what makes sector_t an unsigned
> long long instead of an unsigned long). I think the LBD option
> should be available on all 32-bit platforms. Working out a neat
> way to tell the config system that is left as an exercise for the
> reader. :)
>

Not me :P

>
>2. It seems to me that seek_total is bounded above by 1024 * the
> maximum seek distance. I'm a bit concerned about that overflowing
> 32 bits - AFAICS I would only need a > 2GB disk (or do I mean
> partition?) for that to happen. Could we make seek_total be a u64
> unconditionally please?
>

Probably a good idea. It is only the seek distance for one
process though. But it wouldn't hurt.

>
>3. I guess that adding 128 on to the seek_total is to get a
> round-to-nearest effect in the division. In fact you need to add
> on (seek_samples >> 1) to get that effect.
>

You're right. Thanks.


-
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/

\
 
 \ /
  Last update: 2005-03-22 13:46    [W:0.506 / U:0.548 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site