svn commit: r186952 - in user/luigi/geom_sched/sys/geom: . sched

Luigi Rizzo luigi at FreeBSD.org
Fri Jan 9 06:35:56 PST 2009


Author: luigi
Date: Fri Jan  9 14:35:55 2009
New Revision: 186952
URL: http://svn.freebsd.org/changeset/base/186952

Log:
  do the patching of g_io_request

Modified:
  user/luigi/geom_sched/sys/geom/geom_io.c
  user/luigi/geom_sched/sys/geom/sched/g_sched.c

Modified: user/luigi/geom_sched/sys/geom/geom_io.c
==============================================================================
--- user/luigi/geom_sched/sys/geom/geom_io.c	Fri Jan  9 14:35:32 2009	(r186951)
+++ user/luigi/geom_sched/sys/geom/geom_io.c	Fri Jan  9 14:35:55 2009	(r186952)
@@ -369,7 +369,7 @@ g_io_request(struct bio *bp, struct g_co
 	bp->bio_error = 0;
 	bp->bio_completed = 0;
 
-#if 1
+#if 0
 	/*
 	 * Scheduler support: if this is the first element in the geom
 	 * chain (we know from bp->bio_parent == NULL), store

Modified: user/luigi/geom_sched/sys/geom/sched/g_sched.c
==============================================================================
--- user/luigi/geom_sched/sys/geom/sched/g_sched.c	Fri Jan  9 14:35:32 2009	(r186951)
+++ user/luigi/geom_sched/sys/geom/sched/g_sched.c	Fri Jan  9 14:35:55 2009	(r186952)
@@ -433,7 +433,7 @@ g_io_trampoline[] = {
         0xe9, 0x00, 0x00, 0x00, 0x00,   /* jmp x+5 */
 };
 
-static void
+static int
 g_new_io_request(const char *ret, struct bio *bp, struct g_consumer *cp)
 {
 
@@ -444,15 +444,20 @@ g_new_io_request(const char *ret, struct
          * which should be unused in this particular entry (at least
          * with the code in 7.1/8.0).
          */
-        if (bp->bio_parent == NULL && bp->bio_caller1 == NULL)
-		bp->bio_caller1 = (void *)curthread->td_tid;
+	struct bio *top = bp;
+	if (top) {
+                while (top->bio_parent)
+                        top = top->bio_parent;
+                if (top->bio_caller1 == NULL)
+                        top->bio_caller1 = (void *)curthread->td_tid;
+        }
+	return (bp != top);	/* prevent compiler from clobbering bp */
 }
 
 static int g_io_patched = 0;
 static int
 g_io_patch(void *f, void *p, void *new_f)
 {
-	return 0;
 	int found = bcmp(f, (const char *)p + 5, 5);
 	printf("match result %d\n", found);
         if (found == 0) {


More information about the svn-src-user mailing list