Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 13507
b: refs/heads/master
c: 7eec314
h: refs/heads/master
i:
  13505: 8b766c8
  13503: 3352403
v: v3
  • Loading branch information
NeilBrown authored and Linus Torvalds committed Nov 9, 2005
1 parent d7c0aba commit 61bad8c
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 20 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 787453c2397edcc3261efebb661739acd8c38547
refs/heads/master: 7eec314d7512d5281742263cff3853b43df431db
47 changes: 28 additions & 19 deletions trunk/drivers/md/md.c
Original file line number Diff line number Diff line change
Expand Up @@ -1746,9 +1746,9 @@ raid_disks_show(mddev_t *mddev, char *page)
static struct md_sysfs_entry md_raid_disks = __ATTR_RO(raid_disks);

static ssize_t
md_show_scan(mddev_t *mddev, char *page)
action_show(mddev_t *mddev, char *page)
{
char *type = "none";
char *type = "idle";
if (test_bit(MD_RECOVERY_RUNNING, &mddev->recovery) ||
test_bit(MD_RECOVERY_NEEDED, &mddev->recovery)) {
if (test_bit(MD_RECOVERY_SYNC, &mddev->recovery)) {
Expand All @@ -1765,27 +1765,36 @@ md_show_scan(mddev_t *mddev, char *page)
}

static ssize_t
md_store_scan(mddev_t *mddev, const char *page, size_t len)
action_store(mddev_t *mddev, const char *page, size_t len)
{
int canscan=0;
if (!mddev->pers || !mddev->pers->sync_request)
return -EINVAL;

if (strcmp(page, "idle")==0 || strcmp(page, "idle\n")==0) {
if (mddev->sync_thread) {
set_bit(MD_RECOVERY_INTR, &mddev->recovery);
md_unregister_thread(mddev->sync_thread);
mddev->sync_thread = NULL;
mddev->recovery = 0;
}
return len;
}

if (test_bit(MD_RECOVERY_RUNNING, &mddev->recovery) ||
test_bit(MD_RECOVERY_NEEDED, &mddev->recovery))
return -EBUSY;

if (mddev->pers && mddev->pers->sync_request)
canscan=1;

if (!canscan)
return -EINVAL;

if (strcmp(page, "check")==0 || strcmp(page, "check\n")==0)
set_bit(MD_RECOVERY_CHECK, &mddev->recovery);
else if (strcmp(page, "repair")!=0 && strcmp(page, "repair\n")!=0)
return -EINVAL;
set_bit(MD_RECOVERY_REQUESTED, &mddev->recovery);
set_bit(MD_RECOVERY_SYNC, &mddev->recovery);
set_bit(MD_RECOVERY_NEEDED, &mddev->recovery);
if (strcmp(page, "resync")==0 || strcmp(page, "resync\n")==0 ||
strcmp(page, "recover")==0 || strcmp(page, "recover\n")==0)
set_bit(MD_RECOVERY_NEEDED, &mddev->recovery);
else {
if (strcmp(page, "check")==0 || strcmp(page, "check\n")==0)
set_bit(MD_RECOVERY_CHECK, &mddev->recovery);
else if (strcmp(page, "repair")!=0 && strcmp(page, "repair\n")!=0)
return -EINVAL;
set_bit(MD_RECOVERY_REQUESTED, &mddev->recovery);
set_bit(MD_RECOVERY_SYNC, &mddev->recovery);
set_bit(MD_RECOVERY_NEEDED, &mddev->recovery);
}
md_wakeup_thread(mddev->thread);
return len;
}
Expand All @@ -1798,7 +1807,7 @@ mismatch_cnt_show(mddev_t *mddev, char *page)
}

static struct md_sysfs_entry
md_scan_mode = __ATTR(scan_mode, S_IRUGO|S_IWUSR, md_show_scan, md_store_scan);
md_scan_mode = __ATTR(sync_action, S_IRUGO|S_IWUSR, action_show, action_store);


static struct md_sysfs_entry
Expand Down

0 comments on commit 61bad8c

Please sign in to comment.