* [PATCH 1 of 2]: DM RAID: Move 'sectors_per_dev' calculation
@ 2012-06-26 8:57 Jonathan Brassow
2012-06-26 14:57 ` [PATCH 1 of 2 - v2]: " Jonathan Brassow
2012-07-04 1:18 ` [PATCH 1 of 2]: " Alasdair G Kergon
0 siblings, 2 replies; 3+ messages in thread
From: Jonathan Brassow @ 2012-06-26 8:57 UTC (permalink / raw)
To: dm-devel
dm-raid: Move sectors_per_dev calculation later in the device creation process
In preparation for RAID10 inclusion in dm-raid, we move the sectors_per_dev
calculation later in the device creation process. This is because we won't
know up-front how many stripes vs how many mirrors there are - which will
change the calculation.
Signed-off-by: Jonathan Brassow <jbrassow@redhat.com>
Index: linux-upstream/drivers/md/dm-raid.c
===================================================================
--- linux-upstream.orig/drivers/md/dm-raid.c
+++ linux-upstream/drivers/md/dm-raid.c
@@ -101,20 +101,12 @@ static struct raid_set *context_alloc(st
{
unsigned i;
struct raid_set *rs;
- sector_t sectors_per_dev;
if (raid_devs <= raid_type->parity_devs) {
ti->error = "Insufficient number of devices";
return ERR_PTR(-EINVAL);
}
- sectors_per_dev = ti->len;
- if ((raid_type->level > 1) &&
- sector_div(sectors_per_dev, (raid_devs - raid_type->parity_devs))) {
- ti->error = "Target length not divisible by number of data devices";
- return ERR_PTR(-EINVAL);
- }
-
rs = kzalloc(sizeof(*rs) + raid_devs * sizeof(rs->dev[0]), GFP_KERNEL);
if (!rs) {
ti->error = "Cannot allocate raid context";
@@ -128,7 +120,6 @@ static struct raid_set *context_alloc(st
rs->md.raid_disks = raid_devs;
rs->md.level = raid_type->level;
rs->md.new_level = rs->md.level;
- rs->md.dev_sectors = sectors_per_dev;
rs->md.layout = raid_type->algorithm;
rs->md.new_layout = rs->md.layout;
rs->md.delta_disks = 0;
@@ -143,6 +134,7 @@ static struct raid_set *context_alloc(st
* rs->md.external
* rs->md.chunk_sectors
* rs->md.new_chunk_sectors
+ * rs->md.dev_sectors
*/
return rs;
@@ -353,6 +345,7 @@ static int parse_raid_params(struct raid
{
unsigned i, rebuild_cnt = 0;
unsigned long value, region_size = 0;
+ sector_t sectors_per_dev = rs->ti->len;
char *key;
/*
@@ -526,6 +519,13 @@ static int parse_raid_params(struct raid
else
rs->ti->split_io = region_size;
+ if ((rs->raid_type->level > 1) &&
+ sector_div(sectors_per_dev, (rs->md.raid_disks - rs->raid_type->parity_devs))) {
+ rs->ti->error = "Target length not divisible by number of data devices";
+ return -EINVAL;
+ }
+ rs->md.dev_sectors = sectors_per_dev;
+
/* Assume there are no metadata devices until the drives are parsed */
rs->md.persistent = 0;
rs->md.external = 1;
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1 of 2 - v2]: DM RAID: Move 'sectors_per_dev' calculation
2012-06-26 8:57 [PATCH 1 of 2]: DM RAID: Move 'sectors_per_dev' calculation Jonathan Brassow
@ 2012-06-26 14:57 ` Jonathan Brassow
2012-07-04 1:18 ` [PATCH 1 of 2]: " Alasdair G Kergon
1 sibling, 0 replies; 3+ messages in thread
From: Jonathan Brassow @ 2012-06-26 14:57 UTC (permalink / raw)
To: dm-devel
Version 2 in response to conflicts found with existing patches in linux-next.
brassow
dm-raid: Move sectors_per_dev calculation later in the device creation process
In preparation for RAID10 inclusion in dm-raid, we move the sectors_per_dev
calculation later in the device creation process. This is because we won't
know up-front how many stripes vs how many mirrors there are - which will
change the calculation.
Signed-off-by: Jonathan Brassow <jbrassow@redhat.com>
Index: linux-upstream/drivers/md/dm-raid.c
===================================================================
--- linux-upstream.orig/drivers/md/dm-raid.c
+++ linux-upstream/drivers/md/dm-raid.c
@@ -101,20 +101,12 @@ static struct raid_set *context_alloc(st
{
unsigned i;
struct raid_set *rs;
- sector_t sectors_per_dev;
if (raid_devs <= raid_type->parity_devs) {
ti->error = "Insufficient number of devices";
return ERR_PTR(-EINVAL);
}
- sectors_per_dev = ti->len;
- if ((raid_type->level > 1) &&
- sector_div(sectors_per_dev, (raid_devs - raid_type->parity_devs))) {
- ti->error = "Target length not divisible by number of data devices";
- return ERR_PTR(-EINVAL);
- }
-
rs = kzalloc(sizeof(*rs) + raid_devs * sizeof(rs->dev[0]), GFP_KERNEL);
if (!rs) {
ti->error = "Cannot allocate raid context";
@@ -128,7 +120,6 @@ static struct raid_set *context_alloc(st
rs->md.raid_disks = raid_devs;
rs->md.level = raid_type->level;
rs->md.new_level = rs->md.level;
- rs->md.dev_sectors = sectors_per_dev;
rs->md.layout = raid_type->algorithm;
rs->md.new_layout = rs->md.layout;
rs->md.delta_disks = 0;
@@ -143,6 +134,7 @@ static struct raid_set *context_alloc(st
* rs->md.external
* rs->md.chunk_sectors
* rs->md.new_chunk_sectors
+ * rs->md.dev_sectors
*/
return rs;
@@ -353,6 +345,7 @@ static int parse_raid_params(struct raid
{
unsigned i, rebuild_cnt = 0;
unsigned long value, region_size = 0;
+ sector_t sectors_per_dev = rs->ti->len;
sector_t max_io_len;
char *key;
@@ -530,6 +523,13 @@ static int parse_raid_params(struct raid
if (dm_set_target_max_io_len(rs->ti, max_io_len))
return -EINVAL;
+ if ((rs->raid_type->level > 1) &&
+ sector_div(sectors_per_dev, (rs->md.raid_disks - rs->raid_type->parity_devs))) {
+ rs->ti->error = "Target length not divisible by number of data devices";
+ return -EINVAL;
+ }
+ rs->md.dev_sectors = sectors_per_dev;
+
/* Assume there are no metadata devices until the drives are parsed */
rs->md.persistent = 0;
rs->md.external = 1;
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1 of 2]: DM RAID: Move 'sectors_per_dev' calculation
2012-06-26 8:57 [PATCH 1 of 2]: DM RAID: Move 'sectors_per_dev' calculation Jonathan Brassow
2012-06-26 14:57 ` [PATCH 1 of 2 - v2]: " Jonathan Brassow
@ 2012-07-04 1:18 ` Alasdair G Kergon
1 sibling, 0 replies; 3+ messages in thread
From: Alasdair G Kergon @ 2012-07-04 1:18 UTC (permalink / raw)
To: Jonathan Brassow; +Cc: dm-devel
On Tue, Jun 26, 2012 at 03:57:40AM -0500, Jon Brassow wrote:
> dm-raid: Move sectors_per_dev calculation later in the device creation process
There's an obvious conflict here: split_io has gone!
Please rebase these patches to come *after* the patches already in linux-next.
http://people.redhat.com/agk/patches/linux/editing/series.html
as far as the NEXT_PATCHES_END marker.
Thanks,
Alasdair
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-07-04 1:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-26 8:57 [PATCH 1 of 2]: DM RAID: Move 'sectors_per_dev' calculation Jonathan Brassow
2012-06-26 14:57 ` [PATCH 1 of 2 - v2]: " Jonathan Brassow
2012-07-04 1:18 ` [PATCH 1 of 2]: " Alasdair G Kergon
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).