From patchwork Wed Sep 2 09:39:54 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhaolei X-Patchwork-Id: 7110221 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 6757CBEEC1 for ; Wed, 2 Sep 2015 09:41:46 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A04FF2065E for ; Wed, 2 Sep 2015 09:41:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C78322065D for ; Wed, 2 Sep 2015 09:41:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753060AbbIBJlk (ORCPT ); Wed, 2 Sep 2015 05:41:40 -0400 Received: from cn.fujitsu.com ([59.151.112.132]:17486 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1751578AbbIBJli (ORCPT ); Wed, 2 Sep 2015 05:41:38 -0400 X-IronPort-AV: E=Sophos;i="5.15,520,1432569600"; d="scan'208";a="100278857" Received: from unknown (HELO edo.cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 02 Sep 2015 17:44:38 +0800 Received: from G08CNEXCHPEKD01.g08.fujitsu.local (localhost.localdomain [127.0.0.1]) by edo.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id t829fO3t023636 for ; Wed, 2 Sep 2015 17:41:24 +0800 Received: from localhost.localdomain (10.167.226.114) by G08CNEXCHPEKD01.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server id 14.3.181.6; Wed, 2 Sep 2015 17:41:33 +0800 From: Zhao Lei To: CC: Zhao Lei Subject: [PATCH 1/3] btrfs-progs: use for loop for scan_devices Date: Wed, 2 Sep 2015 17:39:54 +0800 Message-ID: <9446bb8f52e149e387b38f60ab456a7c67022683.1441186744.git.zhaolei@cn.fujitsu.com> X-Mailer: git-send-email 1.8.5.1 In-Reply-To: References: MIME-Version: 1.0 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP for() is more suitable than while() in this code block. Signed-off-by: Zhao Lei --- chunk-recover.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) 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)) {