diff options
Diffstat (limited to 'drivers/md/md.c')
-rw-r--r-- | drivers/md/md.c | 51 |
1 files changed, 41 insertions, 10 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c index 0dc563d76b39..c059ae6f37e5 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -2714,7 +2714,7 @@ action_show(mddev_t *mddev, char *page) { char *type = "idle"; if (test_bit(MD_RECOVERY_RUNNING, &mddev->recovery) || - test_bit(MD_RECOVERY_NEEDED, &mddev->recovery)) { + (!mddev->ro && test_bit(MD_RECOVERY_NEEDED, &mddev->recovery))) { if (test_bit(MD_RECOVERY_RESHAPE, &mddev->recovery)) type = "reshape"; else if (test_bit(MD_RECOVERY_SYNC, &mddev->recovery)) { @@ -2833,6 +2833,12 @@ sync_max_store(mddev_t *mddev, const char *buf, size_t len) static struct md_sysfs_entry md_sync_max = __ATTR(sync_speed_max, S_IRUGO|S_IWUSR, sync_max_show, sync_max_store); +static ssize_t +degraded_show(mddev_t *mddev, char *page) +{ + return sprintf(page, "%d\n", mddev->degraded); +} +static struct md_sysfs_entry md_degraded = __ATTR_RO(degraded); static ssize_t sync_speed_show(mddev_t *mddev, char *page) @@ -2976,6 +2982,7 @@ static struct attribute *md_redundancy_attrs[] = { &md_suspend_lo.attr, &md_suspend_hi.attr, &md_bitmap.attr, + &md_degraded.attr, NULL, }; static struct attribute_group md_redundancy_group = { @@ -5770,26 +5777,47 @@ static int __init md_init(void) * Searches all registered partitions for autorun RAID arrays * at boot time. */ -static dev_t detected_devices[128]; -static int dev_cnt; + +static LIST_HEAD(all_detected_devices); +struct detected_devices_node { + struct list_head list; + dev_t dev; +}; void md_autodetect_dev(dev_t dev) { - if (dev_cnt >= 0 && dev_cnt < 127) - detected_devices[dev_cnt++] = dev; + struct detected_devices_node *node_detected_dev; + + node_detected_dev = kzalloc(sizeof(*node_detected_dev), GFP_KERNEL); + if (node_detected_dev) { + node_detected_dev->dev = dev; + list_add_tail(&node_detected_dev->list, &all_detected_devices); + } else { + printk(KERN_CRIT "md: md_autodetect_dev: kzalloc failed" + ", skipping dev(%d,%d)\n", MAJOR(dev), MINOR(dev)); + } } static void autostart_arrays(int part) { mdk_rdev_t *rdev; - int i; + struct detected_devices_node *node_detected_dev; + dev_t dev; + int i_scanned, i_passed; - printk(KERN_INFO "md: Autodetecting RAID arrays.\n"); + i_scanned = 0; + i_passed = 0; - for (i = 0; i < dev_cnt; i++) { - dev_t dev = detected_devices[i]; + printk(KERN_INFO "md: Autodetecting RAID arrays.\n"); + while (!list_empty(&all_detected_devices) && i_scanned < INT_MAX) { + i_scanned++; + node_detected_dev = list_entry(all_detected_devices.next, + struct detected_devices_node, list); + list_del(&node_detected_dev->list); + dev = node_detected_dev->dev; + kfree(node_detected_dev); rdev = md_import_device(dev,0, 90); if (IS_ERR(rdev)) continue; @@ -5799,8 +5827,11 @@ static void autostart_arrays(int part) continue; } list_add(&rdev->same_set, &pending_raid_disks); + i_passed++; } - dev_cnt = 0; + + printk(KERN_INFO "md: Scanned %d and added %d devices.\n", + i_scanned, i_passed); autorun_devices(part); } |