]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
resize-fs: add helper that checks if the specified fs can do online grow/shrink
authorLennart Poettering <lennart@poettering.net>
Fri, 15 Oct 2021 15:53:48 +0000 (17:53 +0200)
committerLennart Poettering <lennart@poettering.net>
Tue, 16 Nov 2021 16:18:07 +0000 (17:18 +0100)
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.

src/shared/resize-fs.c
src/shared/resize-fs.h

index 33cb78babfb83c23fe2692813c04256c52a2a432..178aefac214d3d6a31b23bd25c6f71a1ffb3d2ad 100644 (file)
@@ -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;
+}
index 8831fd8b409069bb312e8cc53f4539dc3a5b9527..312005f7e21f7e1587c38fe8237447ba57aec336 100644 (file)
@@ -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);