btrfs: refactor btrfs_check_can_nocow() into two variants
authorQu Wenruo <wqu@suse.com>
Tue, 23 Jun 2020 23:23:52 +0000 (07:23 +0800)
committerDavid Sterba <dsterba@suse.com>
Mon, 27 Jul 2020 10:55:28 +0000 (12:55 +0200)
commit38d37aa9c32938214ca071fe02762f55b89937fd
treea3d92808e5122abbab11a0c8fda7d599ba7e08d3
parente4ecaf90bc13e2a9c351d5cd86d4094844d7d7bd
btrfs: refactor btrfs_check_can_nocow() into two variants

The function btrfs_check_can_nocow() now has two completely different
call patterns.

For nowait variant, callers don't need to do any cleanup.  While for
wait variant, callers need to release the lock if they can do nocow
write.

This is somehow confusing, and is already a problem for the exported
btrfs_check_can_nocow().

So this patch will separate the different patterns into different
functions.
For nowait variant, the function will be called check_nocow_nolock().
For wait variant, the function pair will be btrfs_check_nocow_lock()
btrfs_check_nocow_unlock().

Reviewed-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/ctree.h
fs/btrfs/file.c
fs/btrfs/inode.c