From: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
To: <linux-btrfs@vger.kernel.org>, <zblaxell@furryterror.org>, <clm@fb.com>
Cc: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
Subject: [PATCH v3 2/3] Btrfs: raid56: simplify the parameter of nr_parity_stripes().
Date: Thu, 5 Mar 2015 10:18:37 +0800 [thread overview]
Message-ID: <1425521918-30212-3-git-send-email-yangds.fnst@cn.fujitsu.com> (raw)
In-Reply-To: <1425521918-30212-1-git-send-email-yangds.fnst@cn.fujitsu.com>
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>
Reviewed-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
---
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 2b5d797..751fcd5 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 cd4d131..35043c9 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -5196,7 +5196,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);
*length = map->stripe_len;
stripe_index = 0;
--
1.8.4.2
next prev parent reply other threads:[~2015-03-05 2:22 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-05 2:18 [PATCH v3 0/3] Enhancement for df command Dongsheng Yang
2015-03-05 2:18 ` [PATCH v3 1/3] Btrfs: get more accurate output in " Dongsheng Yang
2015-03-06 6:50 ` [PATCH v4 " Dongsheng Yang
2015-03-05 2:18 ` Dongsheng Yang [this message]
2015-03-05 2:18 ` [PATCH v3 3/3] Btrfs: adapt df command to RAID5/6 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=1425521918-30212-3-git-send-email-yangds.fnst@cn.fujitsu.com \
--to=yangds.fnst@cn.fujitsu.com \
--cc=clm@fb.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=zblaxell@furryterror.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).