public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: fdmanana@kernel.org, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 2/9] btrfs: stop passing root argument to __btrfs_del_delalloc_inode()
Date: Sat, 10 Feb 2024 18:15:50 +1030	[thread overview]
Message-ID: <7c0ee6a2-e33a-41b9-9b18-8273cc032f1d@gmx.com> (raw)
In-Reply-To: <ff5a4f734ea78954aa38c0c4fbb64461102cde7b.1707491248.git.fdmanana@suse.com>



On 2024/2/10 04:30, fdmanana@kernel.org wrote:
> From: Filipe Manana <fdmanana@suse.com>
>
> There's no need to pass a root argument to __btrfs_del_delalloc_inode()
> and btrfs_del_delalloc_inode(), we can just pass the inode since the root
> is always the root associated to that inode. Some remove the root argument
> from these functions.
>
> Signed-off-by: Filipe Manana <fdmanana@suse.com>

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

Thanks,
Qu

> ---
>   fs/btrfs/btrfs_inode.h |  2 +-
>   fs/btrfs/disk-io.c     |  2 +-
>   fs/btrfs/inode.c       | 15 +++++++--------
>   3 files changed, 9 insertions(+), 10 deletions(-)
>
> diff --git a/fs/btrfs/btrfs_inode.h b/fs/btrfs/btrfs_inode.h
> index 83d78a6f3aa2..32c59c5bd94d 100644
> --- a/fs/btrfs/btrfs_inode.h
> +++ b/fs/btrfs/btrfs_inode.h
> @@ -428,7 +428,7 @@ noinline int can_nocow_extent(struct inode *inode, u64 offset, u64 *len,
>   			      u64 *orig_start, u64 *orig_block_len,
>   			      u64 *ram_bytes, bool nowait, bool strict);
>
> -void __btrfs_del_delalloc_inode(struct btrfs_root *root, struct btrfs_inode *inode);
> +void __btrfs_del_delalloc_inode(struct btrfs_inode *inode);
>   struct inode *btrfs_lookup_dentry(struct inode *dir, struct dentry *dentry);
>   int btrfs_set_inode_index(struct btrfs_inode *dir, u64 *index);
>   int btrfs_unlink_inode(struct btrfs_trans_handle *trans,
> diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
> index 4280f8e23461..8ab185182c30 100644
> --- a/fs/btrfs/disk-io.c
> +++ b/fs/btrfs/disk-io.c
> @@ -4629,7 +4629,7 @@ static void btrfs_destroy_delalloc_inodes(struct btrfs_root *root)
>   		struct inode *inode = NULL;
>   		btrfs_inode = list_first_entry(&splice, struct btrfs_inode,
>   					       delalloc_inodes);
> -		__btrfs_del_delalloc_inode(root, btrfs_inode);
> +		__btrfs_del_delalloc_inode(btrfs_inode);
>   		spin_unlock(&root->delalloc_lock);
>
>   		/*
> diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
> index e3d12d8cf088..ec8af7d0f166 100644
> --- a/fs/btrfs/inode.c
> +++ b/fs/btrfs/inode.c
> @@ -2406,9 +2406,9 @@ static void btrfs_add_delalloc_inodes(struct btrfs_inode *inode)
>   	spin_unlock(&root->delalloc_lock);
>   }
>
> -void __btrfs_del_delalloc_inode(struct btrfs_root *root,
> -				struct btrfs_inode *inode)
> +void __btrfs_del_delalloc_inode(struct btrfs_inode *inode)
>   {
> +	struct btrfs_root *root = inode->root;
>   	struct btrfs_fs_info *fs_info = root->fs_info;
>
>   	if (!list_empty(&inode->delalloc_inodes)) {
> @@ -2426,12 +2426,11 @@ void __btrfs_del_delalloc_inode(struct btrfs_root *root,
>   	}
>   }
>
> -static void btrfs_del_delalloc_inode(struct btrfs_root *root,
> -				     struct btrfs_inode *inode)
> +static void btrfs_del_delalloc_inode(struct btrfs_inode *inode)
>   {
> -	spin_lock(&root->delalloc_lock);
> -	__btrfs_del_delalloc_inode(root, inode);
> -	spin_unlock(&root->delalloc_lock);
> +	spin_lock(&inode->root->delalloc_lock);
> +	__btrfs_del_delalloc_inode(inode);
> +	spin_unlock(&inode->root->delalloc_lock);
>   }
>
>   /*
> @@ -2538,7 +2537,7 @@ void btrfs_clear_delalloc_extent(struct btrfs_inode *inode,
>   		if (do_list && inode->delalloc_bytes == 0 &&
>   		    test_bit(BTRFS_INODE_IN_DELALLOC_LIST,
>   					&inode->runtime_flags))
> -			btrfs_del_delalloc_inode(root, inode);
> +			btrfs_del_delalloc_inode(inode);
>   		spin_unlock(&inode->lock);
>   	}
>

  reply	other threads:[~2024-02-10  7:45 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-09 18:00 [PATCH 0/9] btrfs: cleanups and minor performance change to setting/clearing delalloc fdmanana
2024-02-09 18:00 ` [PATCH 1/9] btrfs: stop passing root argument to btrfs_add_delalloc_inodes() fdmanana
2024-02-10  7:45   ` Qu Wenruo
2024-02-09 18:00 ` [PATCH 2/9] btrfs: stop passing root argument to __btrfs_del_delalloc_inode() fdmanana
2024-02-10  7:45   ` Qu Wenruo [this message]
2024-02-09 18:00 ` [PATCH 3/9] btrfs: assert root delalloc lock is held at __btrfs_del_delalloc_inode() fdmanana
2024-02-10  7:46   ` Qu Wenruo
2024-02-09 18:00 ` [PATCH 4/9] btrfs: rename btrfs_add_delalloc_inodes() to singular form fdmanana
2024-02-10  7:46   ` Qu Wenruo
2024-02-09 18:00 ` [PATCH 5/9] btrfs: reduce inode lock critical section when setting and clearing delalloc fdmanana
2024-02-09 18:00 ` [PATCH 6/9] btrfs: add lockdep assertion to remaining delalloc callbacks fdmanana
2024-02-10  7:48   ` Qu Wenruo
2024-02-09 18:00 ` [PATCH 7/9] btrfs: use assertion instead of BUG_ON when adding/removing to delalloc list fdmanana
2024-02-10  7:48   ` Qu Wenruo
2024-02-09 18:00 ` [PATCH 8/9] btrfs: remove do_list variable at btrfs_set_delalloc_extent() fdmanana
2024-02-10  7:49   ` Qu Wenruo
2024-02-09 18:00 ` [PATCH 9/9] btrfs: remove do_list variable at btrfs_clear_delalloc_extent() fdmanana
2024-02-10  7:49   ` Qu Wenruo
2024-02-09 21:54 ` [PATCH 0/9] btrfs: cleanups and minor performance change to setting/clearing delalloc Boris Burkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7c0ee6a2-e33a-41b9-9b18-8273cc032f1d@gmx.com \
    --to=quwenruo.btrfs@gmx.com \
    --cc=fdmanana@kernel.org \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox