diff mbox series

[3/9] btrfs: assert root delalloc lock is held at __btrfs_del_delalloc_inode()

Message ID a3014d9834055837c00d4998b313aaa128e1b4eb.1707491248.git.fdmanana@suse.com (mailing list archive)
State New, archived
Headers show
Series btrfs: cleanups and minor performance change to setting/clearing delalloc | expand

Commit Message

Filipe Manana Feb. 9, 2024, 6 p.m. UTC
From: Filipe Manana <fdmanana@suse.com>

This function requires the delalloc lock of the inode's root to be held,
so assert it's held.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
---
 fs/btrfs/inode.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Qu Wenruo Feb. 10, 2024, 7:46 a.m. UTC | #1
On 2024/2/10 04:30, fdmanana@kernel.org wrote:
> From: Filipe Manana <fdmanana@suse.com>
>
> This function requires the delalloc lock of the inode's root to be held,
> so assert it's held.
>
> Signed-off-by: Filipe Manana <fdmanana@suse.com>

Reviewed-by: Qu Wenruo <wqu@suse.com>

Thanks,
Qu

> ---
>   fs/btrfs/inode.c | 2 ++
>   1 file changed, 2 insertions(+)
>
> diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
> index ec8af7d0f166..3a19e30676e8 100644
> --- a/fs/btrfs/inode.c
> +++ b/fs/btrfs/inode.c
> @@ -2411,6 +2411,8 @@ void __btrfs_del_delalloc_inode(struct btrfs_inode *inode)
>   	struct btrfs_root *root = inode->root;
>   	struct btrfs_fs_info *fs_info = root->fs_info;
>
> +	lockdep_assert_held(&root->delalloc_lock);
> +
>   	if (!list_empty(&inode->delalloc_inodes)) {
>   		list_del_init(&inode->delalloc_inodes);
>   		clear_bit(BTRFS_INODE_IN_DELALLOC_LIST,
diff mbox series

Patch

diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index ec8af7d0f166..3a19e30676e8 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -2411,6 +2411,8 @@  void __btrfs_del_delalloc_inode(struct btrfs_inode *inode)
 	struct btrfs_root *root = inode->root;
 	struct btrfs_fs_info *fs_info = root->fs_info;
 
+	lockdep_assert_held(&root->delalloc_lock);
+
 	if (!list_empty(&inode->delalloc_inodes)) {
 		list_del_init(&inode->delalloc_inodes);
 		clear_bit(BTRFS_INODE_IN_DELALLOC_LIST,