Skip to content

btrfs: async discard support

Dennis Zhou linux-btrfs 6 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v6 Latest22 patches 26 repliesIn review
  2. v522 patches 1 replySuperseded
  3. v422 patches 2 repliesSuperseded
Earlier versions · 3
VersionPostedPatchesRepliesStatus
v322 patches2 repliesSuperseded
v222 patches17 repliesSuperseded
v1 RFC19 patches51 repliesSuperseded

Changes in v6 from the cover letter

- Move the fully trimmed check outside of the block_group lock.

Patches in v6 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/22bitmap: genericize percpu bitmap region iteratorsinclude/linux/bitmap.h mm/percpu.c+51 -450 replies
2/22btrfs: rename DISCARD opt to DISCARD_SYNCfs/btrfs/block-group.c fs/btrfs/ctree.h fs/btrfs/extent-tree.c +2 more+8 -80 replies
3/22btrfs: keep track of which extents have been discardedfs/btrfs/free-space-cache.c fs/btrfs/free-space-cache.h fs/btrfs/inode-map.c+80 -140 replies
4/22btrfs: keep track of cleanliness of the bitmapfs/btrfs/free-space-cache.c fs/btrfs/free-space-cache.h+94 -90 replies
5/22btrfs: add the beginning of async discard, discard workqueuefs/btrfs/Makefile fs/btrfs/block-group.c fs/btrfs/block-group.h +9 more+474 -130 replies
6/22btrfs: handle empty block_group removalfs/btrfs/block-group.c fs/btrfs/ctree.h fs/btrfs/discard.c +4 more+213 -90 replies
7/22btrfs: discard one region at a time in async discardfs/btrfs/block-group.h fs/btrfs/discard.c fs/btrfs/free-space-cache.c +1 more+192 -450 replies
8/22btrfs: add removal calls for sysfs debug/fs/btrfs/sysfs.c+7 -01 reply
9/22btrfs: make UUID/debug have its own kobjectfs/btrfs/ctree.h fs/btrfs/sysfs.c+20 -41 reply
10/22btrfs: add discard sysfs directoryfs/btrfs/ctree.h fs/btrfs/sysfs.c+27 -01 reply
11/22btrfs: track discardable extents for async discardfs/btrfs/ctree.h fs/btrfs/discard.c fs/btrfs/discard.h +3 more+160 -90 replies
12/22btrfs: keep track of discardable_bytesfs/btrfs/ctree.h fs/btrfs/discard.c fs/btrfs/free-space-cache.c +2 more+56 -90 replies
13/22btrfs: calculate discard delay based on number of extentsfs/btrfs/ctree.h fs/btrfs/discard.c fs/btrfs/discard.h +2 more+86 -52 replies
14/22btrfs: add bps discard rate limitfs/btrfs/ctree.h fs/btrfs/discard.c fs/btrfs/sysfs.c+51 -02 replies
15/22btrfs: limit max discard size for async discardfs/btrfs/discard.h fs/btrfs/free-space-cache.c+41 -123 replies
16/22btrfs: make max async discard size tunablefs/btrfs/ctree.h fs/btrfs/discard.c fs/btrfs/free-space-cache.c +1 more+45 -72 replies
17/22btrfs: have multiple discard listsfs/btrfs/ctree.h fs/btrfs/discard.c fs/btrfs/discard.h +2 more+140 -230 replies
18/22btrfs: only keep track of data extents for async discardfs/btrfs/block-group.h fs/btrfs/discard.c+15 -22 replies
19/22btrfs: keep track of discard reuse statsfs/btrfs/ctree.h fs/btrfs/discard.c fs/btrfs/free-space-cache.c +1 more+60 -02 replies
20/22btrfs: add async discard headerfs/btrfs/discard.c+35 -00 replies
21/22btrfs: increase the metadata allowance for the free_space_cachefs/btrfs/free-space-cache.c+11 -150 replies
22/22btrfs: make smaller extents more likely to go into bitmapsfs/btrfs/free-space-cache.c+2 -20 replies

Reviews trailers per patch

17 of 22 patches have a Reviewed-by or Acked-by.

PatchJosef BacikJohannes ThumshirnAnand Jain
1/22R-b
2/22R-b R-b
3/22
4/22R-b
5/22R-b
6/22R-b
7/22R-b
8/22R-b R-b
9/22R-b R-b
10/22R-b R-b
11/22
12/22
13/22R-b
14/22
15/22R-b
16/22
17/22R-b
18/22R-b
19/22R-b
20/22R-b
21/22R-b
22/22R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v6 thread

Cover letter [PATCH v6 00/22] btrfs: async discard support

Hello,

Dave reported a lockdep issue [1]. I'm a bit surprised as I can't repro it, but it obviously is right. I believe I fixed the issue by moving the fully trimmed check outside of the block_group lock. I mistakingly thought the btrfs_block_group lock subsumed btrfs_free_space_ctl tree_lock. This clearly isn't the case.

Changes in v6:
- Move the fully trimmed check outside of the block_group lock.

v5 is available here: [2].

This series is on top of btrfs-devel#misc-next 7ee98bb808e2 + [3] and [4].

[1] https://lore.kernel.org/linux-btrfs/[email protected]/
[2] https://lore.kernel.org/linux-btrfs/[email protected]/
[3] https://lore.kernel.org/linux-btrfs/d934383ea528d920a95b6107daad6023b516f0f4.1576109087.git.dennis@kernel.org/
[4] https://lore.kernel.org/linux-btrfs/[email protected]/

Dennis Zhou (22):
bitmap: genericize percpu bitmap region iterators
btrfs: rename DISCARD opt to DISCARD_SYNC
btrfs: keep track of which extents have been discarded
btrfs: keep track of cleanliness of the bitmap
btrfs: add the beginning of async discard, discard workqueue
btrfs: handle empty block_group removal
btrfs: discard one region at a time in async discard
btrfs: add removal calls for sysfs debug/
btrfs: make UUID/debug have its own kobject
btrfs: add discard sysfs directory
btrfs: track discardable extents for async discard
btrfs: keep track of discardable_bytes
btrfs: calculate discard delay based on number of extents
btrfs: add bps discard rate limit
btrfs: limit max discard size for async discard
btrfs: make max async discard size tunable
btrfs: have multiple discard lists
btrfs: only keep track of data extents for async discard
btrfs: keep track of discard reuse stats
btrfs: add async discard header
btrfs: increase the metadata allowance for the free_space_cache
btrfs: make smaller extents more likely to go into bitmaps

 fs/btrfs/Makefile           |   2 +-
 fs/btrfs/block-group.c      |  87 ++++-
 fs/btrfs/block-group.h      |  30 ++
 fs/btrfs/ctree.h            |  52 ++-
 fs/btrfs/discard.c          | 684 ++++++++++++++++++++++++++++++++++++
 fs/btrfs/discard.h          |  42 +++
 fs/btrfs/disk-io.c          |  15 +-
 fs/btrfs/extent-tree.c      |   8 +-
 fs/btrfs/free-space-cache.c | 611 +++++++++++++++++++++++++++-----
 fs/btrfs/free-space-cache.h |  41 ++-
 fs/btrfs/inode-map.c        |  13 +-
 fs/btrfs/inode.c            |   2 +-
 fs/btrfs/scrub.c            |   7 +-
 fs/btrfs/super.c            |  39 +-
 fs/btrfs/sysfs.c            | 205 ++++++++++-
 fs/btrfs/volumes.c          |   7 +
 include/linux/bitmap.h      |  35 ++
 mm/percpu.c                 |  61 +---
 18 files changed, 1789 insertions(+), 152 deletions(-)
 create mode 100644 fs/btrfs/discard.c
 create mode 100644 fs/btrfs/discard.h

Thanks,
Dennis