Commit 753f2856 authored by Heinz Mauelshagen's avatar Heinz Mauelshagen Committed by NeilBrown

md raid0: access mddev->queue (request queue member) conditionally because it...

md raid0: access mddev->queue (request queue member) conditionally because it is not set when accessed from dm-raid

The patch makes 3 references to mddev->queue in the raid0 personality
conditional in order to allow for it to be accessed from dm-raid.
Mandatory, because md instances underneath dm-raid don't manage
a request queue of their own which'd lead to oopses without the patch.
Signed-off-by: default avatarHeinz Mauelshagen <heinzm@redhat.com>
Tested-by: default avatarHeinz Mauelshagen <heinzm@redhat.com>
Signed-off-by: default avatarNeilBrown <neilb@suse.de>
parent ac8fa419
...@@ -271,6 +271,7 @@ static int create_strip_zones(struct mddev *mddev, struct r0conf **private_conf) ...@@ -271,6 +271,7 @@ static int create_strip_zones(struct mddev *mddev, struct r0conf **private_conf)
goto abort; goto abort;
} }
if (mddev->queue) {
blk_queue_io_min(mddev->queue, mddev->chunk_sectors << 9); blk_queue_io_min(mddev->queue, mddev->chunk_sectors << 9);
blk_queue_io_opt(mddev->queue, blk_queue_io_opt(mddev->queue,
(mddev->chunk_sectors << 9) * mddev->raid_disks); (mddev->chunk_sectors << 9) * mddev->raid_disks);
...@@ -279,6 +280,7 @@ static int create_strip_zones(struct mddev *mddev, struct r0conf **private_conf) ...@@ -279,6 +280,7 @@ static int create_strip_zones(struct mddev *mddev, struct r0conf **private_conf)
queue_flag_clear_unlocked(QUEUE_FLAG_DISCARD, mddev->queue); queue_flag_clear_unlocked(QUEUE_FLAG_DISCARD, mddev->queue);
else else
queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, mddev->queue); queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, mddev->queue);
}
pr_debug("md/raid0:%s: done.\n", mdname(mddev)); pr_debug("md/raid0:%s: done.\n", mdname(mddev));
*private_conf = conf; *private_conf = conf;
...@@ -429,9 +431,12 @@ static int raid0_run(struct mddev *mddev) ...@@ -429,9 +431,12 @@ static int raid0_run(struct mddev *mddev)
} }
if (md_check_no_bitmap(mddev)) if (md_check_no_bitmap(mddev))
return -EINVAL; return -EINVAL;
if (mddev->queue) {
blk_queue_max_hw_sectors(mddev->queue, mddev->chunk_sectors); blk_queue_max_hw_sectors(mddev->queue, mddev->chunk_sectors);
blk_queue_max_write_same_sectors(mddev->queue, mddev->chunk_sectors); blk_queue_max_write_same_sectors(mddev->queue, mddev->chunk_sectors);
blk_queue_max_discard_sectors(mddev->queue, mddev->chunk_sectors); blk_queue_max_discard_sectors(mddev->queue, mddev->chunk_sectors);
}
/* if private is not null, we are here after takeover */ /* if private is not null, we are here after takeover */
if (mddev->private == NULL) { if (mddev->private == NULL) {
...@@ -448,6 +453,8 @@ static int raid0_run(struct mddev *mddev) ...@@ -448,6 +453,8 @@ static int raid0_run(struct mddev *mddev)
printk(KERN_INFO "md/raid0:%s: md_size is %llu sectors.\n", printk(KERN_INFO "md/raid0:%s: md_size is %llu sectors.\n",
mdname(mddev), mdname(mddev),
(unsigned long long)mddev->array_sectors); (unsigned long long)mddev->array_sectors);
if (mddev->queue) {
/* calculate the max read-ahead size. /* calculate the max read-ahead size.
* For read-ahead of large files to be effective, we need to * For read-ahead of large files to be effective, we need to
* readahead at least twice a whole stripe. i.e. number of devices * readahead at least twice a whole stripe. i.e. number of devices
...@@ -457,7 +464,6 @@ static int raid0_run(struct mddev *mddev) ...@@ -457,7 +464,6 @@ static int raid0_run(struct mddev *mddev)
* wants. We consider this a configuration error: a larger * wants. We consider this a configuration error: a larger
* chunksize should be used in that case. * chunksize should be used in that case.
*/ */
{
int stripe = mddev->raid_disks * int stripe = mddev->raid_disks *
(mddev->chunk_sectors << 9) / PAGE_SIZE; (mddev->chunk_sectors << 9) / PAGE_SIZE;
if (mddev->queue->backing_dev_info.ra_pages < 2* stripe) if (mddev->queue->backing_dev_info.ra_pages < 2* stripe)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment