(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.f...@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_sat...@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); > -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html