drivers/block/as-iosched.c | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-) diff -puN drivers/block/as-iosched.c~as-div-by-zero-fix drivers/block/as-iosched.c --- 25/drivers/block/as-iosched.c~as-div-by-zero-fix 2003-03-08 00:06:16.000000000 -0800 +++ 25-akpm/drivers/block/as-iosched.c 2003-03-08 00:07:28.000000000 -0800 @@ -496,9 +496,9 @@ static void as_antic_waitnext(struct as_ static void as_update_iohist(struct as_io_context *aic) { unsigned i; - unsigned long thinktime, - total = 0, - num = 0; + unsigned long thinktime; + unsigned long total = 0; + unsigned long num = 0; if (aic == NULL) return; @@ -516,7 +516,8 @@ static void as_update_iohist(struct as_i aic->thinktime[i] = (tt>>1) + (tt>>2); /* 75% decay */ } /* fixed point factor is cancelled here */ - aic->mean_thinktime = total / num; + if (num) + aic->mean_thinktime = total / num; } } _