Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 13488
b: refs/heads/master
c: 9d88883
h: refs/heads/master
v: v3
  • Loading branch information
NeilBrown authored and Linus Torvalds committed Nov 9, 2005
1 parent f92f315 commit 7acbe70
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 3 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: 24dd469d728dae07f40c5d79ea6dedd38cdf1a30
refs/heads/master: 9d88883e68f404d5581bd391713ceef470ea53a9
18 changes: 16 additions & 2 deletions trunk/drivers/md/md.c
Original file line number Diff line number Diff line change
Expand Up @@ -1758,16 +1758,29 @@ md_store_scan(mddev_t *mddev, const char *page, size_t len)
return len;
}

static ssize_t
md_show_mismatch(mddev_t *mddev, char *page)
{
return sprintf(page, "%llu\n",
(unsigned long long) mddev->resync_mismatches);
}

static struct md_sysfs_entry md_scan_mode = {
.attr = {.name = "scan_mode", .mode = S_IRUGO|S_IWUSR },
.show = md_show_scan,
.store = md_store_scan,
};

static struct md_sysfs_entry md_mismatches = {
.attr = {.name = "mismatch_cnt", .mode = S_IRUGO },
.show = md_show_mismatch,
};

static struct attribute *md_default_attrs[] = {
&md_level.attr,
&md_raid_disks.attr,
&md_scan_mode.attr,
&md_mismatches.attr,
NULL,
};

Expand Down Expand Up @@ -3888,12 +3901,13 @@ static void md_do_sync(mddev_t *mddev)
}
} while (mddev->curr_resync < 2);

if (test_bit(MD_RECOVERY_SYNC, &mddev->recovery))
if (test_bit(MD_RECOVERY_SYNC, &mddev->recovery)) {
/* resync follows the size requested by the personality,
* which defaults to physical size, but can be virtual size
*/
max_sectors = mddev->resync_max_sectors;
else
mddev->resync_mismatches = 0;
} else
/* recovery follows the physical size of devices */
max_sectors = mddev->size << 1;

Expand Down
5 changes: 5 additions & 0 deletions trunk/drivers/md/raid5.c
Original file line number Diff line number Diff line change
Expand Up @@ -1292,6 +1292,11 @@ static void handle_stripe(struct stripe_head *sh)
!memcmp(pagea, pagea+4, STRIPE_SIZE-4)) {
/* parity is correct (on disc, not in buffer any more) */
set_bit(STRIPE_INSYNC, &sh->state);
} else {
conf->mddev->resync_mismatches += STRIPE_SECTORS;
if (test_bit(MD_RECOVERY_CHECK, &conf->mddev->recovery))
/* don't try to repair!! */
set_bit(STRIPE_INSYNC, &sh->state);
}
}
if (!test_bit(STRIPE_INSYNC, &sh->state)) {
Expand Down
4 changes: 4 additions & 0 deletions trunk/include/linux/raid/md_k.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,10 @@ struct mddev_s
sector_t resync_mark_cnt;/* blocks written at resync_mark */

sector_t resync_max_sectors; /* may be set by personality */

sector_t resync_mismatches; /* count of sectors where
* parity/replica mismatch found
*/
/* recovery/resync flags
* NEEDED: we might need to start a resync/recover
* RUNNING: a thread is running, or about to be started
Expand Down

0 comments on commit 7acbe70

Please sign in to comment.