From owner-p4-projects@FreeBSD.ORG Sat Aug 13 08:42:33 2005 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 66E9916A421; Sat, 13 Aug 2005 08:42:33 +0000 (GMT) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 22E5D16A41F for ; Sat, 13 Aug 2005 08:42:33 +0000 (GMT) (envelope-from soc-cjones@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id DC6D743D45 for ; Sat, 13 Aug 2005 08:42:32 +0000 (GMT) (envelope-from soc-cjones@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id j7D8gWdd023410 for ; Sat, 13 Aug 2005 08:42:32 GMT (envelope-from soc-cjones@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id j7D8gWXD023404 for perforce@freebsd.org; Sat, 13 Aug 2005 08:42:32 GMT (envelope-from soc-cjones@freebsd.org) Date: Sat, 13 Aug 2005 08:42:32 GMT Message-Id: <200508130842.j7D8gWXD023404@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to soc-cjones@freebsd.org using -f From: soc-cjones To: Perforce Change Reviews Cc: Subject: PERFORCE change 81928 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Aug 2005 08:42:34 -0000 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); }