From 07a0a5b5c42e7429c2bb3b7feead23274454eb57 Mon Sep 17 00:00:00 2001
From: Kent Overstreet <kent.overstreet@gmail.com>
Date: Thu, 13 Jun 2019 11:10:11 -0400
Subject: [PATCH] Fix cmd_fs_usage for more than 4 devices

The ioctl returns -ERANGE when there's more devices than fit in the
buffer, not -ENOSPC

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
---
 libbcachefs.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libbcachefs.h b/libbcachefs.h
index d6b8548d..61d0ea8d 100644
--- a/libbcachefs.h
+++ b/libbcachefs.h
@@ -152,7 +152,7 @@ static inline struct bch_ioctl_usage *bchu_usage(struct bchfs_handle fs)
 		if (!ioctl(fs.ioctl_fd, BCH_IOCTL_USAGE, u))
 			return u;
 
-		if (errno != ENOSPC)
+		if (errno != ERANGE)
 			die("BCH_IOCTL_USAGE error: %m");
 		nr_devices *= 2;
 	}