]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: cleanup btrfs_discard_update_discardable usage
authorJosef Bacik <josef@toxicpanda.com>
Fri, 23 Oct 2020 13:58:07 +0000 (09:58 -0400)
committerDavid Sterba <dsterba@suse.com>
Tue, 8 Dec 2020 14:54:02 +0000 (15:54 +0100)
commit27b0b809f35c9c28aed5130c5754ba918b5db63c
treecbbacb71a008d1a99804bd97bd59523fa057de15
parent888ea8ba9c211a7cc7b8c0ffa28e8cb1857d21d4
btrfs: cleanup btrfs_discard_update_discardable usage

This passes in the block_group and the free_space_ctl, but we can get
this from the block group itself.  Part of this is because we call it
from __load_free_space_cache, which can be called for the inode cache as
well.

Move that call into the block group specific load section, wrap it in
the right lock that we need for the assertion (but otherwise this is
safe without the lock because this happens in single-thread context).

Fix up the arguments to only take the block group.  Add a lockdep_assert
as well for good measure to make sure we don't mess up the locking
again.

Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/discard.c
fs/btrfs/discard.h
fs/btrfs/free-space-cache.c