Skip to contentSkip to conversation

Btrfs updates for 6.20/7.0

GIT PULL Merged David Sterba 2 participants 2 messages Feb 6 – Feb 10 Btrfs file system

lore
Share & tools
lore

David Sterba

author maintainer
#0 lore raw

Hi,

please pull the following btrfs updates. Thanks.

User visible changes, feature updates:

- when using block size > page size, enable direct IO

- fallback to buffered IO if the data profile has duplication, workaround to avoid checksum mismatches on block group profiles with redundancy, real direct IO is possible on single or RAID0

- redo export of zoned statistics, moved from sysfs to /proc/pid/mountstats due to size limitations of the former

Experimental features:

- remove offload checksum tunable, intended to find best way to do it but since we've switched to offload to thread for everything we don't need it anymore

- initial support for remap-tree feature, a translation layer of logical block addresses that allow changes without moving/rewriting blocks to do eg. relocation, or other changes that require COW

Notable fixes:

- automatic removal of accidentally leftover chunks when free-space-tree is enabled since mkfs.btrfs v6.16.1

- zoned mode

- do not try to append to conventional zones when RAID is mixing zoned and conventional drives

- fixup write pointers when mixing zoned and conventional on DUP/RAID* profiles

- when using squota, relax deletion rules for qgroups with 0 members to allow easier recovery from accounting bugs, also add more checks to detect bad accounting

- fix periodic reclaim scanning, properly check boundary conditions not to trigger it unexpectedly or miss the time to run it

- trim

- continue after first error

- change reporting to the first detected error

- add more cancellation points

- reduce contention of big device lock that can block other operations when there's lots of trimmed space

- when chunk allocation is forced (needs experimental build) fix transaction abort when unexpected space layout is detected

Core:

- switch to crypto library API for checksumming, removed module dependencies, pointer indirections, etc.

- error handling improvements

- adjust how and where transaction commit or abort are done and are maybe not necessary

- minor compression optimization to skip single block ranges

- improve how compression folios are handled

- new and updated selftests

- cleanups, refactoring

- auto-freeing and other automatic variable cleanup conversion

- structure size optimizations

- condition annotations

----------------------------------------------------------------
The following changes since commit 18f7fcd5e69a04df57b563360b88be72471d6b62:

Linux 6.19-rc8 (2026-02-01 14:01:13 -0800)

are available in the Git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux.git tags/for-6.20-tag

for you to fetch changes up to 161ab30da6899f31f8128cec7c833e99fa4d06d2:

btrfs: get rid of compressed_bio::compressed_folios[] (2026-02-03 07:59:07 +0100)

----------------------------------------------------------------
Boris Burkov (5):
btrfs: check squota parent usage on membership change
btrfs: relax squota parent qgroup deletion rule
btrfs: fix block_group_tree dirty_list corruption
btrfs: fix EEXIST abort due to non-consecutive gaps in chunk allocation
btrfs: tests: add unit tests for pending extent walking functions

David Sterba (9):
btrfs: merge setting ret and return ret
btrfs: simplify internal btrfs_printk helpers
btrfs: pass level to _btrfs_printk() to avoid parsing level from string
btrfs: remove ASSERT compatibility for gcc < 8.x
btrfs: split btrfs_fs_closing() and change return type to bool
btrfs: embed delayed root to struct btrfs_fs_info
btrfs: reorder members in btrfs_delayed_root for better packing
btrfs: don't use local variables for fs_info->delayed_root
btrfs: pass btrfs_fs_info to btrfs_first_delayed_node()

Eric Biggers (1):
btrfs: switch to library APIs for checksums

Filipe Manana (48):
btrfs: remove duplicated root key setup in btrfs_create_tree()
btrfs: update stale comment in __cow_file_range_inline()
btrfs: avoid transaction commit on error in del_balance_item()
btrfs: use single return variable in btrfs_find_orphan_roots()
btrfs: remove redundant path release in btrfs_find_orphan_roots()
btrfs: don't call btrfs_handle_fs_error() after failure to join transaction
btrfs: don't call btrfs_handle_fs_error() after failure to delete orphan item
btrfs: don't call btrfs_handle_fs_error() in qgroup_account_snapshot()
btrfs: don't call btrfs_handle_fs_error() in btrfs_commit_transaction()
btrfs: tag as unlikely error conditions in the transaction commit path
btrfs: move unlikely checks around btrfs_is_shutdown() into the helper
btrfs: avoid transaction commit on error in insert_balance_item()
btrfs: update comment for delalloc flush and oe wait in btrfs_clone_files()
btrfs: don't BUG() on unexpected delayed ref type in run_one_delayed_ref()
btrfs: remove unnecessary else branch in run_one_delayed_ref()
btrfs: tag as unlikely error handling in run_one_delayed_ref()
btrfs: add and use helper to compute the available space for a block group
btrfs: use the btrfs_block_group_end() helper everywhere
btrfs: use the btrfs_extent_map_end() helper everywhere
btrfs: make load_block_group_size_class() return void
btrfs: allocate path on stack in load_block_group_size_class()
btrfs: don't pass block group argument to load_block_group_size_class()
btrfs: assert block group is locked in btrfs_use_block_group_size_class()
btrfs: remove bogus root search condition in sample_block_group_extent_item()
btrfs: deal with missing root in sample_block_group_extent_item()
btrfs: unfold transaction aborts in btrfs_finish_one_ordered()
btrfs: qgroup: return correct error when deleting qgroup relation item
btrfs: remove pointless out labels from ioctl.c
btrfs: remove pointless out labels from send.c
btrfs: remove pointless out labels from qgroup.c
btrfs: remove pointless out labels from disk-io.c
btrfs: remove pointless out labels from extent-tree.c
btrfs: remove pointless out labels from free-space-cache.c
btrfs: remove pointless out labels from inode.c
btrfs: remove pointless out labels from uuid-tree.c
btrfs: remove out label in load_extent_tree_free()
btrfs: remove out_failed label in find_lock_delalloc_range()
btrfs: remove out label in btrfs_csum_file_blocks()
btrfs: remove out label in btrfs_mark_extent_written()
btrfs: remove out label in lzo_decompress()
btrfs: remove out label in scrub_find_fill_first_stripe()
btrfs: remove out label in finish_verity()
btrfs: remove out label in btrfs_check_rw_degradable()
btrfs: remove out label in btrfs_init_space_info()
btrfs: remove out label in btrfs_wait_for_commit()
btrfs: abort transaction on error in btrfs_remove_block_group()
btrfs: do not BUG_ON() in btrfs_remove_block_group()
btrfs: raid56: fix memory leak of btrfs_raid_bio::stripe_uptodate_bitmap

Johannes Thumshirn (10):
btrfs: zoned: don't zone append to conventional zone
btrfs: rename btrfs_create_block_group_cache to btrfs_create_block_group
btrfs: zoned: re-flow prepare_allocation_zoned()
btrfs: zoned: show statistics about zoned filesystems in mountstats
btrfs: move space_info_flag_to_str() to space-info.h
btrfs: zoned: print block-group type for zoned statistics
btrfs: remove bogus NULL checks in __btrfs_write_out_cache()
btrfs: don't pass io_ctl to __btrfs_write_out_cache()
btrfs: zoned: use local fs_info variable in btrfs_load_block_group_dup()
btrfs: fix copying the flags of btrfs_bio after split

Julia Lawall (1):
btrfs: update outdated comment in __add_block_group_free_space()

Mark Harmstone (17):
btrfs: add definitions and constants for remap-tree
btrfs: add METADATA_REMAP chunk type
btrfs: allow remapped chunks to have zero stripes
btrfs: remove remapped block groups from the free-space-tree
btrfs: don't add metadata items for the remap tree to the extent tree
btrfs: rename struct btrfs_block_group field commit_used to last_used
btrfs: add extended version of struct block_group_item
btrfs: allow mounting filesystems with remap-tree incompat flag
btrfs: redirect I/O for remapped block groups
btrfs: handle deletions from remapped block group
btrfs: handle setting up relocation of block group with remap-tree
btrfs: move existing remaps before relocating block group
btrfs: replace identity remaps with actual remaps when doing relocations
btrfs: add do_remap parameter to btrfs_discard_extent()
btrfs: allow balancing remap tree
btrfs: handle discarding fully-remapped block groups
btrfs: populate fully_remapped_bgs_list on mount

Massimiliano Pellizzer (1):
btrfs: remove dead assignment in prepare_one_folio()

Naohiro Aota (6):
btrfs: zoned: fixup last alloc pointer after extent removal for RAID1
btrfs: zoned: fixup last alloc pointer after extent removal for DUP
btrfs: zoned: fixup last alloc pointer after extent removal for RAID0/10
btrfs: tests: add cleanup functions for test specific functions
btrfs: add cleanup function for btrfs_free_chunk_map
btrfs: zoned: factor out the zone loading part into a testable function

Qu Wenruo (27):
btrfs: enable direct IO for bs > ps cases
btrfs: introduce BTRFS_PATH_AUTO_RELEASE() helper
btrfs: search for larger extent maps inside btrfs_do_readpage()
btrfs: concentrate the error handling of submit_one_sector()
btrfs: replace for_each_set_bit() with for_each_set_bitmap()
btrfs: shrink the size of btrfs_bio
btrfs: refactor the main loop of cow_file_range()
btrfs: add mount time auto fix for orphan fst entries
btrfs: reject single block sized compression early
btrfs: remove experimental offload csum mode
btrfs: shrink the size of btrfs_device
btrfs: lzo: use folio_iter to handle lzo_decompress_bio()
btrfs: zlib: use folio_iter to handle zlib_decompress_bio()
btrfs: zstd: use folio_iter to handle zstd_decompress_bio()
btrfs: fallback to buffered IO if the data profile has duplication
btrfs: tests: remove invalid file extent map tests
btrfs: tests: prepare extent map tests for strict alignment checks
btrfs: add strict extent map alignment checks
btrfs: lzo: introduce lzo_compress_bio() helper
btrfs: zstd: introduce zstd_compress_bio() helper
btrfs: zlib: introduce zlib_compress_bio() helper
btrfs: introduce btrfs_compress_bio() helper
btrfs: switch to btrfs_compress_bio() interface for compressed writes
btrfs: remove the old btrfs_compress_folios() infrastructure
btrfs: get rid of compressed_folios[] usage for compressed read
btrfs: get rid of compressed_folios[] usage for encoded writes
btrfs: get rid of compressed_bio::compressed_folios[]

Sun YangKai (5):
btrfs: update comment for visit_node_for_delete()
btrfs: use true/false for boolean parameters in btrfs_inc_ref()/btrfs_dec_ref()
btrfs: simplify boolean argument for btrfs_inc_ref()/btrfs_dec_ref()
btrfs: fix periodic reclaim condition
btrfs: consolidate reclaim readiness checks in btrfs_should_reclaim()

Zhen Ni (2):
btrfs: remove unreachable return after btrfs_backref_panic() in btrfs_backref_finish_upper_links()
btrfs: simplify check for zoned NODATASUM writes in btrfs_submit_chunk()

jinbaohong (5):
btrfs: use READA_FORWARD_ALWAYS for device extent verification
btrfs: continue trimming remaining devices on failure
btrfs: preserve first error in btrfs_trim_fs()
btrfs: handle user interrupt properly in btrfs_trim_fs()
btrfs: fix transaction commit blocking during trim of unallocated space

 fs/btrfs/Kconfig                        |   13 +-
 fs/btrfs/Makefile                       |    3 +-
 fs/btrfs/accessors.h                    |   30 +
 fs/btrfs/backref.c                      |    4 +-
 fs/btrfs/bio.c                          |   35 +-
 fs/btrfs/bio.h                          |   19 +-
 fs/btrfs/block-group.c                  |  455 +++++---
 fs/btrfs/block-group.h                  |   31 +-
 fs/btrfs/block-rsv.c                    |    8 +
 fs/btrfs/block-rsv.h                    |    1 +
 fs/btrfs/compression.c                  |  217 ++--
 fs/btrfs/compression.h                  |   40 +-
 fs/btrfs/ctree.c                        |   49 +-
 fs/btrfs/ctree.h                        |    9 +
 fs/btrfs/defrag.c                       |   10 +-
 fs/btrfs/delayed-inode.c                |   53 +-
 fs/btrfs/delayed-inode.h                |   15 -
 fs/btrfs/direct-io.c                    |   29 +-
 fs/btrfs/discard.c                      |   52 +-
 fs/btrfs/disk-io.c                      |  284 +++--
 fs/btrfs/extent-io-tree.c               |    7 +-
 fs/btrfs/extent-tree.c                  |  457 ++++++--
 fs/btrfs/extent-tree.h                  |    4 +-
 fs/btrfs/extent_io.c                    |   77 +-
 fs/btrfs/extent_map.c                   |   12 +
 fs/btrfs/file-item.c                    |   20 +-
 fs/btrfs/file.c                         |   60 +-
 fs/btrfs/free-space-cache.c             |  108 +-
 fs/btrfs/free-space-cache.h             |    1 +
 fs/btrfs/free-space-tree.c              |  150 ++-
 fs/btrfs/free-space-tree.h              |    6 +-
 fs/btrfs/fs.c                           |  102 +-
 fs/btrfs/fs.h                           |   79 +-
 fs/btrfs/inode-item.c                   |    7 +-
 fs/btrfs/inode.c                        |  599 ++++++-----
 fs/btrfs/ioctl.c                        |   46 +-
 fs/btrfs/locking.c                      |    1 +
 fs/btrfs/lzo.c                          |  295 ++++--
 fs/btrfs/messages.c                     |   26 +-
 fs/btrfs/messages.h                     |   76 +-
 fs/btrfs/qgroup.c                       |  125 ++-
 fs/btrfs/raid56.c                       |    1 +
 fs/btrfs/reflink.c                      |   11 +-
 fs/btrfs/relocation.c                   | 1765 ++++++++++++++++++++++++++++++-
 fs/btrfs/relocation.h                   |   17 +
 fs/btrfs/root-tree.c                    |   47 +-
 fs/btrfs/scrub.c                        |   56 +-
 fs/btrfs/send.c                         |   76 +-
 fs/btrfs/space-info.c                   |   73 +-
 fs/btrfs/space-info.h                   |   16 +
 fs/btrfs/super.c                        |   17 +-
 fs/btrfs/sysfs.c                        |   55 +-
 fs/btrfs/tests/btrfs-tests.c            |    3 +
 fs/btrfs/tests/btrfs-tests.h            |    7 +
 fs/btrfs/tests/chunk-allocation-tests.c |  476 +++++++++
 fs/btrfs/tests/extent-map-tests.c       |   16 +-
 fs/btrfs/tests/free-space-tree-tests.c  |    4 +-
 fs/btrfs/tests/inode-tests.c            |  126 +--
 fs/btrfs/transaction.c                  |   78 +-
 fs/btrfs/tree-checker.c                 |   84 +-
 fs/btrfs/tree-checker.h                 |    5 +
 fs/btrfs/tree-log.c                     |    2 +-
 fs/btrfs/uuid-tree.c                    |   16 +-
 fs/btrfs/verity.c                       |   13 +-
 fs/btrfs/volumes.c                      |  631 ++++++++---
 fs/btrfs/volumes.h                      |   57 +-
 fs/btrfs/zlib.c                         |   97 +-
 fs/btrfs/zoned.c                        |  398 +++++--
 fs/btrfs/zoned.h                        |   17 +
 fs/btrfs/zstd.c                         |  139 +--
 include/uapi/linux/btrfs.h              |    1 +
 include/uapi/linux/btrfs_tree.h         |   34 +-
 72 files changed, 5871 insertions(+), 2082 deletions(-)
 create mode 100644 fs/btrfs/tests/chunk-allocation-tests.c