]> asedeno.scripts.mit.edu Git - linux.git/commit
btrfs: keep track of which extents have been discarded
authorDennis Zhou <dennis@kernel.org>
Sat, 14 Dec 2019 00:22:12 +0000 (16:22 -0800)
committerDavid Sterba <dsterba@suse.com>
Mon, 20 Jan 2020 15:40:57 +0000 (16:40 +0100)
commita7ccb255852413dd59263e551fd0ef13f76fc9b9
treed3b953699eb4cc2d4062f91e1e966bf2870a031f
parent46b27f5059e6ce7a7e3805d53144b37897723e3b
btrfs: keep track of which extents have been discarded

Async discard will use the free space cache as backing knowledge for
which extents to discard. This patch plumbs knowledge about which
extents need to be discarded into the free space cache from
unpin_extent_range().

An untrimmed extent can merge with everything as this is a new region.
Absorbing trimmed extents is a tradeoff to for greater coalescing which
makes life better for find_free_extent(). Additionally, it seems the
size of a trim isn't as problematic as the trim io itself.

When reading in the free space cache from disk, if sync is set, mark all
extents as trimmed. The current code ensures at transaction commit that
all free space is trimmed when sync is set, so this reflects that.

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/free-space-cache.c
fs/btrfs/free-space-cache.h
fs/btrfs/inode-map.c