Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 13 Aug 2005 08:42:32 GMT
From:      soc-cjones <soc-cjones@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 81928 for review
Message-ID:  <200508130842.j7D8gWXD023404@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=81928

Change 81928 by soc-cjones@soc-cjones_ishtar on 2005/08/13 08:41:36

	Add debugging.

Affected files ...

.. //depot/projects/soc2005/gvinum/src/sys/geom/vinum/geom_vinum_subr.c#2 edit

Differences ...

==== //depot/projects/soc2005/gvinum/src/sys/geom/vinum/geom_vinum_subr.c#2 (text+ko) ====

@@ -431,6 +431,8 @@
 
 	g_topology_assert();
 
+	printf("gv_sd_to_drive: begins, sd '%s' size %lld drive '%s' avail %lld\n", s->name, (long long) s->size, d->name, (long long) d->avail);
+	
 	fl2 = NULL;
 
 	KASSERT(sc != NULL, ("gv_sd_to_drive: NULL softc"));
@@ -440,10 +442,14 @@
 	KASSERT(errlen >= ERRBUFSIZ, ("gv_sd_to_drive: short errlen (%d)",
 	    errlen));
 
+	printf("gv_sd_to_drive: checking drive_sc\n");
+
 	/* Check if this subdisk was already given to this drive. */
 	if (s->drive_sc == d)
 		return (0);
 
+	printf("gv_sd_to_drive: passed drive_sc check\n");
+
 	/* Preliminary checks. */
 	if (s->size > d->avail || d->freelist_entries == 0) {
 		snprintf(errstr, errlen, "not enough space on '%s' for '%s'",
@@ -451,16 +457,26 @@
 		return (-1);
 	}
 
+	printf("gv_sd_to_drive: passed available size and freelist checks\n");
+
 	/* No size given, autosize it. */
 	if (s->size == -1) {
+		printf("gv_sd_to_drive: autosizing ");
 		/* Find the largest available slot. */
 		LIST_FOREACH(fl, &d->freelist, freelist) {
+			printf(". ");
 			if (fl->size >= s->size) {
 				s->size = fl->size;
 				s->drive_offset = fl->offset;
 				fl2 = fl;
+				printf("done\n");
+			} else {
+			    printf("failed\n");
 			}
+			printf("gv_sd_to_drive: autosizing sd '%s' (size: %lld, drive_offset: %lld)\n", s->name, (long long) s->size, (long long) s->drive_offset);
 		}
+	    
+		printf("gv_sd_to_drive: finished LIST_FOREACH(fl) for '%s' size %lld, drive '%s' avail %lld, largest free slot size %lld\n", s->name, (long long) s->size, d->name, (long long) d->avail, (long long)  fl->size);
 
 		/* No good slot found? */
 		if (s->size == -1) {
@@ -484,6 +500,7 @@
 				fl2 = fl;
 				break;
 			}
+			printf("gv_sd_to_drive: fit sd '%s' (size: %lld, drive_offset: %lld)\n", s->name, (long long) s->size, (long long) s->drive_offset);
 		}
 
 		/* Couldn't find a good free slot. */
@@ -541,7 +558,7 @@
 
 		/* This is the free slot that we have found before. */
 		if (fl == fl2) {
-	
+
 			/*
 			 * The subdisk starts at the beginning of the free
 			 * slot.
@@ -571,6 +588,7 @@
 				 * the free slot, so we need to split it.
 				 */
 				if (s->drive_offset + s->size != tmp) {
+			
 					fl2 = g_malloc(sizeof(*fl2),
 					    M_WAITOK | M_ZERO);
 					fl2->offset = s->drive_offset + s->size;
@@ -603,12 +621,16 @@
 		}
 	}
 
+	printf("gv_sd_to_drive: before committing sd '%s' size %lld, drive '%s' avail %lld\n", s->name, (long long) s->size, d->name, (long long) d->avail);
+
 	d->sdcount++;
 	d->avail -= s->size;
 
 	/* Link back from the subdisk to this drive. */
 	s->drive_sc = d;
 
+	printf("gv_sd_to_drive: after committing sd '%s' size %lld, drive '%s' avail %lld\n", s->name, (long long) s->size, d->name, (long long) d->avail);
+
 	return (0);
 }
 



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