public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Nikolay Borisov <nborisov@suse.com>
To: Qu Wenruo <wqu@suse.com>, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 04/10] btrfs: relocation: Rename mark_block_processed() and __mark_block_processed()
Date: Wed, 26 Feb 2020 15:56:29 +0200	[thread overview]
Message-ID: <10b7542c-0d71-1561-2f3a-39754d12848f@suse.com> (raw)
In-Reply-To: <20200226055652.24857-5-wqu@suse.com>



On 26.02.20 г. 7:56 ч., Qu Wenruo wrote:
> These two functions are weirdly named, mark_block_processed() in fact
> just mark a range dirty unconditionally, while __mark_block_processed()
> does extra check before doing the marking.
> 
> Rename mark_block_processed() to mark_range_processed(), and rename
> __mark_block_processed() to mark_block_processed().
> 
> Since we're here, also kill the forward declaration.
> 
> Signed-off-by: Qu Wenruo <wqu@suse.com>
> ---
>  fs/btrfs/relocation.c | 65 +++++++++++++++++++++----------------------
>  1 file changed, 32 insertions(+), 33 deletions(-)
> 
> diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
> index 1fe34d8eef6d..d81fa6d63129 100644
> --- a/fs/btrfs/relocation.c
> +++ b/fs/btrfs/relocation.c
> @@ -189,8 +189,34 @@ struct reloc_control {
>  
>  static void remove_backref_node(struct backref_cache *cache,
>  				struct backref_node *node);
> -static void __mark_block_processed(struct reloc_control *rc,
> -				   struct backref_node *node);
> +
> +static int in_block_group(u64 bytenr, struct btrfs_block_group *block_group)
> +{
> +	if (bytenr >= block_group->start &&
> +	    bytenr < block_group->start + block_group->length)
> +		return 1;
> +	return 0;
> +}

This function can be killed altogether and replaced with the in_range
macro defined in fs/btrfs/misc.h . The only difference is you'd have to
call it

in_range(bytenr, block_group->start, block_group->length);

Seeing how in_block_group is called in only 2 places I don't think it
will be a big loss.

> +
> +static void mark_range_processed(struct reloc_control *rc,
> +				 u64 bytenr, u32 blocksize)
> +{
> +	set_extent_bits(&rc->processed_blocks, bytenr, bytenr + blocksize - 1,
> +			EXTENT_DIRTY);
> +}

Having a wrapper just for this seems a bit pointless, remove it and open
code the set_extent_bit call in mark_block_processed.

<snip>

  reply	other threads:[~2020-02-26 13:56 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-26  5:56 [PATCH 00/10] btrfs: relocation: Refactor build_backref_tree() Qu Wenruo
2020-02-26  5:56 ` [PATCH 01/10] btrfs: backref: Introduce the skeleton of btrfs_backref_iter Qu Wenruo
2020-02-26  5:56 ` [PATCH 02/10] btrfs: backref: Implement btrfs_backref_iter_next() Qu Wenruo
2020-02-26  5:56 ` [PATCH 03/10] btrfs: relocation: Use btrfs_backref_iter infrastructure Qu Wenruo
2020-02-26  5:56 ` [PATCH 04/10] btrfs: relocation: Rename mark_block_processed() and __mark_block_processed() Qu Wenruo
2020-02-26 13:56   ` Nikolay Borisov [this message]
2020-02-26  5:56 ` [PATCH 05/10] btrfs: relocation: Refactor tree backref processing into its own function Qu Wenruo
2020-02-26  5:56 ` [PATCH 06/10] btrfs: relocation: Use wrapper to replace open-coded edge linking Qu Wenruo
2020-02-26  5:56 ` [PATCH 07/10] btrfs: relocation: Specify essential members for alloc_backref_node() Qu Wenruo
2020-02-26  5:56 ` [PATCH 08/10] btrfs: relocation: Remove the open-coded goto loop for breadth-first search Qu Wenruo
2020-02-26  5:56 ` [PATCH 09/10] btrfs: relocation: Refactor the finishing part of upper linkage into finish_upper_links() Qu Wenruo
2020-02-26  5:56 ` [PATCH 10/10] btrfs: relocation: Refactor the useless nodes handling into its own function Qu Wenruo
2020-02-28 15:45 ` [PATCH 00/10] btrfs: relocation: Refactor build_backref_tree() David Sterba
2020-02-29  1:00   ` Qu Wenruo
2020-03-02 20:26     ` David Sterba

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=10b7542c-0d71-1561-2f3a-39754d12848f@suse.com \
    --to=nborisov@suse.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=wqu@suse.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