btrfs-progs: use for loop for scan_devices
authorZhao Lei <zhaolei@cn.fujitsu.com>
Wed, 2 Sep 2015 12:22:29 +0000 (20:22 +0800)
committerDavid Sterba <dsterba@suse.com>
Wed, 2 Sep 2015 16:56:54 +0000 (18:56 +0200)
for() is more suitable than while() in this code block.

Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
chunk-recover.c

index 439599f..3f67432 100644 (file)
@@ -873,8 +873,7 @@ static int scan_devices(struct recover_control *rc)
                devidx++;
        }
 
-       i = 0;
-       while (i < devidx) {
+       for (i = 0; i < devidx; i++) {
                ret = pthread_join(t_scans[i], (void **)&t_rets[i]);
                if (ret || t_rets[i]) {
                        ret = 1;
@@ -882,7 +881,6 @@ static int scan_devices(struct recover_control *rc)
                        cancel_to = devnr - 1;
                        goto out1;
                }
-               i++;
        }
 out1:
        while (ret && (cancel_from <= cancel_to)) {