md/raid6: eliminate BUG_ON with side effect
authorDan Williams <dan.j.williams@intel.com>
Wed, 16 Sep 2009 19:11:54 +0000 (12:11 -0700)
committerDan Williams <dan.j.williams@intel.com>
Wed, 16 Sep 2009 19:11:54 +0000 (12:11 -0700)
As pointed out by Neil it should be possible to build a driver with all
BUG_ON statements deleted.  It's bad form to have a BUG_ON with a side
effect.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
drivers/md/raid5.c

index 9b00a22..0a5f03d 100644 (file)
@@ -3214,8 +3214,10 @@ static bool handle_stripe6(struct stripe_head *sh)
                /* now count some things */
                if (test_bit(R5_LOCKED, &dev->flags)) s.locked++;
                if (test_bit(R5_UPTODATE, &dev->flags)) s.uptodate++;
-               if (test_bit(R5_Wantcompute, &dev->flags))
-                       BUG_ON(++s.compute > 2);
+               if (test_bit(R5_Wantcompute, &dev->flags)) {
+                       s.compute++;
+                       BUG_ON(s.compute > 2);
+               }
 
                if (test_bit(R5_Wantfill, &dev->flags)) {
                        s.to_fill++;