Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: Naohiro Aota <naohiro.aota@wdc.com>, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] btrfs: drop unused argument of calcu_metadata_size()
Date: Wed, 24 Apr 2024 16:23:19 +0930	[thread overview]
Message-ID: <c15981d9-c37e-4b14-bc17-5f3b2f5a69e9@gmx.com> (raw)
In-Reply-To: <ff912bc5410aeb9f71a5b7ef5fd9376065dfeaf0.1713940243.git.naohiro.aota@wdc.com>



在 2024/4/24 16:08, Naohiro Aota 写道:
> calcu_metadata_size() has a "reserve" argument, but the only caller always
> set it to "1". The other usage (reserve = 0) is dropped by a commit
> 0647bf564f1e ("Btrfs: improve forever loop when doing balance relocation"),
> which is more than 10 years ago. Drop the argument and simplify the code.
>
> Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>

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

Thanks,
Qu

> ---
>   fs/btrfs/relocation.c | 9 ++++-----
>   1 file changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
> index bd573a0ec270..22086e840801 100644
> --- a/fs/btrfs/relocation.c
> +++ b/fs/btrfs/relocation.c
> @@ -2281,8 +2281,7 @@ struct btrfs_root *select_one_root(struct btrfs_backref_node *node)
>   }
>
>   static noinline_for_stack
> -u64 calcu_metadata_size(struct reloc_control *rc,
> -			struct btrfs_backref_node *node, int reserve)
> +u64 calcu_metadata_size(struct reloc_control *rc, struct btrfs_backref_node *node)
>   {
>   	struct btrfs_fs_info *fs_info = rc->extent_root->fs_info;
>   	struct btrfs_backref_node *next = node;
> @@ -2291,12 +2290,12 @@ u64 calcu_metadata_size(struct reloc_control *rc,
>   	u64 num_bytes = 0;
>   	int index = 0;
>
> -	BUG_ON(reserve && node->processed);
> +	BUG_ON(node->processed);
>
>   	while (next) {
>   		cond_resched();
>   		while (1) {
> -			if (next->processed && (reserve || next != node))
> +			if (next->processed)
>   				break;
>
>   			num_bytes += fs_info->nodesize;
> @@ -2324,7 +2323,7 @@ static int reserve_metadata_space(struct btrfs_trans_handle *trans,
>   	int ret;
>   	u64 tmp;
>
> -	num_bytes = calcu_metadata_size(rc, node, 1) * 2;
> +	num_bytes = calcu_metadata_size(rc, node) * 2;
>
>   	trans->block_rsv = rc->block_rsv;
>   	rc->reserved_bytes += num_bytes;

  reply	other threads:[~2024-04-24  6:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-24  6:38 [PATCH] btrfs: drop unused argument of calcu_metadata_size() Naohiro Aota
2024-04-24  6:53 ` Qu Wenruo [this message]
2024-04-24  7:57 ` Johannes Thumshirn

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=c15981d9-c37e-4b14-bc17-5f3b2f5a69e9@gmx.com \
    --to=quwenruo.btrfs@gmx.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=naohiro.aota@wdc.com \
    /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