* [PATCH 0/4] btrfs-progs: get rid of btrfs_raid_profile_table
@ 2020-06-23 14:10 Johannes Thumshirn
2020-06-23 14:10 ` [PATCH 1/4] btrfs-progs: use sub_stripes property from btrfs_raid_attr Johannes Thumshirn
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Johannes Thumshirn @ 2020-06-23 14:10 UTC (permalink / raw)
To: David Sterba; +Cc: linux-btrfs, Qu Wenruo, Johannes Thumshirn
From: Johannes Thumshirn <johannes.thumshirn@wdc.com>
As promised here's the removal of btrfs_raid_profile_table which helped as a
intermediate step to refactor the raid specific settings in block group
creation in progs.
As Qu remindet me of the outstanding debts this morning, I decided to go ahead
and pay my debt today.
It will not be the last refactoring round in this area though, as the
btrfs-progs side and the kernel side still diverge a lot.
This series passes a full 'make test' run from btrfs-progs.
Johannes Thumshirn (4):
btrfs-progs: use sub_stripes property from btrfs_raid_attr
btrfs-progs: use minimal number of stripes from btrfs_raid_attr
btrfs-progs: remove unused btrfs_raid_profile::max_stripes
btrfs-progs: remove btrfs_raid_profile_table
volumes.c | 71 +++++--------------------------------------------------
1 file changed, 6 insertions(+), 65 deletions(-)
--
2.26.2
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/4] btrfs-progs: use sub_stripes property from btrfs_raid_attr
2020-06-23 14:10 [PATCH 0/4] btrfs-progs: get rid of btrfs_raid_profile_table Johannes Thumshirn
@ 2020-06-23 14:10 ` Johannes Thumshirn
2020-06-23 14:10 ` [PATCH 2/4] btrfs-progs: use minimal number of stripes " Johannes Thumshirn
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Johannes Thumshirn @ 2020-06-23 14:10 UTC (permalink / raw)
To: David Sterba; +Cc: linux-btrfs, Qu Wenruo, Johannes Thumshirn
From: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Both btrfs_raid_attr and btrfs_raid_profile define the number of
sub_stripes a raid type has.
Use the one from btrfs_raid_attr and get rid of the field in
btrfs_raid_profile.
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
---
volumes.c | 12 +-----------
1 file changed, 1 insertion(+), 11 deletions(-)
diff --git a/volumes.c b/volumes.c
index 7c57d6cb..9d0eeed5 100644
--- a/volumes.c
+++ b/volumes.c
@@ -1002,61 +1002,51 @@ static const struct btrfs_raid_profile {
int num_stripes;
int max_stripes;
int min_stripes;
- int sub_stripes;
} btrfs_raid_profile_table[BTRFS_NR_RAID_TYPES] = {
[BTRFS_RAID_RAID10] = {
.num_stripes = 0,
.max_stripes = 0,
.min_stripes = 4,
- .sub_stripes = 2,
},
[BTRFS_RAID_RAID1] = {
.num_stripes = 0,
.max_stripes = 0,
.min_stripes = 2,
- .sub_stripes = 1,
},
[BTRFS_RAID_RAID1C3] = {
.num_stripes = 0,
.max_stripes = 0,
.min_stripes = 3,
- .sub_stripes = 1,
},
[BTRFS_RAID_RAID1C4] = {
.num_stripes = 0,
.max_stripes = 0,
.min_stripes = 4,
- .sub_stripes = 1,
},
[BTRFS_RAID_DUP] = {
.num_stripes = 2,
.max_stripes = 0,
.min_stripes = 2,
- .sub_stripes = 1,
},
[BTRFS_RAID_RAID0] = {
.num_stripes = 0,
.max_stripes = 0,
.min_stripes = 2,
- .sub_stripes = 1,
},
[BTRFS_RAID_SINGLE] = {
.num_stripes = 1,
.max_stripes = 0,
.min_stripes = 1,
- .sub_stripes = 1,
},
[BTRFS_RAID_RAID5] = {
.num_stripes = 0,
.max_stripes = 0,
.min_stripes = 2,
- .sub_stripes = 1,
},
[BTRFS_RAID_RAID6] = {
.num_stripes = 0,
.max_stripes = 0,
.min_stripes = 3,
- .sub_stripes = 1,
},
};
@@ -1067,7 +1057,7 @@ static void init_alloc_chunk_ctl(struct btrfs_fs_info *info,
ctl->num_stripes = btrfs_raid_profile_table[type].num_stripes;
ctl->min_stripes = btrfs_raid_profile_table[type].min_stripes;
- ctl->sub_stripes = btrfs_raid_profile_table[type].sub_stripes;
+ ctl->sub_stripes = btrfs_raid_array[type].sub_stripes;
ctl->stripe_len = BTRFS_STRIPE_LEN;
switch (type) {
--
2.26.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/4] btrfs-progs: use minimal number of stripes from btrfs_raid_attr
2020-06-23 14:10 [PATCH 0/4] btrfs-progs: get rid of btrfs_raid_profile_table Johannes Thumshirn
2020-06-23 14:10 ` [PATCH 1/4] btrfs-progs: use sub_stripes property from btrfs_raid_attr Johannes Thumshirn
@ 2020-06-23 14:10 ` Johannes Thumshirn
2020-06-23 14:10 ` [PATCH 3/4] btrfs-progs: remove unused btrfs_raid_profile::max_stripes Johannes Thumshirn
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Johannes Thumshirn @ 2020-06-23 14:10 UTC (permalink / raw)
To: David Sterba; +Cc: linux-btrfs, Qu Wenruo, Johannes Thumshirn
From: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Both btrfs_raid_attr and btrfs_raid_profile define the minimal number of
stripes for each raid profile.
The difference is in btrfs_raid_attr the number of stripes is called
devs_min and in btrfs_raid_profile its called min_stripes.
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
---
volumes.c | 15 ++++-----------
1 file changed, 4 insertions(+), 11 deletions(-)
diff --git a/volumes.c b/volumes.c
index 9d0eeed5..82d7a872 100644
--- a/volumes.c
+++ b/volumes.c
@@ -1001,52 +1001,42 @@ error:
static const struct btrfs_raid_profile {
int num_stripes;
int max_stripes;
- int min_stripes;
} btrfs_raid_profile_table[BTRFS_NR_RAID_TYPES] = {
[BTRFS_RAID_RAID10] = {
.num_stripes = 0,
.max_stripes = 0,
- .min_stripes = 4,
},
[BTRFS_RAID_RAID1] = {
.num_stripes = 0,
.max_stripes = 0,
- .min_stripes = 2,
},
[BTRFS_RAID_RAID1C3] = {
.num_stripes = 0,
.max_stripes = 0,
- .min_stripes = 3,
},
[BTRFS_RAID_RAID1C4] = {
.num_stripes = 0,
.max_stripes = 0,
- .min_stripes = 4,
},
[BTRFS_RAID_DUP] = {
.num_stripes = 2,
.max_stripes = 0,
- .min_stripes = 2,
},
[BTRFS_RAID_RAID0] = {
.num_stripes = 0,
.max_stripes = 0,
- .min_stripes = 2,
},
[BTRFS_RAID_SINGLE] = {
.num_stripes = 1,
.max_stripes = 0,
- .min_stripes = 1,
},
[BTRFS_RAID_RAID5] = {
.num_stripes = 0,
.max_stripes = 0,
- .min_stripes = 2,
},
[BTRFS_RAID_RAID6] = {
.num_stripes = 0,
.max_stripes = 0,
- .min_stripes = 3,
},
};
@@ -1056,11 +1046,14 @@ static void init_alloc_chunk_ctl(struct btrfs_fs_info *info,
int type = ctl->type;
ctl->num_stripes = btrfs_raid_profile_table[type].num_stripes;
- ctl->min_stripes = btrfs_raid_profile_table[type].min_stripes;
+ ctl->min_stripes = btrfs_raid_array[type].devs_min;
ctl->sub_stripes = btrfs_raid_array[type].sub_stripes;
ctl->stripe_len = BTRFS_STRIPE_LEN;
switch (type) {
+ case BTRFS_RAID_DUP:
+ ctl->min_stripes = 2;
+ break;
case BTRFS_RAID_RAID1:
case BTRFS_RAID_RAID1C3:
case BTRFS_RAID_RAID1C4:
--
2.26.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/4] btrfs-progs: remove unused btrfs_raid_profile::max_stripes
2020-06-23 14:10 [PATCH 0/4] btrfs-progs: get rid of btrfs_raid_profile_table Johannes Thumshirn
2020-06-23 14:10 ` [PATCH 1/4] btrfs-progs: use sub_stripes property from btrfs_raid_attr Johannes Thumshirn
2020-06-23 14:10 ` [PATCH 2/4] btrfs-progs: use minimal number of stripes " Johannes Thumshirn
@ 2020-06-23 14:10 ` Johannes Thumshirn
2020-06-23 14:10 ` [PATCH 4/4] btrfs-progs: remove btrfs_raid_profile_table Johannes Thumshirn
2020-06-23 15:45 ` [PATCH 0/4] btrfs-progs: get rid of btrfs_raid_profile_table David Sterba
4 siblings, 0 replies; 6+ messages in thread
From: Johannes Thumshirn @ 2020-06-23 14:10 UTC (permalink / raw)
To: David Sterba; +Cc: linux-btrfs, Qu Wenruo, Johannes Thumshirn
From: Johannes Thumshirn <johannes.thumshirn@wdc.com>
The max_stripes value of btrfs_raid_profile_table is unused, so we can
just remove it as well.
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
---
volumes.c | 10 ----------
1 file changed, 10 deletions(-)
diff --git a/volumes.c b/volumes.c
index 82d7a872..71c3735d 100644
--- a/volumes.c
+++ b/volumes.c
@@ -1000,43 +1000,33 @@ error:
static const struct btrfs_raid_profile {
int num_stripes;
- int max_stripes;
} btrfs_raid_profile_table[BTRFS_NR_RAID_TYPES] = {
[BTRFS_RAID_RAID10] = {
.num_stripes = 0,
- .max_stripes = 0,
},
[BTRFS_RAID_RAID1] = {
.num_stripes = 0,
- .max_stripes = 0,
},
[BTRFS_RAID_RAID1C3] = {
.num_stripes = 0,
- .max_stripes = 0,
},
[BTRFS_RAID_RAID1C4] = {
.num_stripes = 0,
- .max_stripes = 0,
},
[BTRFS_RAID_DUP] = {
.num_stripes = 2,
- .max_stripes = 0,
},
[BTRFS_RAID_RAID0] = {
.num_stripes = 0,
- .max_stripes = 0,
},
[BTRFS_RAID_SINGLE] = {
.num_stripes = 1,
- .max_stripes = 0,
},
[BTRFS_RAID_RAID5] = {
.num_stripes = 0,
- .max_stripes = 0,
},
[BTRFS_RAID_RAID6] = {
.num_stripes = 0,
- .max_stripes = 0,
},
};
--
2.26.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 4/4] btrfs-progs: remove btrfs_raid_profile_table
2020-06-23 14:10 [PATCH 0/4] btrfs-progs: get rid of btrfs_raid_profile_table Johannes Thumshirn
` (2 preceding siblings ...)
2020-06-23 14:10 ` [PATCH 3/4] btrfs-progs: remove unused btrfs_raid_profile::max_stripes Johannes Thumshirn
@ 2020-06-23 14:10 ` Johannes Thumshirn
2020-06-23 15:45 ` [PATCH 0/4] btrfs-progs: get rid of btrfs_raid_profile_table David Sterba
4 siblings, 0 replies; 6+ messages in thread
From: Johannes Thumshirn @ 2020-06-23 14:10 UTC (permalink / raw)
To: David Sterba; +Cc: linux-btrfs, Qu Wenruo, Johannes Thumshirn
From: Johannes Thumshirn <johannes.thumshirn@wdc.com>
For SINGLE and DUP RAID profiles we can get the num_stripes values from
btrfs_raid_attr::dev:stripes. For all other RAID profiles the value is
calculated anyways.
As this was the last remaining member of the btrfs_raid_profile_table we
can remove it as well.
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
---
volumes.c | 34 +---------------------------------
1 file changed, 1 insertion(+), 33 deletions(-)
diff --git a/volumes.c b/volumes.c
index 71c3735d..e8b4aad8 100644
--- a/volumes.c
+++ b/volumes.c
@@ -998,44 +998,12 @@ error:
- 2 * sizeof(struct btrfs_chunk)) \
/ sizeof(struct btrfs_stripe) + 1)
-static const struct btrfs_raid_profile {
- int num_stripes;
-} btrfs_raid_profile_table[BTRFS_NR_RAID_TYPES] = {
- [BTRFS_RAID_RAID10] = {
- .num_stripes = 0,
- },
- [BTRFS_RAID_RAID1] = {
- .num_stripes = 0,
- },
- [BTRFS_RAID_RAID1C3] = {
- .num_stripes = 0,
- },
- [BTRFS_RAID_RAID1C4] = {
- .num_stripes = 0,
- },
- [BTRFS_RAID_DUP] = {
- .num_stripes = 2,
- },
- [BTRFS_RAID_RAID0] = {
- .num_stripes = 0,
- },
- [BTRFS_RAID_SINGLE] = {
- .num_stripes = 1,
- },
- [BTRFS_RAID_RAID5] = {
- .num_stripes = 0,
- },
- [BTRFS_RAID_RAID6] = {
- .num_stripes = 0,
- },
-};
-
static void init_alloc_chunk_ctl(struct btrfs_fs_info *info,
struct alloc_chunk_ctl *ctl)
{
int type = ctl->type;
- ctl->num_stripes = btrfs_raid_profile_table[type].num_stripes;
+ ctl->num_stripes = btrfs_raid_array[type].dev_stripes;
ctl->min_stripes = btrfs_raid_array[type].devs_min;
ctl->sub_stripes = btrfs_raid_array[type].sub_stripes;
ctl->stripe_len = BTRFS_STRIPE_LEN;
--
2.26.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 0/4] btrfs-progs: get rid of btrfs_raid_profile_table
2020-06-23 14:10 [PATCH 0/4] btrfs-progs: get rid of btrfs_raid_profile_table Johannes Thumshirn
` (3 preceding siblings ...)
2020-06-23 14:10 ` [PATCH 4/4] btrfs-progs: remove btrfs_raid_profile_table Johannes Thumshirn
@ 2020-06-23 15:45 ` David Sterba
4 siblings, 0 replies; 6+ messages in thread
From: David Sterba @ 2020-06-23 15:45 UTC (permalink / raw)
To: Johannes Thumshirn
Cc: David Sterba, linux-btrfs, Qu Wenruo, Johannes Thumshirn
On Tue, Jun 23, 2020 at 04:10:15PM +0200, Johannes Thumshirn wrote:
> From: Johannes Thumshirn <johannes.thumshirn@wdc.com>
>
> As promised here's the removal of btrfs_raid_profile_table which helped as a
> intermediate step to refactor the raid specific settings in block group
> creation in progs.
>
> As Qu remindet me of the outstanding debts this morning, I decided to go ahead
> and pay my debt today.
>
> It will not be the last refactoring round in this area though, as the
> btrfs-progs side and the kernel side still diverge a lot.
Thanks, all look good. This level of granularity makes review easy and
as said before, the intermediate patches are ok esp when the code
diverged.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2020-06-23 15:45 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-23 14:10 [PATCH 0/4] btrfs-progs: get rid of btrfs_raid_profile_table Johannes Thumshirn
2020-06-23 14:10 ` [PATCH 1/4] btrfs-progs: use sub_stripes property from btrfs_raid_attr Johannes Thumshirn
2020-06-23 14:10 ` [PATCH 2/4] btrfs-progs: use minimal number of stripes " Johannes Thumshirn
2020-06-23 14:10 ` [PATCH 3/4] btrfs-progs: remove unused btrfs_raid_profile::max_stripes Johannes Thumshirn
2020-06-23 14:10 ` [PATCH 4/4] btrfs-progs: remove btrfs_raid_profile_table Johannes Thumshirn
2020-06-23 15:45 ` [PATCH 0/4] btrfs-progs: get rid of btrfs_raid_profile_table David Sterba
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.