Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 97256
b: refs/heads/master
c: 90b0871
h: refs/heads/master
v: v3
  • Loading branch information
Bernd Schubert authored and Linus Torvalds committed May 24, 2008
1 parent 3115b9c commit 360f46e
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 5 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: 4f54b0e9485644a3c5fca2ae43bcbe7376825747
refs/heads/master: 90b08710e41a07d4ff0fb8940dcce3a552991a56
40 changes: 36 additions & 4 deletions trunk/drivers/md/md.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ static DEFINE_SPINLOCK(pers_lock);

static void md_print_devices(void);

static DECLARE_WAIT_QUEUE_HEAD(resync_wait);

#define MD_BUG(x...) { printk("md: bug in file %s, line %d\n", __FILE__, __LINE__); md_print_devices(); }

/*
Expand Down Expand Up @@ -3012,6 +3014,36 @@ degraded_show(mddev_t *mddev, char *page)
}
static struct md_sysfs_entry md_degraded = __ATTR_RO(degraded);

static ssize_t
sync_force_parallel_show(mddev_t *mddev, char *page)
{
return sprintf(page, "%d\n", mddev->parallel_resync);
}

static ssize_t
sync_force_parallel_store(mddev_t *mddev, const char *buf, size_t len)
{
long n;

if (strict_strtol(buf, 10, &n))
return -EINVAL;

if (n != 0 && n != 1)
return -EINVAL;

mddev->parallel_resync = n;

if (mddev->sync_thread)
wake_up(&resync_wait);

return len;
}

/* force parallel resync, even with shared block devices */
static struct md_sysfs_entry md_sync_force_parallel =
__ATTR(sync_force_parallel, S_IRUGO|S_IWUSR,
sync_force_parallel_show, sync_force_parallel_store);

static ssize_t
sync_speed_show(mddev_t *mddev, char *page)
{
Expand Down Expand Up @@ -3187,6 +3219,7 @@ static struct attribute *md_redundancy_attrs[] = {
&md_sync_min.attr,
&md_sync_max.attr,
&md_sync_speed.attr,
&md_sync_force_parallel.attr,
&md_sync_completed.attr,
&md_max_sync.attr,
&md_suspend_lo.attr,
Expand Down Expand Up @@ -5487,8 +5520,6 @@ void md_allow_write(mddev_t *mddev)
}
EXPORT_SYMBOL_GPL(md_allow_write);

static DECLARE_WAIT_QUEUE_HEAD(resync_wait);

#define SYNC_MARKS 10
#define SYNC_MARK_STEP (3*HZ)
void md_do_sync(mddev_t *mddev)
Expand Down Expand Up @@ -5552,8 +5583,9 @@ void md_do_sync(mddev_t *mddev)
for_each_mddev(mddev2, tmp) {
if (mddev2 == mddev)
continue;
if (mddev2->curr_resync &&
match_mddev_units(mddev,mddev2)) {
if (!mddev->parallel_resync
&& mddev2->curr_resync
&& match_mddev_units(mddev, mddev2)) {
DEFINE_WAIT(wq);
if (mddev < mddev2 && mddev->curr_resync == 2) {
/* arbitrarily yield */
Expand Down
3 changes: 3 additions & 0 deletions trunk/include/linux/raid/md_k.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,9 @@ struct mddev_s
int sync_speed_min;
int sync_speed_max;

/* resync even though the same disks are shared among md-devices */
int parallel_resync;

int ok_start_degraded;
/* recovery/resync flags
* NEEDED: we might need to start a resync/recover
Expand Down

0 comments on commit 360f46e

Please sign in to comment.