Thread (11 messages) 11 messages, 2 authors, 2021-09-14

Re: [PATCH v2 0/8] btrfs: zoned: unify relocation on a zoned and regular FS

From: David Sterba <hidden>
Date: 2021-09-13 15:51:24

On Thu, Sep 09, 2021 at 01:19:24AM +0900, Johannes Thumshirn wrote:
A while ago David reported a bug in zoned btrfs' relocation code. The bug is
triggered because relocation on a zoned filesystem does not preallocate the
extents it copies and a writeback process running in parallel can cause a
split of the written extent. But splitting extents is currently not allowed on
relocation as it assumes a one to one copy of the relocated extents.

This causes transaction aborts and the filessytem switching to read-only in
order to prevent further damage.

The first patch in this series is just a preparation to avoid overly long
lines in follow up patches. Patch number two adds a dedicated block group for
relocation on a zoned filesystem. Number three excludes multiple processes
from adding pages to a relocation inode in a zoned filesystem. Patch four
switches relocation from REQ_OP_ZONE_APPEND to regular REQ_OP_WRITE, five
prepares an ASSERT()ion that we can enter the nocow path on a zoned filesystem
under very special circumstances and the sixth patch then switches the
relocation code for a zoned filesystem to using the same code path as we use
on a non zoned filesystem. As the changes before have made the prerequisites
to do so. The last two patches in this series are just a simple rename of a
function whose name we have twice in the btrfs codebase but with a different
purpose in different files and a cleanup of a complicated boolean comparison
into an if to make it stand out.

Changes to v1:
- Added patches 3 and 8
- Added comments to patches 4 and 5 (Naohiro)
- Move btrfs_clear_data_reloc_bg() out of line (David)
- Untangle the 'skip' assing into an if (David)
- Commented new fs_info members (David)

Johannes Thumshirn (8):
  btrfs: introduce btrfs_is_data_reloc_root
  btrfs: zoned: add a dedicated data relocation block group
  btrfs: zoned: only allow one process to add pages to a relocation
    inode
  btrfs: zoned: use regular writes for relocation
  btrfs: check for relocation inodes on zoned btrfs in should_nocow
  btrfs: zoned: allow preallocation for relocation inodes
  btrfs: rename setup_extent_mapping in relocation code
  btrfs: zoned: let the for_treelog test in the allocator stand out
I did a few minor fixups, patches moved from topic branch to misc-next.
Thanks.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help