From patchwork Thu Jul 27 19:24:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans van Kranenburg X-Patchwork-Id: 9867471 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 693196038C for ; Thu, 27 Jul 2017 19:24:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5C3ED2886A for ; Thu, 27 Jul 2017 19:24:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 514792886D; Thu, 27 Jul 2017 19:24:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7861D2886A for ; Thu, 27 Jul 2017 19:24:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751751AbdG0TYu (ORCPT ); Thu, 27 Jul 2017 15:24:50 -0400 Received: from smtp.dpl.mendix.net ([83.96.177.10]:33556 "EHLO smtp.dpl.mendix.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751672AbdG0TYt (ORCPT ); Thu, 27 Jul 2017 15:24:49 -0400 Received: from mekker.bofh.hq.mendix.net (mekker.bofh.hq.mendix.net [IPv6:2001:828:13c8:10b::21]) by smtp.dpl.mendix.net (Postfix) with ESMTP id 8A8A4200AD for ; Thu, 27 Jul 2017 21:24:46 +0200 (CEST) From: Hans van Kranenburg To: linux-btrfs@vger.kernel.org Subject: [PATCH] btrfs-progs: eliminate bogus IOC_DEV_INFO call Date: Thu, 27 Jul 2017 21:24:46 +0200 Message-Id: <20170727192446.27158-1-hans.van.kranenburg@mendix.com> X-Mailer: git-send-email 2.11.0 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Device ID numbers always start at 1, not at 0. The first IOC_DEV_INFO call does not make sense, since it will always return ENODEV. ioctl(3, BTRFS_IOC_DEV_INFO, {devid=0}) = -1 ENODEV (No such device) Signed-off-by: Hans van Kranenburg --- cmds-fi-usage.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmds-fi-usage.c b/cmds-fi-usage.c index 101a0c4..52c4c62 100644 --- a/cmds-fi-usage.c +++ b/cmds-fi-usage.c @@ -535,7 +535,7 @@ static int load_device_info(int fd, struct device_info **device_info_ptr, return 1; } - for (i = 0, ndevs = 0 ; i <= fi_args.max_id ; i++) { + for (i = 1, ndevs = 0 ; i <= fi_args.max_id ; i++) { if (ndevs >= fi_args.num_devices) { error("unexpected number of devices: %d >= %llu", ndevs, (unsigned long long)fi_args.num_devices);