[PATCH 03/12] libfrog: try the v4 fs geometry ioctl after failing the v5 ioctl

Darrick J. Wong
2019-08-20T20:31:35Z

From: Darrick J. Wong <darrick.wong@oracle.com>

If a v5 fs geometry query fails, try the v4 interface before falling
back to the v1 interface.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
libfrog/fsgeom.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/libfrog/fsgeom.c b/libfrog/fsgeom.c
index a3b748f8..06e4e663 100644
--- a/libfrog/fsgeom.c
+++ b/libfrog/fsgeom.c
@@ -84,6 +84,10 @@ xfrog_geometry(
if (!ret)
return 0;

+ ret = ioctl(fd, XFS_IOC_FSGEOMETRY_V4, fsgeo);
+ if (!ret)
+ return 0;
+
return ioctl(fd, XFS_IOC_FSGEOMETRY_V1, fsgeo);
}