linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nikolay Borisov <nborisov@suse.com>
To: Anand Jain <anand.jain@oracle.com>, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 2/2] btrfs: drop optimal argument from find_live_mirror()
Date: Tue, 30 Jan 2018 11:12:24 +0200	[thread overview]
Message-ID: <7f847ad2-eb70-40aa-1d4b-0ed2119075f4@suse.com> (raw)
In-Reply-To: <20180130062831.14644-3-anand.jain@oracle.com>



On 30.01.2018 08:28, Anand Jain wrote:
> Drop optimal argument from the function find_live_mirror()
> as we can deduce it in the function itself.
> 
> Signed-off-by: Anand Jain <anand.jain@oracle.com>
> ---
>  fs/btrfs/volumes.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
> index 9c9d987838c2..a61715677b67 100644
> --- a/fs/btrfs/volumes.c
> +++ b/fs/btrfs/volumes.c
> @@ -5253,10 +5253,11 @@ int btrfs_is_parity_mirror(struct btrfs_fs_info *fs_info, u64 logical, u64 len)
>  
>  static int find_live_mirror(struct btrfs_fs_info *fs_info,
>  			    struct map_lookup *map, int first,
> -			    int optimal, int dev_replace_is_ongoing)
> +			    int dev_replace_is_ongoing)
>  {
>  	int i;
>  	int num;
> +	int optimal;
>  	int tolerance;
>  	struct btrfs_device *srcdev;
>  
> @@ -5268,6 +5269,8 @@ static int find_live_mirror(struct btrfs_fs_info *fs_info,
>  	else
>  		num = map->num_stripes;
>  
> +	optimal = first + current->pid % num;
> +
>  	if (dev_replace_is_ongoing &&
>  	    fs_info->dev_replace.cont_reading_from_srcdev_mode ==
>  	     BTRFS_DEV_REPLACE_ITEM_CONT_READING_FROM_SRCDEV_MODE_AVOID)
> @@ -5821,7 +5824,6 @@ static int __btrfs_map_block(struct btrfs_fs_info *fs_info,
>  			stripe_index = mirror_num - 1;
>  		else {
>  			stripe_index = find_live_mirror(fs_info, map, 0,
> -					    current->pid % map->num_stripes,
>  					    dev_replace_is_ongoing);
>  			mirror_num = stripe_index + 1;
>  		}
> @@ -5849,8 +5851,6 @@ static int __btrfs_map_block(struct btrfs_fs_info *fs_info,
>  			int old_stripe_index = stripe_index;
>  			stripe_index = find_live_mirror(fs_info, map,
>  					      stripe_index,
> -					      stripe_index +
> -					      current->pid % map->sub_stripes,

The value of optimal here (BTRFS_BLOCK_GROUP_RAID10) is different than
the value of optimal in BTRFS_BLOCK_GROUP_RAID1 case. So you need to put
optimal in the conditional branch you added in the previous patch. In
raid 1 case:

optimal = current->pid % num;

In raid 10:

optimal = first + current->pid % num;

to current semantics

>  					      dev_replace_is_ongoing);
>  			mirror_num = stripe_index - old_stripe_index + 1;
>  		}
> 

  reply	other threads:[~2018-01-30  9:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-30  6:28 [PATCH 0/2] Preparatory to add read_mirror mount option Anand Jain
2018-01-30  6:28 ` [PATCH 1/2] btrfs: drop num argument from find_live_mirror() Anand Jain
2018-02-24  0:26   ` David Sterba
2018-01-30  6:28 ` [PATCH 2/2] btrfs: drop optimal " Anand Jain
2018-01-30  9:12   ` Nikolay Borisov [this message]
2018-01-30 10:04     ` Anand Jain
2018-02-24  0:28   ` 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=7f847ad2-eb70-40aa-1d4b-0ed2119075f4@suse.com \
    --to=nborisov@suse.com \
    --cc=anand.jain@oracle.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).