Skip to content

btrfs: move ordered extents cleanup to where they got allocated

Qu Wenruo linux-btrfs 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 2 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2btrfs: extract the nocow ordered extent and extent map generation into a helperfs/btrfs/inode.c+69 -611 reply
2/2btrfs: move ordered extent cleanup to where they are allocatedfs/btrfs/inode.c+42 -241 reply

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by.

PatchBoris Burkov
1/2R-b
2/2R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/2] btrfs: move ordered extents cleanup to where they got allocated

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(-)
Signature · 1 line
2.47.1