btrfs: allow btrfs_truncate_block() to fallback to nocow for data space reservation
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v7 Latest3 patches 2 repliesIn review
- v63 patches 4 repliesSuperseded
- v53 patches 3 repliesSuperseded
Earlier versions · 4
| Version | Posted | Patches | Replies | Status |
|---|---|---|---|---|
| v4 | 3 patches | 5 replies | Superseded | |
| v3 | 3 patches | 10 replies | Superseded | |
| v2 | 1 patch | 2 replies | Superseded | |
| v1 | 1 patch | 5 replies | Superseded |
Changes in v7 from the cover letter
- Fix a "BTRF_I()" typo
Patches in v7 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/3 | btrfs: allow btrfs_truncate_block() to fallback to nocow for data space reservationfs/ fs/ fs/ | +45 | 0 replies | |
| 2/3 | btrfs: add comments for btrfs_check_can_nocow() and can_nocow_extent()fs/ fs/ | +40 | 0 replies | |
| 3/3 | btrfs: refactor btrfs_check_can_nocow() into two variantsfs/ fs/ fs/ | +53 | 0 replies |
Reviews trailers per patch
2 of 3 patches have a Reviewed-by or Acked-by.
| Patch | Filipe Manana | Anand Jain |
|---|---|---|
| 1/3 | R-b | R-b |
| 2/3 | ||
| 3/3 | R-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH v7 0/3] btrfs: allow btrfs_truncate_block() to fallback to nocow for data space reservation
Before this patch, btrfs_truncate_block() never checks the NODATACOW bit, thus when we run out of data space, we can return ENOSPC for truncate for NODATACOW inode.
This patchset will address this problem by doing the same behavior as buffered write to address it.
Changelog:
v2:
- Rebased to misc-next
Only one minor conflict in ctree.h
v3:
- Added two new patches
- Refactor check_can_nocow()
Since the introduction of nowait, check_can_nocow() are in fact split into two usage patterns: check_can_nocow(nowait = false) with btrfs_drew_write_unlock(), and single check_can_nocow(nowait = true). Refactor them into two functions: start_nocow_check() paired with end_nocow_check(), and single try_nocow_check(). With comment added.
- Rebased to latest misc-next
- Added btrfs_assert_drew_write_locked() for btrfs_end_nocow_check() This is a little concerning one, as it's in the hot path of buffered write.
It has percpu_counter_sum() called in that hot path, causing obvious performance drop for CONFIG_BTRFS_DEBUG build. Not sure if the assert is worthy since there aren't any other users.
v4:
- Rebased to latest misc-next
- Comment update to follow the relaxed kernel-doc format
- Re-order the patches
So the fix comes first, then refactors.
- Naming updates for the refactor patch
Now the exported pair is btrfs_check_nocow_lock() and btrfs_check_nocow_unlock().
- Remove the btrfs_assert_drew_write_lock()
It's extremely slow for btrfs/187, and we only have two call sites so far, thus it's not really worthy.
v5:
- Fix a stupid bug that check_nocow_nolock() passes wrong bool
- Update the comment for btrfs_check_nocow_lock() as there is no "nowait" parameter anymore
v6:
- Replace one btrfs_drew_write_unlock() with the wrapper
v7:
- Fix a "BTRF_I()" typo
Qu Wenruo (3):
btrfs: allow btrfs_truncate_block() to fallback to nocow for data
space reservation
btrfs: add comments for btrfs_check_can_nocow() and can_nocow_extent()
btrfs: refactor btrfs_check_can_nocow() into two variants
fs/btrfs/ctree.h | 3 +++ fs/btrfs/file.c | 61 +++++++++++++++++++++++++++++++++++----------- fs/btrfs/inode.c | 63 +++++++++++++++++++++++++++++++++++++++++------- 3 files changed, 104 insertions(+), 23 deletions(-)
Signature · 1 line
2.27.0