From eaaa576f16735905f30523cdabd0d2ead419b5da Mon Sep 17 00:00:00 2001
From: David Sterba <dsterba@suse.com>
Date: Mon, 23 Oct 2023 20:38:17 +0200
Subject: [PATCH] btrfs-progs: device usage: fix error reporting number of
 devices 0 != 1

Due to refactoring in 88c25674c7c0d0 ("btrfs-progs: convert device info
to struct array") the variable tracking number of devices was not
updated and led to an error.

  $ btrfs device usage /path
  ERROR: unexpected number of devices: 0 != 1
  ...

Issue: #697
Signed-off-by: David Sterba <dsterba@suse.com>
---
 cmds/filesystem-usage.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/cmds/filesystem-usage.c b/cmds/filesystem-usage.c
index 33358bf9d..0db91e9c5 100644
--- a/cmds/filesystem-usage.c
+++ b/cmds/filesystem-usage.c
@@ -807,6 +807,7 @@ static int load_device_info(int fd, struct array *devinfos)
 				device_get_partition_size((const char *)dev_info.path);
 		}
 		info->size = dev_info.total_bytes;
+		ndevs++;
 	}
 
 	if (ndevs != fi_args.num_devices) {
