]> git.baikalelectronics.ru Git - kernel.git/commit
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)
commit827c12a97b23a9ede5a5549c954fff0e64f0bfee
treea3d92808e5122abbab11a0c8fda7d599ba7e08d3
parent03ee3de5062c2d4c1a2cda94df45c2b6fb5ac57a
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