VOOZH about

URL: https://www.phoronix.com/news/Btrfs-CLEAR_FREE-In-Next

⇱ Btrfs "CLEAR_FREE" Looks Like It Will Be Ready For Linux 6.16 - Phoronix


👁 Phoronix

Btrfs "CLEAR_FREE" Looks Like It Will Be Ready For Linux 6.16

Written by Michael Larabel in Linux Storage on 6 May 2025 at 06:50 AM EDT. 24 Comments
The Btrfs file-system looks like its new "CLEAR_FREE" feature will be ready to go for the upcoming Linux 6.16 kernel cycle.

David Sterba of SUSE has been working on the CLEAR_FREE patch series as a new kernel ioctl for clearing unused space in various manners. The patches have been queued into the Btrfs for-next Git branch and thus likely material for the upcoming merge window (Linux 6.16) barring any last minute issues or reservations from coming about.

Btrfs CLEAR_FREE is a more extensible version of FITRIM that does more than just TRIM/DISCARD but can be used for secure erase, zeroing out unused blocks, and extended with other capabilities.

👁 Btrfs CLEAR_FREE patches


David Sterba explained in the prior patch series of this CLEAR_FREE functionality:
"Add ioctl that is similar to FITRIM and in addition to trim can do also zeroing (either plain overwrite, or unmap the blocks if the device supports it) and secure erase.

This can be used to zero the unused space in e.g. VM images (when run from inside the guest, if fstrim is not supported) or free space on thin-provisioned devices.

The secure erase is provided by blkdiscard command but I'm not aware of equivalent that can be run on a filesystem, so this is for parity."

In initial form is the secure erase mode as well as zero-out mode for CLEAR_FREE. The secure erase will securely erase unused space and depends upon hardware support. The zero-out mode will write zeroes to the blocks unless the hardware supports the UNMAP command.

Michael Larabel is the principal author of Phoronix.com and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via MichaelLarabel.com.