* [PATCH] btrfs-progs: eliminate bogus IOC_DEV_INFO call
@ 2017-07-27 19:24 Hans van Kranenburg
2017-07-28 9:49 ` Henk Slager
0 siblings, 1 reply; 3+ messages in thread
From: Hans van Kranenburg @ 2017-07-27 19:24 UTC (permalink / raw)
To: linux-btrfs
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] btrfs-progs: eliminate bogus IOC_DEV_INFO call
2017-07-27 19:24 [PATCH] btrfs-progs: eliminate bogus IOC_DEV_INFO call Hans van Kranenburg
@ 2017-07-28 9:49 ` Henk Slager
2017-07-29 20:20 ` Hans van Kranenburg
0 siblings, 1 reply; 3+ messages in thread
From: Henk Slager @ 2017-07-28 9:49 UTC (permalink / raw)
To: Hans van Kranenburg; +Cc: linux-btrfs
On Thu, Jul 27, 2017 at 9:24 PM, Hans van Kranenburg
<hans.van.kranenburg@mendix.com> wrote:
> 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.
When there is a btrfs-replace ongoing, there is a Device ID 0
> 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
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] btrfs-progs: eliminate bogus IOC_DEV_INFO call
2017-07-28 9:49 ` Henk Slager
@ 2017-07-29 20:20 ` Hans van Kranenburg
0 siblings, 0 replies; 3+ messages in thread
From: Hans van Kranenburg @ 2017-07-29 20:20 UTC (permalink / raw)
To: Henk Slager; +Cc: linux-btrfs
On 28/07/2017 11:49, Henk Slager wrote:
> On Thu, Jul 27, 2017 at 9:24 PM, Hans van Kranenburg
> <hans.van.kranenburg@mendix.com> wrote:
>> 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.
>
> When there is a btrfs-replace ongoing, there is a Device ID 0
Aha... thanks for teaching me something new today. :) Actually, I
remember having seen it a time earlier yes.
So, this one goes to /dev/null!
Hans
>
>> 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
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-07-29 20:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-27 19:24 [PATCH] btrfs-progs: eliminate bogus IOC_DEV_INFO call Hans van Kranenburg
2017-07-28 9:49 ` Henk Slager
2017-07-29 20:20 ` Hans van Kranenburg
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.