News: 0001657188

  ARM Give a man a fire and he's warm for a day, but set fire to him and he's warm for the rest of his life (Terry Pratchett, Jingo)

A Nice Improvement Coming For Faster Btrfs Zstd Decompression

([Linux Storage] 3 Hours Ago Btrfs Zstd Faster Decompression)


In addition to [1]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.

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

The patch is queued in the [2]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.



[1] https://www.phoronix.com/news/In-Kernel-Zstd-BMI2-Probing

[2] https://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux.git/commit/?h=for-next&id=e27a6e4823f35e6e33195757146718a21e9792de



The Gurus of Unix Meeting of Minds (GUMM) takes place Wednesday, April
1, 2076 (check THAT in your perpetual calendar program), 14 feet above
the ground directly in front of the Milpitas Gumps. Members will grep
each other by the hand (after intro), yacc a lot, smoke filtered
chroots in pipes, chown with forks, use the wc (unless uuclean), fseek
nice zombie processes, strip, and sleep, but not, we hope, od. Three
days will be devoted to discussion of the ramifications of whodo. Two
seconds have been allotted for a complete rundown of all the user-
friendly features of Unix. Seminars include "Everything You Know is
Wrong", led by Tom Kempson, "Batman or Cat:man?" led by Richie Dennis
"cc C? Si! Si!" led by Kerwin Bernighan, and "Document Unix, Are You
Kidding?" led by Jan Yeats. No Reader Service No. is necessary because
all GUGUs (Gurus of Unix Group of Users) already know everything we
could tell them.
-- "Get GUMMed," Dr. Dobb's Journal, June '84