aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2010-06-01 05:37:28 -0400
committerNeilBrown <neilb@suse.de>2010-07-25 22:52:27 -0400
commit4a5add49951e698073011855d1a8a7306bc9308d (patch)
tree91c098468b96b959f88e1e2a386c6e8911db7c09
parent768a418db102bb6aa6064e6090892b5c21ff1f9e (diff)
raid5: Don't set read-ahead when there is no queue
dm-raid456 does not provide a 'queue' for raid5 to use, so we must make raid5 stop depending on the queue. First: read_ahead dm handles read-ahead adjustment fully in userspace, so simply don't do any readahead adjustments if there is no queue. Also re-arrange code slightly so all the accesses to ->queue are together. Finally, move the blk_queue_merge_bvec function into the 'if' as the ->split_io setting in dm-raid456 has the same effect. Signed-off-by: NeilBrown <neilb@suse.de>
-rw-r--r--drivers/md/raid5.c32
1 files changed, 17 insertions, 15 deletions
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 6fa60e416a09..9c462f6659c3 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -5161,16 +5161,6 @@ static int run(mddev_t *mddev)
5161 "reshape"); 5161 "reshape");
5162 } 5162 }
5163 5163
5164 /* read-ahead size must cover two whole stripes, which is
5165 * 2 * (datadisks) * chunksize where 'n' is the number of raid devices
5166 */
5167 {
5168 int data_disks = conf->previous_raid_disks - conf->max_degraded;
5169 int stripe = data_disks *
5170 ((mddev->chunk_sectors << 9) / PAGE_SIZE);
5171 if (mddev->queue->backing_dev_info.ra_pages < 2 * stripe)
5172 mddev->queue->backing_dev_info.ra_pages = 2 * stripe;
5173 }
5174 5164
5175 /* Ok, everything is just fine now */ 5165 /* Ok, everything is just fine now */
5176 if (mddev->to_remove == &raid5_attrs_group) 5166 if (mddev->to_remove == &raid5_attrs_group)
@@ -5178,8 +5168,23 @@ static int run(mddev_t *mddev)
5178 else if (mddev->kobj.sd && 5168 else if (mddev->kobj.sd &&
5179 sysfs_create_group(&mddev->kobj, &raid5_attrs_group)) 5169 sysfs_create_group(&mddev->kobj, &raid5_attrs_group))
5180 printk(KERN_WARNING 5170 printk(KERN_WARNING
5181 "md/raid:%s: failed to create sysfs attributes.\n", 5171 "raid5: failed to create sysfs attributes for %s\n",
5182 mdname(mddev)); 5172 mdname(mddev));
5173 md_set_array_sectors(mddev, raid5_size(mddev, 0, 0));
5174
5175 if (mddev->queue) {
5176 /* read-ahead size must cover two whole stripes, which
5177 * is 2 * (datadisks) * chunksize where 'n' is the
5178 * number of raid devices
5179 */
5180 int data_disks = conf->previous_raid_disks - conf->max_degraded;
5181 int stripe = data_disks *
5182 ((mddev->chunk_sectors << 9) / PAGE_SIZE);
5183 if (mddev->queue->backing_dev_info.ra_pages < 2 * stripe)
5184 mddev->queue->backing_dev_info.ra_pages = 2 * stripe;
5185
5186 blk_queue_merge_bvec(mddev->queue, raid5_mergeable_bvec);
5187 }
5183 5188
5184 mddev->queue->queue_lock = &conf->device_lock; 5189 mddev->queue->queue_lock = &conf->device_lock;
5185 5190
@@ -5187,9 +5192,6 @@ static int run(mddev_t *mddev)
5187 mddev->queue->backing_dev_info.congested_data = mddev; 5192 mddev->queue->backing_dev_info.congested_data = mddev;
5188 mddev->queue->backing_dev_info.congested_fn = raid5_congested; 5193 mddev->queue->backing_dev_info.congested_fn = raid5_congested;
5189 5194
5190 md_set_array_sectors(mddev, raid5_size(mddev, 0, 0));
5191
5192 blk_queue_merge_bvec(mddev->queue, raid5_mergeable_bvec);
5193 chunk_size = mddev->chunk_sectors << 9; 5195 chunk_size = mddev->chunk_sectors << 9;
5194 blk_queue_io_min(mddev->queue, chunk_size); 5196 blk_queue_io_min(mddev->queue, chunk_size);
5195 blk_queue_io_opt(mddev->queue, chunk_size * 5197 blk_queue_io_opt(mddev->queue, chunk_size *
@@ -5618,7 +5620,7 @@ static void end_reshape(raid5_conf_t *conf)
5618 /* read-ahead size must cover two whole stripes, which is 5620 /* read-ahead size must cover two whole stripes, which is
5619 * 2 * (datadisks) * chunksize where 'n' is the number of raid devices 5621 * 2 * (datadisks) * chunksize where 'n' is the number of raid devices
5620 */ 5622 */
5621 { 5623 if (conf->mddev->queue) {
5622 int data_disks = conf->raid_disks - conf->max_degraded; 5624 int data_disks = conf->raid_disks - conf->max_degraded;
5623 int stripe = data_disks * ((conf->chunk_sectors << 9) 5625 int stripe = data_disks * ((conf->chunk_sectors << 9)
5624 / PAGE_SIZE); 5626 / PAGE_SIZE);