Skip to content

Rework the worst case calculations for space reservation

Josef Bacik linux-btrfs 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest2 patches 1 replyIn review
  2. v13 patches 7 repliesSuperseded

Changes in v2 from the cover letter

- dropped "btrfs: global reserve fallback should use metadata_size", turns out I was testing without my evict changes in place so we don't even need this in the first place, but it is also wrong because we need to reserve space for the orphan item which is an insert.
- Added the reviewed-by's.

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2btrfs: rename the btrfs_calc_*_metadata_size helpersfs/btrfs/block-group.c fs/btrfs/ctree.h fs/btrfs/delalloc-space.c +10 more+34 -300 replies
2/2btrfs: only reserve metadata_size for inodesfs/btrfs/delalloc-space.c fs/btrfs/delayed-inode.c+18 -50 replies

Reviews trailers per patch

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

PatchNikolay Borisov
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 v2 thread

Cover letter [PATCH 0/2][v2] Rework the worst case calculations for space reservation

v1->v2:
- dropped "btrfs: global reserve fallback should use metadata_size", turns out I was testing without my evict changes in place so we don't even need this in the first place, but it is also wrong because we need to reserve space for the orphan item which is an insert.
- Added the reviewed-by's.

-- Original email --
We have two worst case calculations for space reservation, one that takes into account splitting at every level when cow'ing down the btree, and another that doesn't account for splitting at all. The first is used everywhere, and the second is used mostly for truncate.

However we also do not split when we're only changing an item, so for example updating the inode item. So the name for this helper is wrong, because it can be used for in-place updates as well as for truncates. Rename the helpers and then use the smaller worst-case reservation for inode updates in a few places.

As a rule we still want to use the insert calculation when we can't be sure what kind of operation is going to end up happening. But for things like delayed inode updates and file writes where we know there is going to be an existing inode item we can use the smaller reservation. Thanks,

Josef