aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/dm-table.c20
-rw-r--r--drivers/md/md.c42
2 files changed, 16 insertions, 46 deletions
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
index be625475cf6d..4b22feb01a0c 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -503,16 +503,15 @@ int dm_set_device_limits(struct dm_target *ti, struct dm_dev *dev,
503 return 0; 503 return 0;
504 } 504 }
505 505
506 if (blk_stack_limits(limits, &q->limits, start << 9) < 0) 506 if (bdev_stack_limits(limits, bdev, start) < 0)
507 DMWARN("%s: target device %s is misaligned: " 507 DMWARN("%s: adding target device %s caused an alignment inconsistency: "
508 "physical_block_size=%u, logical_block_size=%u, " 508 "physical_block_size=%u, logical_block_size=%u, "
509 "alignment_offset=%u, start=%llu", 509 "alignment_offset=%u, start=%llu",
510 dm_device_name(ti->table->md), bdevname(bdev, b), 510 dm_device_name(ti->table->md), bdevname(bdev, b),
511 q->limits.physical_block_size, 511 q->limits.physical_block_size,
512 q->limits.logical_block_size, 512 q->limits.logical_block_size,
513 q->limits.alignment_offset, 513 q->limits.alignment_offset,
514 (unsigned long long) start << 9); 514 (unsigned long long) start << SECTOR_SHIFT);
515
516 515
517 /* 516 /*
518 * Check if merge fn is supported. 517 * Check if merge fn is supported.
@@ -1026,9 +1025,9 @@ combine_limits:
1026 * for the table. 1025 * for the table.
1027 */ 1026 */
1028 if (blk_stack_limits(limits, &ti_limits, 0) < 0) 1027 if (blk_stack_limits(limits, &ti_limits, 0) < 0)
1029 DMWARN("%s: target device " 1028 DMWARN("%s: adding target device "
1030 "(start sect %llu len %llu) " 1029 "(start sect %llu len %llu) "
1031 "is misaligned", 1030 "caused an alignment inconsistency",
1032 dm_device_name(table->md), 1031 dm_device_name(table->md),
1033 (unsigned long long) ti->begin, 1032 (unsigned long long) ti->begin,
1034 (unsigned long long) ti->len); 1033 (unsigned long long) ti->len);
@@ -1080,15 +1079,6 @@ void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q,
1080 struct queue_limits *limits) 1079 struct queue_limits *limits)
1081{ 1080{
1082 /* 1081 /*
1083 * Each target device in the table has a data area that should normally
1084 * be aligned such that the DM device's alignment_offset is 0.
1085 * FIXME: Propagate alignment_offsets up the stack and warn of
1086 * sub-optimal or inconsistent settings.
1087 */
1088 limits->alignment_offset = 0;
1089 limits->misaligned = 0;
1090
1091 /*
1092 * Copy table's limits to the DM device's request_queue 1082 * Copy table's limits to the DM device's request_queue
1093 */ 1083 */
1094 q->limits = *limits; 1084 q->limits = *limits;
diff --git a/drivers/md/md.c b/drivers/md/md.c
index f4f5f82f9f53..dd3dfe42d5a9 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -386,7 +386,9 @@ static void mddev_put(mddev_t *mddev)
386 if (!atomic_dec_and_lock(&mddev->active, &all_mddevs_lock)) 386 if (!atomic_dec_and_lock(&mddev->active, &all_mddevs_lock))
387 return; 387 return;
388 if (!mddev->raid_disks && list_empty(&mddev->disks) && 388 if (!mddev->raid_disks && list_empty(&mddev->disks) &&
389 !mddev->hold_active) { 389 mddev->ctime == 0 && !mddev->hold_active) {
390 /* Array is not configured at all, and not held active,
391 * so destroy it */
390 list_del(&mddev->all_mddevs); 392 list_del(&mddev->all_mddevs);
391 if (mddev->gendisk) { 393 if (mddev->gendisk) {
392 /* we did a probe so need to clean up. 394 /* we did a probe so need to clean up.
@@ -4355,7 +4357,7 @@ static int do_md_run(mddev_t * mddev)
4355 mddev->barriers_work = 1; 4357 mddev->barriers_work = 1;
4356 mddev->ok_start_degraded = start_dirty_degraded; 4358 mddev->ok_start_degraded = start_dirty_degraded;
4357 4359
4358 if (start_readonly) 4360 if (start_readonly && mddev->ro == 0)
4359 mddev->ro = 2; /* read-only, but switch on first write */ 4361 mddev->ro = 2; /* read-only, but switch on first write */
4360 4362
4361 err = mddev->pers->run(mddev); 4363 err = mddev->pers->run(mddev);
@@ -4419,33 +4421,6 @@ static int do_md_run(mddev_t * mddev)
4419 4421
4420 set_capacity(disk, mddev->array_sectors); 4422 set_capacity(disk, mddev->array_sectors);
4421 4423
4422 /* If there is a partially-recovered drive we need to
4423 * start recovery here. If we leave it to md_check_recovery,
4424 * it will remove the drives and not do the right thing
4425 */
4426 if (mddev->degraded && !mddev->sync_thread) {
4427 int spares = 0;
4428 list_for_each_entry(rdev, &mddev->disks, same_set)
4429 if (rdev->raid_disk >= 0 &&
4430 !test_bit(In_sync, &rdev->flags) &&
4431 !test_bit(Faulty, &rdev->flags))
4432 /* complete an interrupted recovery */
4433 spares++;
4434 if (spares && mddev->pers->sync_request) {
4435 mddev->recovery = 0;
4436 set_bit(MD_RECOVERY_RUNNING, &mddev->recovery);
4437 mddev->sync_thread = md_register_thread(md_do_sync,
4438 mddev,
4439 "resync");
4440 if (!mddev->sync_thread) {
4441 printk(KERN_ERR "%s: could not start resync"
4442 " thread...\n",
4443 mdname(mddev));
4444 /* leave the spares where they are, it shouldn't hurt */
4445 mddev->recovery = 0;
4446 }
4447 }
4448 }
4449 md_wakeup_thread(mddev->thread); 4424 md_wakeup_thread(mddev->thread);
4450 md_wakeup_thread(mddev->sync_thread); /* possibly kick off a reshape */ 4425 md_wakeup_thread(mddev->sync_thread); /* possibly kick off a reshape */
4451 4426
@@ -5262,6 +5237,10 @@ static int set_array_info(mddev_t * mddev, mdu_array_info_t *info)
5262 mddev->minor_version = info->minor_version; 5237 mddev->minor_version = info->minor_version;
5263 mddev->patch_version = info->patch_version; 5238 mddev->patch_version = info->patch_version;
5264 mddev->persistent = !info->not_persistent; 5239 mddev->persistent = !info->not_persistent;
5240 /* ensure mddev_put doesn't delete this now that there
5241 * is some minimal configuration.
5242 */
5243 mddev->ctime = get_seconds();
5265 return 0; 5244 return 0;
5266 } 5245 }
5267 mddev->major_version = MD_MAJOR_VERSION; 5246 mddev->major_version = MD_MAJOR_VERSION;
@@ -6494,10 +6473,11 @@ void md_do_sync(mddev_t *mddev)
6494 mddev->curr_resync = 2; 6473 mddev->curr_resync = 2;
6495 6474
6496 try_again: 6475 try_again:
6497 if (kthread_should_stop()) { 6476 if (kthread_should_stop())
6498 set_bit(MD_RECOVERY_INTR, &mddev->recovery); 6477 set_bit(MD_RECOVERY_INTR, &mddev->recovery);
6478
6479 if (test_bit(MD_RECOVERY_INTR, &mddev->recovery))
6499 goto skip; 6480 goto skip;
6500 }
6501 for_each_mddev(mddev2, tmp) { 6481 for_each_mddev(mddev2, tmp) {
6502 if (mddev2 == mddev) 6482 if (mddev2 == mddev)
6503 continue; 6483 continue;