Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 4 Feb 2011 16:04:43 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r218282 - projects/graid/head/sys/geom/raid
Message-ID:  <201102041604.p14G4heB089843@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Fri Feb  4 16:04:43 2011
New Revision: 218282
URL: http://svn.freebsd.org/changeset/base/218282

Log:
  Until we have no real RESYNC implemented, handle it same as REBUILD.

Modified:
  projects/graid/head/sys/geom/raid/tr_raid1.c

Modified: projects/graid/head/sys/geom/raid/tr_raid1.c
==============================================================================
--- projects/graid/head/sys/geom/raid/tr_raid1.c	Fri Feb  4 15:47:14 2011	(r218281)
+++ projects/graid/head/sys/geom/raid/tr_raid1.c	Fri Feb  4 16:04:43 2011	(r218282)
@@ -372,7 +372,8 @@ g_raid_tr_raid1_maybe_rebuild(struct g_r
 	if (trs->trso_stopping)
 		return;
 	na = g_raid_nsubdisks(vol, G_RAID_SUBDISK_S_ACTIVE);
-	nr = g_raid_nsubdisks(vol, G_RAID_SUBDISK_S_REBUILD);
+	nr = g_raid_nsubdisks(vol, G_RAID_SUBDISK_S_REBUILD) +
+	    g_raid_nsubdisks(vol, G_RAID_SUBDISK_S_RESYNC);
 	switch(trs->trso_type) {
 	case TR_RAID1_NONE:
 		if (na == 0 || nr == 0)
@@ -402,11 +403,17 @@ g_raid_tr_event_raid1(struct g_raid_tr_o
 	vol = tr->tro_volume;
 	switch (event) {
 	case G_RAID_SUBDISK_E_NEW:
-		if (sd->sd_state == G_RAID_SUBDISK_S_NEW)
+		if (sd->sd_state == G_RAID_SUBDISK_S_NEW) {
+			sd->sd_rebuild_pos = 0;
 			g_raid_change_subdisk_state(sd, G_RAID_SUBDISK_S_REBUILD);
+		} else if (sd->sd_state == G_RAID_SUBDISK_S_STALE) {
+			sd->sd_rebuild_pos = 0;
+			g_raid_change_subdisk_state(sd, G_RAID_SUBDISK_S_RESYNC);
+		}
 		break;
 	case G_RAID_SUBDISK_E_FAILED:
-		if (trs->trso_type == TR_RAID1_REBUILD)
+		if (trs->trso_type == TR_RAID1_REBUILD ||
+		    trs->trso_type == TR_RAID1_RESYNC)
 			g_raid_tr_raid1_rebuild_abort(tr, vol);
 //		g_raid_change_subdisk_state(sd, G_RAID_SUBDISK_S_FAILED);
 		break;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201102041604.p14G4heB089843>