From patchwork Tue May 13 09:05:05 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wang Shilong X-Patchwork-Id: 4163781 X-Patchwork-Delegate: dave@jikos.cz 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.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id BE072BFF02 for ; Tue, 13 May 2014 09:08:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0028320340 for ; Tue, 13 May 2014 09:08:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1FAFF200E6 for ; Tue, 13 May 2014 09:08:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932790AbaEMJI3 (ORCPT ); Tue, 13 May 2014 05:08:29 -0400 Received: from cn.fujitsu.com ([59.151.112.132]:62849 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S932281AbaEMJIX (ORCPT ); Tue, 13 May 2014 05:08:23 -0400 X-IronPort-AV: E=Sophos;i="4.97,1042,1389715200"; d="scan'208";a="30447431" Received: from unknown (HELO edo.cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 13 May 2014 17:05:50 +0800 Received: from G08CNEXCHPEKD03.g08.fujitsu.local (localhost.localdomain [127.0.0.1]) by edo.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id s4D98LOH025709 for ; Tue, 13 May 2014 17:08:21 +0800 Received: from wangs.fnst.cn.fujitsu.com (10.167.226.104) by G08CNEXCHPEKD03.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.146.2; Tue, 13 May 2014 17:08:27 +0800 From: Wang Shilong To: Subject: [PATCH] Btrfs-progs: save us an unnecessary ioctl call Date: Tue, 13 May 2014 17:05:05 +0800 Message-ID: <1399971906-1237-1-git-send-email-wangsl.fnst@cn.fujitsu.com> X-Mailer: git-send-email 1.9.0 MIME-Version: 1.0 X-Originating-IP: [10.167.226.104] Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 Btrfs device id start from 1, not 0. Signed-off-by: Wang Shilong --- utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils.c b/utils.c index 560c557..d480353 100644 --- a/utils.c +++ b/utils.c @@ -1765,7 +1765,7 @@ int get_fs_info(char *path, struct btrfs_ioctl_fs_info_args *fi_args, goto out; } - for (; i <= fi_args->max_id; ++i) { + for (i = 1; i <= fi_args->max_id; ++i) { BUG_ON(ndevs >= fi_args->num_devices); ret = get_device_info(fd, i, &di_args[ndevs]); if (ret == -ENODEV)