PERFORCE change 62271 for review

Julian Elischer julian at FreeBSD.org
Sun Sep 26 20:27:45 PDT 2004


http://perforce.freebsd.org/chv.cgi?CH=62271

Change 62271 by julian at julian_ref on 2004/09/27 03:26:53

	IFC

Affected files ...

.. //depot/projects/nsched/sys/geom/mirror/g_mirror.c#8 integrate
.. //depot/projects/nsched/sys/geom/mirror/g_mirror.h#2 integrate
.. //depot/projects/nsched/sys/ia64/ia32/ia32_trap.c#2 integrate

Differences ...

==== //depot/projects/nsched/sys/geom/mirror/g_mirror.c#8 (text+ko) ====

@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/geom/mirror/g_mirror.c,v 1.29 2004/09/26 20:30:15 pjd Exp $");
+__FBSDID("$FreeBSD: src/sys/geom/mirror/g_mirror.c,v 1.30 2004/09/26 20:41:07 pjd Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -392,6 +392,7 @@
 	disk->d_sync.ds_consumer = NULL;
 	disk->d_sync.ds_offset = md->md_sync_offset;
 	disk->d_sync.ds_offset_done = md->md_sync_offset;
+	disk->d_sync.ds_resync = -1;
 	disk->d_sync.ds_syncid = md->md_syncid;
 	if (errorp != NULL)
 		*errorp = 0;
@@ -952,6 +953,9 @@
 		return;
 	    }
 	case BIO_WRITE:
+	    {
+		struct g_mirror_disk_sync *sync;
+
 		if (bp->bio_error != 0) {
 			G_MIRROR_LOGREQ(0, bp,
 			    "Synchronization request failed (error=%d).",
@@ -964,17 +968,20 @@
 			return;
 		}
 		G_MIRROR_LOGREQ(3, bp, "Synchronization request finished.");
-		disk->d_sync.ds_offset_done = bp->bio_offset + bp->bio_length;
+		sync = &disk->d_sync;
+		sync->ds_offset_done = bp->bio_offset + bp->bio_length;
 		g_destroy_bio(bp);
-		if (disk->d_sync.ds_offset_done == sc->sc_provider->mediasize) {
+		if (sync->ds_resync != -1)
+			break;
+		if (sync->ds_offset_done == sc->sc_provider->mediasize) {
 			/*
 			 * Disk up-to-date, activate it.
 			 */
 			g_mirror_event_send(disk, G_MIRROR_DISK_STATE_ACTIVE,
 			    G_MIRROR_EVENT_DONTWAIT);
 			return;
-		} else if ((disk->d_sync.ds_offset_done %
-		    (G_MIRROR_SYNC_BLOCK_SIZE * 100)) == 0) {
+		} else if (sync->ds_offset_done %
+		    (G_MIRROR_SYNC_BLOCK_SIZE * 100) == 0) {
 			/*
 			 * Update offset_done on every 100 blocks.
 			 * XXX: This should be configurable.
@@ -984,6 +991,7 @@
 			g_topology_unlock();
 		}
 		return;
+	    }
 	default:
 		KASSERT(1 == 0, ("Invalid command here: %u (device=%s)",
 		    bp->bio_cmd, sc->sc_name));
@@ -1205,6 +1213,7 @@
 	case BIO_DELETE:
 	    {
 		struct g_mirror_disk *disk;
+		struct g_mirror_disk_sync *sync;
 		struct bio_queue_head queue;
 		struct g_consumer *cp;
 		struct bio *cbp;
@@ -1215,12 +1224,21 @@
 		 */
 		bioq_init(&queue);
 		LIST_FOREACH(disk, &sc->sc_disks, d_next) {
+			sync = &disk->d_sync;
 			switch (disk->d_state) {
 			case G_MIRROR_DISK_STATE_ACTIVE:
 				break;
 			case G_MIRROR_DISK_STATE_SYNCHRONIZING:
-				if (bp->bio_offset >= disk->d_sync.ds_offset)
+				if (bp->bio_offset >= sync->ds_offset)
 					continue;
+				else if (bp->bio_offset + bp->bio_length >
+				    sync->ds_offset_done &&
+				    (bp->bio_offset < sync->ds_resync ||
+				     sync->ds_resync != -1)) {
+					sync->ds_resync = bp->bio_offset -
+					    (bp->bio_offset %
+					    G_MIRROR_SYNC_BLOCK_SIZE);
+				}
 				break;
 			default:
 				continue;
@@ -1330,6 +1348,7 @@
 {
 	struct g_mirror_softc *sc;
 	struct g_mirror_disk *disk;
+	struct g_mirror_disk_sync *sync;
 	struct g_mirror_event *ep;
 	struct bio *bp;
 	u_int nreqs;
@@ -1411,13 +1430,17 @@
 				    G_MIRROR_DISK_STATE_SYNCHRONIZING) {
 					continue;
 				}
-				if (disk->d_sync.ds_offset >=
+				sync = &disk->d_sync;
+				if (sync->ds_offset >=
 				    sc->sc_provider->mediasize) {
 					continue;
 				}
-				if (disk->d_sync.ds_offset >
-				    disk->d_sync.ds_offset_done) {
+				if (sync->ds_offset > sync->ds_offset_done)
 					continue;
+				if (sync->ds_resync != -1) {
+					sync->ds_offset = sync->ds_resync;
+					sync->ds_offset_done = sync->ds_resync;
+					sync->ds_resync = -1;
 				}
 				g_mirror_sync_one(disk);
 			}

==== //depot/projects/nsched/sys/geom/mirror/g_mirror.h#2 (text+ko) ====

@@ -23,7 +23,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/geom/mirror/g_mirror.h,v 1.8 2004/08/11 23:41:53 pjd Exp $
+ * $FreeBSD: src/sys/geom/mirror/g_mirror.h,v 1.9 2004/09/26 20:42:35 pjd Exp $
  */
 
 #ifndef	_G_MIRROR_H_
@@ -97,6 +97,7 @@
 	off_t		 ds_offset;	/* Offset of next request to send. */
 	off_t		 ds_offset_done; /* Offset of already synchronized
 					   region. */
+	off_t		 ds_resync;	/* Resynchronize from this offset. */
 	u_int		 ds_syncid;	/* Disk's synchronization ID. */
 	u_char		*ds_data;
 };

==== //depot/projects/nsched/sys/ia64/ia32/ia32_trap.c#2 (text+ko) ====

@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/ia64/ia32/ia32_trap.c,v 1.2 2004/09/26 00:38:56 marcel Exp $");
+__FBSDID("$FreeBSD: src/sys/ia64/ia32/ia32_trap.c,v 1.3 2004/09/26 20:39:56 marcel Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -45,6 +45,10 @@
 #include <machine/md_var.h>
 #include <i386/include/psl.h>
 
+#ifdef WITNESS
+extern char *syscallnames[];
+#endif
+
 static void
 ia32_syscall(struct trapframe *tf)
 {


More information about the p4-projects mailing list