Skip to contentSkip to conversation

md-raid0: conditional mddev->queue access to suit dm-raid

PATCH In review [email protected] 2 participants 3 messages Apr 29, 2015 – May 8, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 2/4 md-raid0: conditional mddev->queue access to suit dm-raid

From: Heinz Mauelshagen <[email protected]>

This patch is a prerequisite for dm-raid "raid0" support to allow dm-raid to access the MD RAID0 personality doing unconditional accesses to mddev->queue, which is NULL in case of dm-raid stacked on top of MD.

Most of the conditional mddev->queue accesses made it to upstream but this missing one, which prohibits md raid0 to set disk stack limits (being done in dm core in case of md underneath dm).

---
 drivers/md/raid0.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/md/raid0.c +3 -2
index 2cb59a6..6a68ef5 100644
@@ -188,8 +188,9 @@ static int create_strip_zones(struct mddev *mddev, struct r0conf **private_conf)
 		}
 		dev[j] = rdev1;
 
-		disk_stack_limits(mddev->gendisk, rdev1->bdev,
-				  rdev1->data_offset << 9);
+		if (mddev->queue)
+			disk_stack_limits(mddev->gendisk, rdev1->bdev,
+					  rdev1->data_offset << 9);
 
 		if (rdev1->bdev->bd_disk->queue->merge_bvec_fn)
 			conf->has_merge_bvec = 1;
Signature · 1 line
2.1.0
#1 lore raw
Quoted 29 lines · On Apr 29, 2015, at 7:03 AM, [email protected] wrote:

From: Heinz Mauelshagen <[email protected]>

This patch is a prerequisite for dm-raid "raid0" support to allow dm-raid to access the MD RAID0 personality doing unconditional accesses to mddev->queue, which is NULL in case of dm-raid stacked on top of MD.

Most of the conditional mddev->queue accesses made it to upstream but this missing one, which prohibits md raid0 to set disk stack limits (being done in dm core in case of md underneath dm).

---
drivers/md/raid0.c | 5 +++--

1 file changed, 3 insertions(+), 2 deletions(-)
drivers/md/raid0.c +0 -0
index 2cb59a6..6a68ef5 100644
@@ -188,8 +188,9 @@ static int create_strip_zones(struct mddev *mddev, struct r0conf **private_conf)
 		}

drivers/md/raid0.c static int create_strip_zones(struct mddev *mddev, struct r0conf **private_conf) · line 196

Quoted 10 lines
drivers/md/raid0.c +3 -2
 		dev[j] = rdev1;
 
-		disk_stack_limits(mddev->gendisk, rdev1->bdev,
-				  rdev1->data_offset << 9);
+		if (mddev->queue)
+			disk_stack_limits(mddev->gendisk, rdev1->bdev,
+					  rdev1->data_offset << 9);
 
 		if (rdev1->bdev->bd_disk->queue->merge_bvec_fn)
 			conf->has_merge_bvec = 1;

Aren’t you missing a condition?

Quoted 1 line

From the code:

        /*
         * now since we have the hard sector sizes, we can make sure
         * chunk size is a multiple of that sector size
         */
        if ((mddev->chunk_sectors << 9) % queue_logical_block_size(mddev->queue)) {
                printk(KERN_ERR "md/raid0:%s: chunk_size of %d not valid\n",
                       mdname(mddev),
                       mddev->chunk_sectors << 9);
                goto abort;
        }

        if (mddev->queue) {

Shouldn’t that ‘queue_logical_block_size be inside the lower ‘if’?

brassow

--
dm-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/dm-devel

#2 lore raw
Quoted 54 lines · Brassow Jonathan
Quoted 28 lines · On Apr 29, 2015, at 7:03 AM, [email protected] wrote:

From: Heinz Mauelshagen <[email protected]>

This patch is a prerequisite for dm-raid "raid0" support to allow dm-raid to access the MD RAID0 personality doing unconditional accesses to mddev->queue, which is NULL in case of dm-raid stacked on top of MD.

Most of the conditional mddev->queue accesses made it to upstream but this missing one, which prohibits md raid0 to set disk stack limits (being done in dm core in case of md underneath dm).

---
drivers/md/raid0.c | 5 +++--

1 file changed, 3 insertions(+), 2 deletions(-)
drivers/md/raid0.c +0 -0
index 2cb59a6..6a68ef5 100644
@@ -188,8 +188,9 @@ static int create_strip_zones(struct mddev *mddev, struct r0conf **private_conf)
 		}

drivers/md/raid0.c static int create_strip_zones(struct mddev *mddev, struct r0conf **private_conf) · line 196

Quoted 10 lines
drivers/md/raid0.c +3 -2
 		dev[j] = rdev1;
 
-		disk_stack_limits(mddev->gendisk, rdev1->bdev,
-				  rdev1->data_offset << 9);
+		if (mddev->queue)
+			disk_stack_limits(mddev->gendisk, rdev1->bdev,
+					  rdev1->data_offset << 9);
 
 		if (rdev1->bdev->bd_disk->queue->merge_bvec_fn)
 			conf->has_merge_bvec = 1;

Aren’t you missing a condition?

From the code:

         /*
          * now since we have the hard sector sizes, we can make sure
          * chunk size is a multiple of that sector size
          */
         if ((mddev->chunk_sectors << 9) % queue_logical_block_size(mddev->queue)) {
                 printk(KERN_ERR "md/raid0:%s: chunk_size of %d not valid\n",
                        mdname(mddev),
                        mddev->chunk_sectors << 9);
                 goto abort;
         }

         if (mddev->queue) {
Quoted 1 line

Shouldn’t that ‘queue_logical_block_size be inside the lower ‘if’?

queue_logical_block_size is safe when mddev->queue == NULL, so its no problem.

Heinz

Quoted 2 lines

brassow

Signature · 13 lines
===============================================================
Heinz Mauelshagen                               +49 2626 141200
Consulting Development Engineer             FAX +49 2626 924446
Red Hat GmbH
Am Sonnenhang 11
56242 Marienrachdorf
Germany                                       [email protected]
===============================================================

--
dm-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/dm-devel