summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2021-10-15 17:53:48 +0200
committerLennart Poettering <lennart@poettering.net>2021-11-16 17:18:07 +0100
commit61fa16c1ca0d60dfcc2fc759171461de55e768ad (patch)
treec740dbb048337ffafdd807633846325c72c24800
parent4e6e72f10b407dfc5ab8006d2aa2a3550af6ef46 (diff)
downloadsystemd-61fa16c1ca0d60dfcc2fc759171461de55e768ad.tar.gz
resize-fs: add helper that checks if the specified fs can do online grow/shrink
There's only one that can do this (btrfs), but let's abstract that fact, a bit in case the other file systems learn this too one day.
-rw-r--r--src/shared/resize-fs.c5
-rw-r--r--src/shared/resize-fs.h2
2 files changed, 7 insertions, 0 deletions
diff --git a/src/shared/resize-fs.c b/src/shared/resize-fs.c
index 33cb78babf..178aefac21 100644
--- a/src/shared/resize-fs.c
+++ b/src/shared/resize-fs.c
@@ -119,3 +119,8 @@ uint64_t minimal_size_by_fs_name(const char *name) {
return UINT64_MAX;
}
+
+/* Returns true for the only fs that can online shrink *and* grow */
+bool fs_can_online_shrink_and_grow(statfs_f_type_t magic) {
+ return magic == (statfs_f_type_t) BTRFS_SUPER_MAGIC;
+}
diff --git a/src/shared/resize-fs.h b/src/shared/resize-fs.h
index 8831fd8b40..312005f7e2 100644
--- a/src/shared/resize-fs.h
+++ b/src/shared/resize-fs.h
@@ -13,3 +13,5 @@ int resize_fs(int fd, uint64_t sz, uint64_t *ret_size);
uint64_t minimal_size_by_fs_magic(statfs_f_type_t magic);
uint64_t minimal_size_by_fs_name(const char *str);
+
+bool fs_can_online_shrink_and_grow(statfs_f_type_t magic);