A Nice Improvement Coming For Faster Btrfs Zstd Decompression

Written by Michael Larabel in Linux Storage on 9 September 2026 at 08:52 AM EDT. 17 Comments
LINUX STORAGE
In addition to the still-pending kernel work for improving the in-kernel Zstd code, sepaarately the Btrfs file-system driver has an improvement on the way in its decompression code path for the Zstd transparent file-system compression.

Queued into the Btrfs file-systems "for-next" Git branch ahead of the Linux 7.4 cycle kicking off in October is a nice Zstd decompression improvement. Linux developer Usama Arif discovered that in the Btrfs Zstd decompression path that every delivered byte is currently written twice:
"zstd_decompress_bio() gives zstd a sectorsize-sized scratch buffer, and btrfs_decompress_buf2page() then copies the part overlapping the read bio into the destination folios. Every delivered byte is written twice.

Instead, choose the output buffer per streaming call. zstd_map_dest() kmaps the current page-bounded segment of the read bio, so zstd writes into the page cache directly. The scratch buffer is kept only for output with no destination: the prefix before a read starting inside a compressed extent, which zstd cannot skip, and gaps left by folios already in the page cache."

The end result is quite beneficial with Usama noting a 7.8% reduction in sequential read time with 4K sector size, 3.6% reduction with a 16K sector size, or 6.8% time reduction with a 64K sector size.

Btrfs Zstd decompression benchmark


For random 4K reads was around a 3% improvement when utilizing Btrfs with Zstd compression enabled.

The patch is queued in the for-next branch so look for it with the Linux 7.4 kernel cycle. Hopefully the other Zstd kernel improvements will make it for Linux 7.4 as well.
Related News
About The Author

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.

Popular News This Week