public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] btrfs: move ordered extents cleanup to where they got allocated
@ 2025-01-13  9:42 Qu Wenruo
  2025-01-13  9:42 ` [PATCH 1/2] btrfs: extract the nocow ordered extent and extent map generation into a helper Qu Wenruo
  2025-01-13  9:42 ` [PATCH 2/2] btrfs: move ordered extent cleanup to where they are allocated Qu Wenruo
  0 siblings, 2 replies; 5+ messages in thread
From: Qu Wenruo @ 2025-01-13  9:42 UTC (permalink / raw)
  To: linux-btrfs

Currently ordered extents cleanup is delayed, e.g:

Cow_file_range() and run_delalloc_nocow() all can allocate ordered
extents by themselves.
But the ordered extents cleanup is not happending in those functions,
but at the caller, btrfs_run_delalloc_range().

This is not the common practice, and has already caused various ordered
extent double accounting (fixed by the recent error handling patchset).

So this series will address the problem by:

- Refactor run_delalloc_nocow() to extract the NOCOW ordered extents
  creation
  To make later error handling a little simpler.

- Move ordered extents cleanup to where they got created
  There are 3 call sites:
  - cow_file_range()
    This is the simplest one, as the recent fix makes it pretty straight
    forward.

  - nocow_one_range()
    The new helper introduced to created ordered extents and extent maps
    for NOCOW writes.
    This is also pretty straightforward

  - run_delalloc_nocow()
    There are 3 different error cases that needs to adjust the ordered
    extents cleanup range.

Qu Wenruo (2):
  btrfs: extract the nocow ordered extent and extent map generation into
    a helper
  btrfs: move ordered extent cleanup to where they are allocated

 fs/btrfs/inode.c | 188 +++++++++++++++++++++++++++--------------------
 1 file changed, 107 insertions(+), 81 deletions(-)

-- 
2.47.1


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

end of thread, other threads:[~2025-02-06  0:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-13  9:42 [PATCH 0/2] btrfs: move ordered extents cleanup to where they got allocated Qu Wenruo
2025-01-13  9:42 ` [PATCH 1/2] btrfs: extract the nocow ordered extent and extent map generation into a helper Qu Wenruo
2025-02-06  0:39   ` Boris Burkov
2025-01-13  9:42 ` [PATCH 2/2] btrfs: move ordered extent cleanup to where they are allocated Qu Wenruo
2025-02-06  0:39   ` Boris Burkov

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