lkml.org 
[lkml]   [2007]   [May]   [10]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
DateThu, 10 May 2007 11:48:48 +0200 (MEST)
FromJan Engelhardt <>
SubjectRe: [PATCH 002 of 2] md: Improve the is_mddev_idle test
On May 10 2007 16:22, NeilBrown wrote:
>
>diff .prev/drivers/md/md.c ./drivers/md/md.c
>--- .prev/drivers/md/md.c	2007-05-10 15:51:54.000000000 +1000
>+++ ./drivers/md/md.c	2007-05-10 16:05:10.000000000 +1000
>@@ -5095,7 +5095,7 @@ static int is_mddev_idle(mddev_t *mddev)
> 		 *
> 		 * Note: the following is an unsigned comparison.
> 		 */
>-		if ((curr_events - rdev->last_events + 4096) > 8192) {
>+		if ((long)curr_events - (long)rdev->last_events > 4096) {
> 			rdev->last_events = curr_events;
> 			idle = 0;
> 		}

What did really change? Unless I am seriously mistaken,

    curr_events - last_evens + 4096 > 8192
is mathematically equivalent to

    curr_events - last_evens        > 4096
The casting to (long) may however force a signed comparison which turns
things quite upside down, and the comment does not apply anymore.


	Jan
-- 
-
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: 2007-05-10 09:53    [from the cache]
©2003-2008