]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: discard one region at a time in async discard
authorDennis Zhou <dennis@kernel.org>
Sat, 14 Dec 2019 00:22:16 +0000 (16:22 -0800)
committerDavid Sterba <dsterba@suse.com>
Mon, 20 Jan 2020 15:40:58 +0000 (16:40 +0100)
commitf79add721eeae0e8bdfc275f9f88c6a9730353d8
tree606abc4a2ca8b5203a8749d0b8138d40e0e0d70e
parentce520e1dfff34ea6a8c0d23aa79bdb5a305979d1
btrfs: discard one region at a time in async discard

The prior two patches added discarding via a background workqueue. This
just piggybacked off of the fstrim code to trim the whole block at once.
Well inevitably this is worse performance wise and will aggressively
overtrim. But it was nice to plumb the other infrastructure to keep the
patches easier to review.

This adds the real goal of this series which is discarding slowly (ie. a
slow long running fstrim). The discarding is split into two phases,
extents and then bitmaps. The reason for this is two fold. First, the
bitmap regions overlap the extent regions. Second, discarding the
extents first will let the newly trimmed bitmaps have the highest chance
of coalescing when being readded to the free space cache.

Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Dennis Zhou <dennis@kernel.org>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/block-group.h
fs/btrfs/discard.c
fs/btrfs/free-space-cache.c
fs/btrfs/free-space-cache.h