mbox series

[v2,0/3] btrfs: basic refactor of btrfs_buffered_write()

Message ID 20200824075959.85212-1-wqu@suse.com (mailing list archive)
Headers show
Series btrfs: basic refactor of btrfs_buffered_write() | expand

Message

Qu Wenruo Aug. 24, 2020, 7:59 a.m. UTC
This patchset will refactor btrfs_buffered_write() by:
- Extra the nrptrs calculation into one function
  The main concern here is the batch number of pages.
  Originally there is a max(nrptrs, 8), which looks so incorrect that my
  eyes change it to min(nrptrs, 8) automatically.

  This time we kill that max(nrptrr, 8), and replace it to a fixed size
  up limit (64K), which should bring the same performance for different
  page sized.

  The limit can be changed if the 64K is not large enough for certain
  buffered write.

- Refactor the main loop into process_one_batch()
  No functional change, just plain refactor.

- Remove the again: tag by integrating page and extent locking
  The new function lock_pages_and_extent() will handle the retry so we
  don't need the tag any more in the main loop.

Changelog:
v2:
- Fix a bug that ENOSPC error is not returned to user space
  It's caused by a missing assignment for (copied < 0) branch in the 2nd
  patch.

Qu Wenruo (3):
  btrfs: change how we calculate the nrptrs for btrfs_buffered_write()
  btrfs: refactor btrfs_buffered_write() into process_one_batch()
  btrfs: remove the again: tag in process_one_batch()

 fs/btrfs/file.c | 570 +++++++++++++++++++++++++-----------------------
 1 file changed, 303 insertions(+), 267 deletions(-)