linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
To: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>, <kreijack@inwind.it>,
	<1i5t5.duncan@cox.net>, <rwhite@pobox.com>,
	<lists@colorremedies.com>
Cc: <linux-btrfs@vger.kernel.org>
Subject: Re: [PATCH v2 2/3] Btrfs: raid56: simplify the parameter of nr_parity_stripes().
Date: Tue, 16 Dec 2014 15:21:37 +0900	[thread overview]
Message-ID: <548FCF71.7040200@jp.fujitsu.com> (raw)
In-Reply-To: <e6e28a35915d9bb147edb3b8767d27d10ab78ac3.1418203063.git.yangds.fnst@cn.fujitsu.com>

(2014/12/11 17:31), Dongsheng Yang wrote:
> We just need the type of a chunk to calculate the number of parity stripes,
> but we have to pass a structure of lookup_map to it. This will prevent some
> callers to use it where there is no a convenient lookup_map to be passed.
> 
> This patch replace the parameter of struct map_lookup * with a profile type.
> Then we can use it more easily.
> 
> Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>

Although patch 1/3 and patch 3/3 is being discussed, at least
this patch (patch 2/3) looks fine to me.

Reviewed-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>

Thanks,
Satoru

> ---
>   fs/btrfs/raid56.h  | 8 ++++----
>   fs/btrfs/volumes.c | 2 +-
>   2 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/fs/btrfs/raid56.h b/fs/btrfs/raid56.h
> index ea5d73b..68ac9d3 100644
> --- a/fs/btrfs/raid56.h
> +++ b/fs/btrfs/raid56.h
> @@ -19,11 +19,11 @@
>   
>   #ifndef __BTRFS_RAID56__
>   #define __BTRFS_RAID56__
> -static inline int nr_parity_stripes(struct map_lookup *map)
> +static inline int nr_parity_stripes(u64 type)
>   {
> -	if (map->type & BTRFS_BLOCK_GROUP_RAID5)
> +	if (type & BTRFS_BLOCK_GROUP_RAID5)
>   		return 1;
> -	else if (map->type & BTRFS_BLOCK_GROUP_RAID6)
> +	else if (type & BTRFS_BLOCK_GROUP_RAID6)
>   		return 2;
>   	else
>   		return 0;
> @@ -31,7 +31,7 @@ static inline int nr_parity_stripes(struct map_lookup *map)
>   
>   static inline int nr_data_stripes(struct map_lookup *map)
>   {
> -	return map->num_stripes - nr_parity_stripes(map);
> +	return map->num_stripes - nr_parity_stripes(map->type);
>   }
>   #define RAID5_P_STRIPE ((u64)-2)
>   #define RAID6_Q_STRIPE ((u64)-1)
> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
> index f61278f..aa3a907 100644
> --- a/fs/btrfs/volumes.c
> +++ b/fs/btrfs/volumes.c
> @@ -5174,7 +5174,7 @@ static int __btrfs_map_block(struct btrfs_fs_info *fs_info, int rw,
>   
>   			/* RAID[56] write or recovery. Return all stripes */
>   			num_stripes = map->num_stripes;
> -			max_errors = nr_parity_stripes(map);
> +			max_errors = nr_parity_stripes(map->type);
>   
>   			raid_map = kmalloc_array(num_stripes, sizeof(u64),
>   					   GFP_NOFS);
> 


  reply	other threads:[~2014-12-16  6:23 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-11  8:31 [PATCH v2 1/3] Btrfs: get more accurate output in df command Dongsheng Yang
2014-12-11  8:31 ` [PATCH v2 2/3] Btrfs: raid56: simplify the parameter of nr_parity_stripes() Dongsheng Yang
2014-12-16  6:21   ` Satoru Takeuchi [this message]
2014-12-11  8:31 ` [PATCH v2 3/3] Btrfs: adapt df command to RAID5/6 Dongsheng Yang
2014-12-12 18:00 ` [PATCH v2 1/3] Btrfs: get more accurate output in df command Goffredo Baroncelli
2014-12-13  0:50   ` Duncan
2014-12-13 10:21     ` Dongsheng Yang
2014-12-13  9:57   ` Dongsheng Yang
2014-12-12 19:25 ` Goffredo Baroncelli
2014-12-14 11:29   ` Dongsheng Yang
     [not found]     ` <CABmMA7tw9BDsBXGHLO4vjcO4gaYmZPb_BQV8w22griqFvCJpPA@mail.gmail.com>
2014-12-14 14:32       ` Grzegorz Kowal
2014-12-15  1:21         ` Dongsheng Yang
2014-12-15  6:06           ` Robert White
2014-12-15  7:49             ` Robert White
2014-12-15  8:26               ` Dongsheng Yang
2014-12-15  9:36                 ` Robert White
2014-12-16  3:30                   ` Standards Problems [Was: [PATCH v2 1/3] Btrfs: get more accurate output in df command.] Robert White
2014-12-16  3:52                     ` Robert White
2014-12-16 11:30                     ` Dongsheng Yang
2014-12-16 13:24                       ` Dongsheng Yang
2014-12-16 19:52                       ` Robert White
2014-12-17 11:38                         ` Dongsheng Yang
2014-12-18  4:07                           ` Robert White
2014-12-18  8:02                             ` Duncan
2014-12-23 12:31                             ` Dongsheng Yang
2014-12-27  1:10                               ` Robert White
2015-01-05  9:59                                 ` Dongsheng Yang
2014-12-31  0:15                             ` Zygo Blaxell
2015-01-05  9:56                               ` Dongsheng Yang
2015-01-05 10:07                                 ` [PATCH v2 1/3] Btrfs: get more accurate output in df command Dongsheng Yang
2015-01-05 10:07                                   ` [PATCH v2 2/3] Btrfs: raid56: simplify the parameter of nr_parity_stripes() Dongsheng Yang
2015-01-05 10:07                                   ` [PATCH v2 3/3] Btrfs: adapt df command to RAID5/6 Dongsheng Yang
2014-12-19  3:32             ` [PATCH v2 1/3] Btrfs: get more accurate output in df command Zygo Blaxell
     [not found]     ` <548F1EA7.9050505@inwind.it>
2014-12-16 13:47       ` Dongsheng Yang

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=548FCF71.7040200@jp.fujitsu.com \
    --to=takeuchi_satoru@jp.fujitsu.com \
    --cc=1i5t5.duncan@cox.net \
    --cc=kreijack@inwind.it \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=lists@colorremedies.com \
    --cc=rwhite@pobox.com \
    --cc=yangds.fnst@cn.fujitsu.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;
as well as URLs for NNTP newsgroup(s).