svn commit: r203518 - stable/8/sys/geom

Alexander Motin mav at FreeBSD.org
Fri Feb 5 11:52:29 UTC 2010


Author: mav
Date: Fri Feb  5 11:52:28 2010
New Revision: 203518
URL: http://svn.freebsd.org/changeset/base/203518

Log:
  MFC r201264:
  Call wakeup() only for the first request on the queue.

Modified:
  stable/8/sys/geom/geom_io.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/geom/geom_io.c
==============================================================================
--- stable/8/sys/geom/geom_io.c	Fri Feb  5 10:00:18 2010	(r203517)
+++ stable/8/sys/geom/geom_io.c	Fri Feb  5 11:52:28 2010	(r203518)
@@ -391,6 +391,7 @@ void
 g_io_request(struct bio *bp, struct g_consumer *cp)
 {
 	struct g_provider *pp;
+	int first;
 
 	KASSERT(cp != NULL, ("NULL cp in g_io_request"));
 	KASSERT(bp != NULL, ("NULL bp in g_io_request"));
@@ -463,12 +464,14 @@ g_io_request(struct bio *bp, struct g_co
 
 	pp->nstart++;
 	cp->nstart++;
+	first = TAILQ_EMPTY(&g_bio_run_down.bio_queue);
 	TAILQ_INSERT_TAIL(&g_bio_run_down.bio_queue, bp, bio_queue);
 	g_bio_run_down.bio_queue_length++;
 	g_bioq_unlock(&g_bio_run_down);
 
 	/* Pass it on down. */
-	wakeup(&g_wait_down);
+	if (first)
+		wakeup(&g_wait_down);
 }
 
 void
@@ -476,6 +479,7 @@ g_io_deliver(struct bio *bp, int error)
 {
 	struct g_consumer *cp;
 	struct g_provider *pp;
+	int first;
 
 	KASSERT(bp != NULL, ("NULL bp in g_io_deliver"));
 	pp = bp->bio_to;
@@ -536,11 +540,13 @@ g_io_deliver(struct bio *bp, int error)
 	pp->nend++;
 	if (error != ENOMEM) {
 		bp->bio_error = error;
+		first = TAILQ_EMPTY(&g_bio_run_up.bio_queue);
 		TAILQ_INSERT_TAIL(&g_bio_run_up.bio_queue, bp, bio_queue);
 		bp->bio_flags |= BIO_ONQUEUE;
 		g_bio_run_up.bio_queue_length++;
 		g_bioq_unlock(&g_bio_run_up);
-		wakeup(&g_wait_up);
+		if (first)
+			wakeup(&g_wait_up);
 		return;
 	}
 	g_bioq_unlock(&g_bio_run_up);


More information about the svn-src-stable-8 mailing list