raid1: simplify raid1_error function
authorYufen Yu <yuyufen@huawei.com>
Fri, 1 Feb 2019 02:45:01 +0000 (10:45 +0800)
committerSong Liu <songliubraving@fb.com>
Mon, 4 Feb 2019 18:37:11 +0000 (10:37 -0800)
Remove redundance set_bit and let code simplify.

Signed-off-by: Yufen Yu <yuyufen@huawei.com>
Signed-off-by: Song Liu <songliubraving@fb.com>
drivers/md/raid1.c

index 1d54109071cc87a0f95be9aec0801072389fcedf..7e63ccc4ae7b41c5f00191c8b91f9cbc62b502df 100644 (file)
@@ -1603,11 +1603,9 @@ static void raid1_error(struct mddev *mddev, struct md_rdev *rdev)
                return;
        }
        set_bit(Blocked, &rdev->flags);
-       if (test_and_clear_bit(In_sync, &rdev->flags)) {
+       if (test_and_clear_bit(In_sync, &rdev->flags))
                mddev->degraded++;
-               set_bit(Faulty, &rdev->flags);
-       } else
-               set_bit(Faulty, &rdev->flags);
+       set_bit(Faulty, &rdev->flags);
        spin_unlock_irqrestore(&conf->device_lock, flags);
        /*
         * if recovery is running, make sure it aborts.