All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hans van Kranenburg <hans.van.kranenburg@mendix.com>
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	[thread overview]
Message-ID: <20170727192446.27158-1-hans.van.kranenburg@mendix.com> (raw)

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 <hans.van.kranenburg@mendix.com>
---
 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);
-- 
2.11.0


             reply	other threads:[~2017-07-27 19:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-27 19:24 Hans van Kranenburg [this message]
2017-07-28  9:49 ` [PATCH] btrfs-progs: eliminate bogus IOC_DEV_INFO call Henk Slager
2017-07-29 20:20   ` Hans van Kranenburg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170727192446.27158-1-hans.van.kranenburg@mendix.com \
    --to=hans.van.kranenburg@mendix.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.