Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 5 Feb 2010 11:56:12 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r203520 - in stable/8/sys/geom: mirror raid3
Message-ID:  <201002051156.o15BuCgx029642@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Fri Feb  5 11:56:12 2010
New Revision: 203520
URL: http://svn.freebsd.org/changeset/base/203520

Log:
  MFC r201566, r201567:
  Move wakeup() out of mutex to reduce contention.

Modified:
  stable/8/sys/geom/mirror/g_mirror.c
  stable/8/sys/geom/raid3/g_raid3.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/mirror/g_mirror.c
==============================================================================
--- stable/8/sys/geom/mirror/g_mirror.c	Fri Feb  5 11:53:41 2010	(r203519)
+++ stable/8/sys/geom/mirror/g_mirror.c	Fri Feb  5 11:56:12 2010	(r203520)
@@ -868,8 +868,8 @@ g_mirror_done(struct bio *bp)
 	bp->bio_cflags = G_MIRROR_BIO_FLAG_REGULAR;
 	mtx_lock(&sc->sc_queue_mtx);
 	bioq_disksort(&sc->sc_queue, bp);
-	wakeup(sc);
 	mtx_unlock(&sc->sc_queue_mtx);
+	wakeup(sc);
 }
 
 static void
@@ -954,9 +954,9 @@ g_mirror_regular_request(struct bio *bp)
 			pbp->bio_error = 0;
 			mtx_lock(&sc->sc_queue_mtx);
 			bioq_disksort(&sc->sc_queue, pbp);
+			mtx_unlock(&sc->sc_queue_mtx);
 			G_MIRROR_DEBUG(4, "%s: Waking up %p.", __func__, sc);
 			wakeup(sc);
-			mtx_unlock(&sc->sc_queue_mtx);
 		}
 		break;
 	case BIO_DELETE:
@@ -994,8 +994,8 @@ g_mirror_sync_done(struct bio *bp)
 	bp->bio_cflags = G_MIRROR_BIO_FLAG_SYNC;
 	mtx_lock(&sc->sc_queue_mtx);
 	bioq_disksort(&sc->sc_queue, bp);
-	wakeup(sc);
 	mtx_unlock(&sc->sc_queue_mtx);
+	wakeup(sc);
 }
 
 static void
@@ -1107,9 +1107,9 @@ g_mirror_start(struct bio *bp)
 	}
 	mtx_lock(&sc->sc_queue_mtx);
 	bioq_disksort(&sc->sc_queue, bp);
+	mtx_unlock(&sc->sc_queue_mtx);
 	G_MIRROR_DEBUG(4, "%s: Waking up %p.", __func__, sc);
 	wakeup(sc);
-	mtx_unlock(&sc->sc_queue_mtx);
 }
 
 /*

Modified: stable/8/sys/geom/raid3/g_raid3.c
==============================================================================
--- stable/8/sys/geom/raid3/g_raid3.c	Fri Feb  5 11:53:41 2010	(r203519)
+++ stable/8/sys/geom/raid3/g_raid3.c	Fri Feb  5 11:56:12 2010	(r203520)
@@ -1271,9 +1271,9 @@ g_raid3_done(struct bio *bp)
 	G_RAID3_LOGREQ(3, bp, "Regular request done (error=%d).", bp->bio_error);
 	mtx_lock(&sc->sc_queue_mtx);
 	bioq_insert_head(&sc->sc_queue, bp);
+	mtx_unlock(&sc->sc_queue_mtx);
 	wakeup(sc);
 	wakeup(&sc->sc_queue);
-	mtx_unlock(&sc->sc_queue_mtx);
 }
 
 static void
@@ -1379,9 +1379,9 @@ g_raid3_sync_done(struct bio *bp)
 	bp->bio_cflags |= G_RAID3_BIO_CFLAG_SYNC;
 	mtx_lock(&sc->sc_queue_mtx);
 	bioq_insert_head(&sc->sc_queue, bp);
+	mtx_unlock(&sc->sc_queue_mtx);
 	wakeup(sc);
 	wakeup(&sc->sc_queue);
-	mtx_unlock(&sc->sc_queue_mtx);
 }
 
 static void
@@ -1459,9 +1459,9 @@ g_raid3_start(struct bio *bp)
 	}
 	mtx_lock(&sc->sc_queue_mtx);
 	bioq_insert_tail(&sc->sc_queue, bp);
+	mtx_unlock(&sc->sc_queue_mtx);
 	G_RAID3_DEBUG(4, "%s: Waking up %p.", __func__, sc);
 	wakeup(sc);
-	mtx_unlock(&sc->sc_queue_mtx);
 }
 
 /*



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