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.
#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 */
+
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.
switch (vfs.f_type) {
case STATFS_BTRFS_MAGIC:
case STATFS_XFS_MAGIC:
+ case STATFS_ZFS_MAGIC:
last_status = 1;
break;
default: