openzfs / zfs

OpenZFS on Linux and FreeBSD
https://openzfs.github.io/openzfs-docs
Other
10.43k stars 1.73k forks source link

Implement FSMAP ioctl feature on Linux #16440

Open mappu opened 1 month ago

mappu commented 1 month ago

Describe the feature would like to see added to OpenZFS

Implementation of the FSMAP feature on Linux

How will this feature improve OpenZFS?

The FSMAP feature (FS_IOC_GETFSMAP ioctl) is Linux's standard way to enumerate a filesystem's extents with respect to an underlying block device, and categorise them based on what the filesystem uses them for (e.g. sectors are free, or, in use for XYZ purpose).

It was added in Kernel 4.12 (2017) for the EXT4 and XFS filesystems.

The FSMAP ioctl can report an extent as being of various types. There are some common kernel-wide types such as FMR_OWN_FREE for unused byte extent ranges, but also filesystem-specific types for specific filesystems if they feel inclined to report in more detail.

The FSMAP ioctl with FMR_OWN_FREE is used by backup software to skip over unused filesystem sectors during a block device backup.

If the ZFS linux driver supported this ioctl, it would improve the performance of using ZFS with bare-metal backup software.

Additional context

tonyhutter commented 1 month ago

Related: https://github.com/openzfs/zfs/issues/264 https://github.com/openzfs/zfs/pull/7545