2 min read

In order to prepare for the Linux 4.20 release, there are multiple performance improvements made to the Btrfs file-system. These changes are to be shipped in the next Linux kernel release.

Btrfs is a modern ‘copy on write’ filesystem for Linux. It offers a lot of features not readily available in other in-tree Linux file-systems such as fault tolerance, repair, and easy administration.  However, its performance has been degrading for some time (partially because copy-on-write by default damages some workloads). However, with performance improvements for the Linux 4.20 release, there should be multiple speed-ups to Btrfs.

Improvements include more files/sec in fsmark, better perf on multi-threaded workloads (filebench, dbench), fewer context switches and overall better memory allocation characteristics (multiple benchmarks). Apart from general performance, there’s an improvement for qgroups + balance workload.

Performance improvements

Btrfs has deprecated the blocking mode of path; only the spinning mode is used. Blocking mode of path is eliminated because it resulted in unnecessary wakeups and updates to the path locks.

Improvement for qgroups + balance workload include speedup balancing with qgroups, as well as skip quota accounting on unchanged subtrees. The overall gain is about 30+ % in runtime.

A small improvement has been made to rb-tree to avoid pointer chasing. rb-tree with cached first node is now used for several structures.

Btrfs now has better error reporting, after processing blockgroups and whole device. It continues trimming block groups after an error is encountered. It also has less interaction with transaction commit that improves latency on slower storage (eg. image files over NFS).

Cleanups in Btrfs

  • Unused struct members and variables are removed
  • Function return type cleanups are performed
  • Delayed refs code refactoring is done
  • Protection is provided against deadlock that could be caused by crafted image that tries to allocate from a tree that’s locked already

These are just a select few updates. Read the full list of changes in a post by David Sterba.

Read Next

Linux 4.19 kernel releases with open arms and AIO-based polling interface; Linus back to managing the Linux kernel.

KUnit: A new unit testing framework for Linux Kernel

bpftrace, a DTrace like tool for Linux now open source

Content Marketing Editor at Packt Hub. I blog about new and upcoming tech trends ranging from Data science, Web development, Programming, Cloud & Networking, IoT, Security and Game development.