diff mbox

[v2,1/3] btrfs-progs: use for loop for scan_devices

Message ID 62275c5073d7bb4bb2df00b9805ceeb3ef46a422.1441187401.git.zhaolei@cn.fujitsu.com (mailing list archive)
State Superseded
Headers show

Commit Message

Zhaolei Sept. 2, 2015, 9:51 a.m. UTC
for() is more suitable than while() in this code block.

Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
---
 chunk-recover.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
diff mbox

Patch

diff --git a/chunk-recover.c b/chunk-recover.c
index 832b3b1..66a4ce6 100644
--- a/chunk-recover.c
+++ b/chunk-recover.c
@@ -871,8 +871,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;
@@ -880,7 +879,6 @@  static int scan_devices(struct recover_control *rc)
 			cancel_to = devnr - 1;
 			goto out1;
 		}
-		i++;
 	}
 out1:
 	while (ret && (cancel_from <= cancel_to)) {