News: 0001636564

  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)

Btrfs Change Coming For Linux 7.2 Yields Very Healthy Performance Gain

([Linux Storage] 5 Hours Ago Direct I/O)


A change coming on the way for the upcoming [1]Linux 7.2 kernel cycle is yielding a significant improvement to the direct I/O write performance. While a big gain, technically it's a regression fix after a change mistakenly dropped the behavior several years ago.

The change on its way to Linux 7.2 for Btrfs is to not force Direct I/O (DIO) writes to be serialized. Mark Harmstone with Meta discovered that Btrfs was mistakenly serializing DIO writes since 2023 when [2]converting the file-system over to the new mount API for the Linux kernel . Harmstone explained with [3]the change :

"Before btrfs switched to the new mount API in 2023, we were setting SB_NOSEC in btrfs_mount_root(). This flag tells the VFS that the filesystem may have files which don't have security xattrs, enabling it to do some optimizations.

Unfortunately this was missed in the transition, meaning that IS_NOSEC will always return false for a btrfs inode. This means that btrfs_direct_write() calls will always get the inode lock exclusively, meaning that DIO writes to the same file will be serialized.

On my machine, this one-line change results in a ~59% improvement in DIO throughput."

A very nice win with nearly 60% throughput improvement from 826 MB/s to 1311 MB/s.

Intel's Kernel Test Robot is also [4]reporting around a 12% improvement for Btrfs with this change in their own test and hardware.

With the patch now in the "-next" code, look for this Btrfs change to land with the Linux 7.2 merge window happening in June.



[1] https://www.phoronix.com/search/Linux+7.2

[2] https://www.phoronix.com/news/Btrfs-New-Mount-API-Linux-6.8

[3] https://www.phoronix.com/news/Btrfs-No-Serialize-Direct-IO

[4] https://lore.kernel.org/all/202605291631.659bf248-lkp@intel.com/



You first have to decide whether to use the short or the long form. The
short form is what the Internal Revenue Service calls "simplified", which
means it is designed for people who need the help of a Sears tax-preparation
expert to distinguish between their first and last names. Here's the
complete text:

"(1) How much did you make? (AMOUNT)
(2) How much did we here at the government take out? (AMOUNT)
(3) Hey! Sounds like we took too much! So we're going to
send an official government check for (ONE-FIFTEENTH OF
THE AMOUNT WE TOOK) directly to the (YOUR LAST NAME)
household at (YOUR ADDRESS), for you to spend in any way
you please! Which just goes to show you, (YOUR FIRST
NAME), that it pays to file the short form!"

The IRS wants you to use this form because it gets to keep most of your
money. So unless you have pond silt for brains, you want the long form.
-- Dave Barry, "Sweating Out Taxes"