aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/md.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2005-11-09 00:39:44 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2005-11-09 10:56:40 -0500
commit7eec314d7512d5281742263cff3853b43df431db (patch)
tree3d74f5950b6d9fede5ddc617f0a7ab03eeee0dd3 /drivers/md/md.c
parent787453c2397edcc3261efebb661739acd8c38547 (diff)
[PATCH] md: improve 'scan_mode' and rename it to 'sync_action'
The current sync_action for an array can be one of idle - nothing happening resync - reduncancy being recalcualted recover - missing device being recoverred to spare check - user initiated check of redundancy repair - like resync but user-initiated and ignores bitmap optimisation. Each of these strings can also be written to the 'sync_action' file to cause that action to happen (if appropriate). While 'sync' is not technically correct, as a recovery is *not* a 'sync', I think it is the most servicable word here. Also 'action' is a strong word than 'mode'. Signed-off-by: Neil Brown <neilb@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/md/md.c')
-rw-r--r--drivers/md/md.c47
1 files changed, 28 insertions, 19 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 097ae1b5484b..023aecd0295e 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -1746,9 +1746,9 @@ raid_disks_show(mddev_t *mddev, char *page)
1746static struct md_sysfs_entry md_raid_disks = __ATTR_RO(raid_disks); 1746static struct md_sysfs_entry md_raid_disks = __ATTR_RO(raid_disks);
1747 1747
1748static ssize_t 1748static ssize_t
1749md_show_scan(mddev_t *mddev, char *page) 1749action_show(mddev_t *mddev, char *page)
1750{ 1750{
1751 char *type = "none"; 1751 char *type = "idle";
1752 if (test_bit(MD_RECOVERY_RUNNING, &mddev->recovery) || 1752 if (test_bit(MD_RECOVERY_RUNNING, &mddev->recovery) ||
1753 test_bit(MD_RECOVERY_NEEDED, &mddev->recovery)) { 1753 test_bit(MD_RECOVERY_NEEDED, &mddev->recovery)) {
1754 if (test_bit(MD_RECOVERY_SYNC, &mddev->recovery)) { 1754 if (test_bit(MD_RECOVERY_SYNC, &mddev->recovery)) {
@@ -1765,27 +1765,36 @@ md_show_scan(mddev_t *mddev, char *page)
1765} 1765}
1766 1766
1767static ssize_t 1767static ssize_t
1768md_store_scan(mddev_t *mddev, const char *page, size_t len) 1768action_store(mddev_t *mddev, const char *page, size_t len)
1769{ 1769{
1770 int canscan=0; 1770 if (!mddev->pers || !mddev->pers->sync_request)
1771 return -EINVAL;
1772
1773 if (strcmp(page, "idle")==0 || strcmp(page, "idle\n")==0) {
1774 if (mddev->sync_thread) {
1775 set_bit(MD_RECOVERY_INTR, &mddev->recovery);
1776 md_unregister_thread(mddev->sync_thread);
1777 mddev->sync_thread = NULL;
1778 mddev->recovery = 0;
1779 }
1780 return len;
1781 }
1771 1782
1772 if (test_bit(MD_RECOVERY_RUNNING, &mddev->recovery) || 1783 if (test_bit(MD_RECOVERY_RUNNING, &mddev->recovery) ||
1773 test_bit(MD_RECOVERY_NEEDED, &mddev->recovery)) 1784 test_bit(MD_RECOVERY_NEEDED, &mddev->recovery))
1774 return -EBUSY; 1785 return -EBUSY;
1775 1786 if (strcmp(page, "resync")==0 || strcmp(page, "resync\n")==0 ||
1776 if (mddev->pers && mddev->pers->sync_request) 1787 strcmp(page, "recover")==0 || strcmp(page, "recover\n")==0)
1777 canscan=1; 1788 set_bit(MD_RECOVERY_NEEDED, &mddev->recovery);
1778 1789 else {
1779 if (!canscan) 1790 if (strcmp(page, "check")==0 || strcmp(page, "check\n")==0)
1780 return -EINVAL; 1791 set_bit(MD_RECOVERY_CHECK, &mddev->recovery);
1781 1792 else if (strcmp(page, "repair")!=0 && strcmp(page, "repair\n")!=0)
1782 if (strcmp(page, "check")==0 || strcmp(page, "check\n")==0) 1793 return -EINVAL;
1783 set_bit(MD_RECOVERY_CHECK, &mddev->recovery); 1794 set_bit(MD_RECOVERY_REQUESTED, &mddev->recovery);
1784 else if (strcmp(page, "repair")!=0 && strcmp(page, "repair\n")!=0) 1795 set_bit(MD_RECOVERY_SYNC, &mddev->recovery);
1785 return -EINVAL; 1796 set_bit(MD_RECOVERY_NEEDED, &mddev->recovery);
1786 set_bit(MD_RECOVERY_REQUESTED, &mddev->recovery); 1797 }
1787 set_bit(MD_RECOVERY_SYNC, &mddev->recovery);
1788 set_bit(MD_RECOVERY_NEEDED, &mddev->recovery);
1789 md_wakeup_thread(mddev->thread); 1798 md_wakeup_thread(mddev->thread);
1790 return len; 1799 return len;
1791} 1800}
@@ -1798,7 +1807,7 @@ mismatch_cnt_show(mddev_t *mddev, char *page)
1798} 1807}
1799 1808
1800static struct md_sysfs_entry 1809static struct md_sysfs_entry
1801md_scan_mode = __ATTR(scan_mode, S_IRUGO|S_IWUSR, md_show_scan, md_store_scan); 1810md_scan_mode = __ATTR(sync_action, S_IRUGO|S_IWUSR, action_show, action_store);
1802 1811
1803 1812
1804static struct md_sysfs_entry 1813static struct md_sysfs_entry