---
daemon/daemon.h | 1 +
daemon/fs-min-size.c | 7 +++++++
daemon/xfs.c | 12 ++++++++++++
generator/actions.ml | 6 +++++-
4 files changed, 25 insertions(+), 1 deletion(-)
diff --git a/daemon/daemon.h b/daemon/daemon.h
index 4a969dd..1f0cd30 100644
--- a/daemon/daemon.h
+++ b/daemon/daemon.h
@@ -269,6 +269,7 @@ extern int copy_xattrs (const char *src, const char *dest);
extern int xfs_set_uuid (const char *device, const char *uuid);
extern int xfs_set_uuid_random (const char *device);
extern int xfs_set_label (const char *device, const char *label);
+extern int64_t xfs_minimum_size (const char *path);
/*-- debug-bmap.c --*/
extern char *debug_bmap (const char *subcmd, size_t argc, char *const *const argv);
diff --git a/daemon/fs-min-size.c b/daemon/fs-min-size.c
index e43237b..432e04f 100644
--- a/daemon/fs-min-size.c
+++ b/daemon/fs-min-size.c
@@ -64,6 +64,13 @@ do_vfs_minimum_size (const mountable_t *mountable)
r = btrfs_minimum_size (path);
}
+ else if (STREQ (vfs_type, "xfs")) {
+ CLEANUP_FREE char *path = get_mount_point (mountable->device);
+ if (path == NULL)
+ return -1;
+ r = xfs_minimum_size (path);
+ }
+
else
NOT_SUPPORTED (-1, "don't know how to get minimum size of '%s'
filesystems",
vfs_type);
diff --git a/daemon/xfs.c b/daemon/xfs.c
index f748902..c4533bf 100644
--- a/daemon/xfs.c
+++ b/daemon/xfs.c
@@ -660,3 +660,15 @@ do_xfs_repair (const char *device,
return r;
}
+
+int64_t
+xfs_minimum_size (const char *path)
+{
+ CLEANUP_FREE guestfs_int_xfsinfo *info = do_xfs_info (path);
+
+ if (info == NULL)
+ return -1;
+
+ // XFS does not support shrinking.
+ return info->xfs_blocksize * info->xfs_datablocks;
+}
diff --git a/generator/actions.ml b/generator/actions.ml
index 8832410..d8af08d 100644
--- a/generator/actions.ml
+++ b/generator/actions.ml
@@ -12765,6 +12765,10 @@ To read the UUID on a filesystem, call
C<guestfs_vfs_uuid>." };
[["mkfs"; "btrfs"; "/dev/sda1"; "";
"NOARG"; ""; ""; "NOARG"];
["mount"; "/dev/sda1"; "/"];
["vfs_minimum_size"; "/dev/sda1"]]), [];
+ InitPartition, Always, TestRun (
+ [["mkfs"; "xfs"; "/dev/sda1"; "";
"NOARG"; ""; ""; "NOARG"];
+ ["mount"; "/dev/sda1"; "/"];
+ ["vfs_minimum_size"; "/dev/sda1"]]), [];
];
shortdesc = "get minimum filesystem size";
longdesc = "\
@@ -12774,7 +12778,7 @@ This is the minimum possible size for filesystem shrinking.
If getting minimum size of specified filesystem is not supported,
this will fail and set errno as ENOTSUP.
-See also L<ntfsresize(8)>, L<resize2fs(8)>, L<btrfs(8)>." };
+See also L<ntfsresize(8)>, L<resize2fs(8)>, L<btrfs(8)>,
L<xfs_info(8)>." };
]
--
1.8.3.1