Linux Btrfs filesystem development
 help / color / mirror / Atom feed
* [PATCH v4 0/5] btrfs: defrag: don't waste CPU time on non-target extent
@ 2022-02-11  6:41 Qu Wenruo
  2022-02-11  6:41 ` [PATCH v4 1/5] btrfs: defrag: allow defrag_one_cluster() to skip large extent which is not a target Qu Wenruo
                   ` (5 more replies)
  0 siblings, 6 replies; 8+ messages in thread
From: Qu Wenruo @ 2022-02-11  6:41 UTC (permalink / raw)
  To: linux-btrfs

Changelog:
v2:
- Rebased to lastest misc-next
  Just one small conflict with static_assert() update.
  And this time only those patches are rebased to misc-next, thus it may
  cause conflicts with fixes for defrag_check_next_extent() in the
  future.

- Several grammar fixes

- Report accurate btrfs_defrag_ctrl::sectors_defragged
  This is inspired by a comment from Filipe that the skip check
  should be done in the defrag_collect_targets() call inside
  defrag_one_range().

  This results a new patch in v2.

- Change the timing of btrfs_defrag_ctrl::last_scanned update
  Now it's updated inside defrag_one_range(), which will give
  us an accurate view, unlike the previous call site in
  defrag_one_cluster().

- Don't change the timing of extent threshold.

- Rename @last_target to @last_is_target in defrag_collect_targets()

v3:
- Add Reviewed-by tags

- Fix a wrong value in commit message of the 1st patch

- Make @orig_start const for the 3rd patch

- Fix a missing word "skip" in the 5th patch

- Remove one unnecessary assignment in the 5th patch
  As we don't return the defragged sectors to user space.

v4:
- Move the skip behavior before the btrfs_defrag_ctrl refactor
  So it can be backported to v5.16

- Slightly change how we use btrfs_defrag_ctrl::last_scanned
  Previously we use that value almost as range start, but that's not correct,
  as defrag_collect_targets() can update it before we do any defrag.

  Now we pass explicit range start/len to defrag_one_cluster(), without
  re-using ctrl::last_scanned.

- Remove one incorrect range skip in defrag_one_cluster()
  There used to be a check against last_scanned to skip certain ranges.
  But that is not correct, as the last_scanned can already be larger
  than the first target after the 1st defrag_collect_targets() call.

  Now last_scanned is only really utilized after one cluster is
  defragged.

  This also removes the reviewed-by tag for the refactor patch 

Qu Wenruo (5):
  btrfs: defrag: allow defrag_one_cluster() to skip large extent which
    is not a target
  btrfs: uapi: introduce BTRFS_DEFRAG_RANGE_MASK for later sanity check
  btrfs: defrag: introduce btrfs_defrag_ctrl structure for later usage
  btrfs: defrag: use btrfs_defrag_ctrl to replace
    btrfs_ioctl_defrag_range_args for btrfs_defrag_file()
  btrfs: defrag: make btrfs_defrag_file() to report accurate number of
    defragged sectors

 fs/btrfs/ctree.h           |  22 +++-
 fs/btrfs/file.c            |  21 ++--
 fs/btrfs/ioctl.c           | 200 ++++++++++++++++++++++---------------
 include/uapi/linux/btrfs.h |   6 +-
 4 files changed, 155 insertions(+), 94 deletions(-)

-- 
2.35.0


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-02-15 15:49 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-11  6:41 [PATCH v4 0/5] btrfs: defrag: don't waste CPU time on non-target extent Qu Wenruo
2022-02-11  6:41 ` [PATCH v4 1/5] btrfs: defrag: allow defrag_one_cluster() to skip large extent which is not a target Qu Wenruo
2022-02-11  6:41 ` [PATCH v4 2/5] btrfs: uapi: introduce BTRFS_DEFRAG_RANGE_MASK for later sanity check Qu Wenruo
2022-02-11  6:41 ` [PATCH v4 3/5] btrfs: defrag: introduce btrfs_defrag_ctrl structure for later usage Qu Wenruo
2022-02-11  6:41 ` [PATCH v4 4/5] btrfs: defrag: use btrfs_defrag_ctrl to replace btrfs_ioctl_defrag_range_args for btrfs_defrag_file() Qu Wenruo
2022-02-11  6:41 ` [PATCH v4 5/5] btrfs: defrag: make btrfs_defrag_file() to report accurate number of defragged sectors Qu Wenruo
2022-02-14 16:40 ` [PATCH v4 0/5] btrfs: defrag: don't waste CPU time on non-target extent David Sterba
2022-02-15 15:45   ` David Sterba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox