linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: David Sterba <dsterba@suse.com>, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 4/9] btrfs: scrub: factor out common scrub_stripe constraints
Date: Wed, 26 May 2021 07:51:11 +0800	[thread overview]
Message-ID: <ee829f79-828c-b174-86f7-f30b0a12b6ac@gmx.com> (raw)
In-Reply-To: <d175e98023012390c53755ba85f93606376f51a4.1621961965.git.dsterba@suse.com>



On 2021/5/26 上午1:08, David Sterba wrote:
> There are common values set for the stripe constraints, some of them
> are already factored out. Do that for increment and mirror_num as well.
>
> Signed-off-by: David Sterba <dsterba@suse.com>

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

Thanks,
Qu
> ---
>   fs/btrfs/scrub.c | 9 ++-------
>   1 file changed, 2 insertions(+), 7 deletions(-)
>
> diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
> index 518415d0c122..5839ad1e25a2 100644
> --- a/fs/btrfs/scrub.c
> +++ b/fs/btrfs/scrub.c
> @@ -3204,28 +3204,23 @@ static noinline_for_stack int scrub_stripe(struct scrub_ctx *sctx,
>   	physical = map->stripes[num].physical;
>   	offset = 0;
>   	nstripes = div64_u64(length, map->stripe_len);
> +	mirror_num = 1;
> +	increment = map->stripe_len;
>   	if (map->type & BTRFS_BLOCK_GROUP_RAID0) {
>   		offset = map->stripe_len * num;
>   		increment = map->stripe_len * map->num_stripes;
> -		mirror_num = 1;
>   	} else if (map->type & BTRFS_BLOCK_GROUP_RAID10) {
>   		int factor = map->num_stripes / map->sub_stripes;
>   		offset = map->stripe_len * (num / map->sub_stripes);
>   		increment = map->stripe_len * factor;
>   		mirror_num = num % map->sub_stripes + 1;
>   	} else if (map->type & BTRFS_BLOCK_GROUP_RAID1_MASK) {
> -		increment = map->stripe_len;
>   		mirror_num = num % map->num_stripes + 1;
>   	} else if (map->type & BTRFS_BLOCK_GROUP_DUP) {
> -		increment = map->stripe_len;
>   		mirror_num = num % map->num_stripes + 1;
>   	} else if (map->type & BTRFS_BLOCK_GROUP_RAID56_MASK) {
>   		get_raid56_logic_offset(physical, num, map, &offset, NULL);
>   		increment = map->stripe_len * nr_data_stripes(map);
> -		mirror_num = 1;
> -	} else {
> -		increment = map->stripe_len;
> -		mirror_num = 1;
>   	}
>
>   	path = btrfs_alloc_path();
>

  reply	other threads:[~2021-05-25 23:51 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-25 17:08 [PATCH 0/9] Misc fixups and cleanups David Sterba
2021-05-25 17:08 ` [PATCH 1/9] btrfs: sysfs: fix format string for some discard stats David Sterba
2021-05-25 23:47   ` Qu Wenruo
2021-05-26  6:01   ` Anand Jain
2021-05-25 17:08 ` [PATCH 2/9] btrfs: clear defrag status of a root if starting transaction fails David Sterba
2021-05-25 23:49   ` Qu Wenruo
2021-05-26  6:05   ` Anand Jain
2021-05-25 17:08 ` [PATCH 3/9] btrfs: clear log tree recovering status " David Sterba
2021-05-25 23:50   ` Qu Wenruo
2021-05-26  6:57   ` Anand Jain
2021-05-25 17:08 ` [PATCH 4/9] btrfs: scrub: factor out common scrub_stripe constraints David Sterba
2021-05-25 23:51   ` Qu Wenruo [this message]
2021-05-26  7:16   ` Anand Jain
2021-05-25 17:08 ` [PATCH 5/9] btrfs: document byte swap optimization of root_item::flags accessors David Sterba
2021-05-26  7:28   ` Anand Jain
2021-05-25 17:08 ` [PATCH 6/9] btrfs: reduce compressed_bio members' types David Sterba
2021-05-26  8:40   ` [PATCH] btrfs: optimize users of members of the struct compressed_bio Anand Jain
2021-05-26 16:34     ` David Sterba
2021-05-26  8:41   ` [PATCH 6/9] btrfs: reduce compressed_bio members' types Anand Jain
2021-05-25 17:08 ` [PATCH 7/9] btrfs: remove extra sb::s_id from message in btrfs_validate_metadata_buffer David Sterba
2021-05-25 23:59   ` Qu Wenruo
2021-05-26 12:54   ` Anand Jain
2021-05-25 17:08 ` [PATCH 8/9] btrfs: simplify eb checksum verification " David Sterba
2021-05-26  0:05   ` Qu Wenruo
2021-05-26 16:31     ` David Sterba
2021-05-26 16:58       ` David Sterba
2021-05-26 23:13         ` Qu Wenruo
2021-05-26 23:13           ` David Sterba
2021-05-25 17:08 ` [PATCH 9/9] btrfs: clean up header members offsets in write helpers David Sterba
2021-05-26  0:07   ` Qu Wenruo

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=ee829f79-828c-b174-86f7-f30b0a12b6ac@gmx.com \
    --to=quwenruo.btrfs@gmx.com \
    --cc=dsterba@suse.com \
    --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;
as well as URLs for NNTP newsgroup(s).