]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
Add reflink support for ZFS.
authorChester Gregg <chetgregg@outlook.com>
Thu, 28 Aug 2025 02:22:30 +0000 (02:22 +0000)
committerChester Gregg <chetgregg@outlook.com>
Thu, 28 Aug 2025 02:22:30 +0000 (02:22 +0000)
OpenZFS has added the block cloning feature, which implements reflinks for its copy-on-write filesystem. It is now stable and enabled by default on OpenZFS 2.3.0.

include/statfs_magic.h
misc-utils/hardlink.1.adoc
misc-utils/hardlink.c

index e87b7847430f5a46b79f086b0a049cb48bfb9929..857058a7314f722291899f8d41a0e5465421da36 100644 (file)
 #define STATFS_VXFS_MAGIC      0xa501FCF5
 #define STATFS_XENFS_MAGIC     0xabba1974
 #define STATFS_XFS_MAGIC       0x58465342
+#define STATFS_ZFS_MAGIC       0x2FC12FC1
 
 #endif /* UTIL_LINUX_STATFS_MAGIC_H */
 
index 613f7a1d4a97f2c432b34f89d509fbdb4a69d41e..29d6dca3e6cca23c9fbabf922f9de28b7e64969a 100644 (file)
@@ -108,7 +108,7 @@ This option implies *--skip-reflinks* to ignore already cloned files.
 +
 The optional argument _when_ can be *never*, *always*, or *auto*. If the _when_ argument
 is omitted, it defaults to *auto*, which means that *hardlink* checks the filesystem type
-and uses reflinks on BTRFS and XFS only, and falls back to hardlinks when creating a
+and uses reflinks on BTRFS, XFS and ZFS only, and falls back to hardlinks when creating a
 reflink is impossible.
 The argument *always* disables filesystem-type detection and the fallback to hardlinks,
 which means that only reflinks are allowed.
index cd28fe01890c0cd5545448d100c68bd3aa1c6f2d..114b5c4c940f82fac336d5d0a31aba3e9a3938fd 100644 (file)
@@ -974,6 +974,7 @@ static int is_reflink_compatible(dev_t devno, const char *filename)
                switch (vfs.f_type) {
                        case STATFS_BTRFS_MAGIC:
                        case STATFS_XFS_MAGIC:
+                       case STATFS_ZFS_MAGIC:
                                last_status = 1;
                                break;
                        default: