mbox series

[0/2] Limit scope of extent locks in btrfs_buffered_write()

Message ID cover.1724847323.git.rgoldwyn@suse.com (mailing list archive)
Headers show
Series Limit scope of extent locks in btrfs_buffered_write() | expand

Message

Goldwyn Rodrigues Aug. 28, 2024, 12:45 p.m. UTC
From: Goldwyn Rodrigues <rgoldwyn@suse.com>

This is in preparation for using iomap for btrfs. It will help in
keeping the extent lock limited to iomap_end() function.

The extent locks are taken for a majority of the write sequence. With
Josef patches limiting the extent locks to recording extent changes, we
can reduce the scope of locking of extent locks during write to only
when recording the extent as delalloc. Restrict the locking to
btrfs_dirty_pages(). However, the write needs to make sure that there
are no pending ordered extents. So, wait for any pending ordered extents
before performing the copying of data from userspace.

As for testing, it did go through a round of xfstests without any crash
or failure. However, since this touches a crucial part of write, please
make sure this is correct especially in terms of data corruption by
overwrites/staleness.

Goldwyn Rodrigues (2):
  btrfs: btrfs_has_ordered_extent() to check for ordered extent in range
  btrfs: reduce scope of extent locks during buffered write

 fs/btrfs/file.c         | 109 ++++++----------------------------------
 fs/btrfs/ordered-data.c |  11 ++++
 fs/btrfs/ordered-data.h |   1 +
 3 files changed, 28 insertions(+), 93 deletions(-)