Date: Fri, 2 Sep 2005 23:29:16 GMT From: soc-cjones <soc-cjones@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 83048 for review Message-ID: <200509022329.j82NTG9T095674@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=83048 Change 83048 by soc-cjones@soc-cjones_ides on 2005/09/02 23:28:25 Remove unnecessary debugging output. Affected files ... .. //depot/projects/soc2005/gvinum/src/sys/geom/vinum/geom_vinum.c#5 edit .. //depot/projects/soc2005/gvinum/src/sys/geom/vinum/geom_vinum_init.c#3 edit .. //depot/projects/soc2005/gvinum/src/sys/geom/vinum/geom_vinum_list.c#3 edit .. //depot/projects/soc2005/gvinum/src/sys/geom/vinum/geom_vinum_move.c#17 edit .. //depot/projects/soc2005/gvinum/src/sys/geom/vinum/geom_vinum_plex.c#4 edit .. //depot/projects/soc2005/gvinum/src/sys/geom/vinum/geom_vinum_rename.c#9 edit .. //depot/projects/soc2005/gvinum/src/sys/geom/vinum/geom_vinum_share.c#4 edit .. //depot/projects/soc2005/gvinum/src/sys/geom/vinum/geom_vinum_state.c#3 edit .. //depot/projects/soc2005/gvinum/src/sys/geom/vinum/geom_vinum_subr.c#3 edit Differences ... ==== //depot/projects/soc2005/gvinum/src/sys/geom/vinum/geom_vinum.c#5 (text+ko) ==== @@ -278,8 +278,6 @@ g_topology_assert(); - printf("gv_create: started\n"); - sc = gp->softc; /* Find out how many of each object have been passed in. */ @@ -288,8 +286,6 @@ subdisks = gctl_get_paraml(req, "subdisks", sizeof(*subdisks)); drives = gctl_get_paraml(req, "drives", sizeof(*drives)); - printf("gv_create: %d volumes, %d plexes, %d subdisks, %d drives\n", *volumes, *plexes, *subdisks, *volumes); - /* First, handle drive definitions ... */ for (i = 0; i < *drives; i++) { snprintf(buf, sizeof(buf), "drive%d", i); @@ -391,13 +387,9 @@ s = g_malloc(sizeof(*s), M_WAITOK | M_ZERO); bcopy(s2, s, sizeof(*s)); - printf("gv_create: at bcopy subdisk '%s', size %d\n", s->name, (int) s->size); - /* Find the drive where this subdisk should be put on. */ d = gv_find_drive(sc, s->drive); - printf("gv_create: after gv_find_drive subdisk '%s', size %ld, drive '%s' avail %lld\n", s->name, (long) s->size, d->name, (long long) d->avail); - /* drive not found - XXX */ if (d == NULL) { printf("FOO: drive '%s' not found\n", s->drive); @@ -408,8 +400,6 @@ /* Find the plex where this subdisk belongs to. */ p = gv_find_plex(sc, s->plex); - printf("gv_create: after gv_find_plex subdisk '%s', size %ld, drive '%s' avail %lld\n", s->name, (long) s->size, d->name, (long long) d->avail); - /* plex not found - XXX */ if (p == NULL) { printf("FOO: plex '%s' not found\n", s->plex); @@ -428,8 +418,6 @@ continue; } - printf("gv_create: after gv_sd_to_drive subdisk '%s', size %ld, drive '%s', avail %lld\n", s->name, (long) s->size, d->name, (long long) d->avail); - /* * Then, we give the subdisk to the plex; we check if the * given values are correct and maybe adjust them. @@ -441,8 +429,6 @@ } s->flags |= GV_SD_NEWBORN; - printf("gv_create: after gv_sd_to_plex subdisk '%s', size %lld, drive '%s', avail %lld\n", s->name, (long long) s->size, d->name, (long long) d->avail); - s->vinumconf = sc; LIST_INSERT_HEAD(&sc->subdisks, s, sd); } @@ -460,7 +446,6 @@ * geom. */ LIST_FOREACH(d, &sc->drives, drive) { - printf("LIST_FOREACH: drive '%s'\n", d->name); if (d->geom == NULL) { /* * XXX if the provider disapears before we get a chance @@ -474,9 +459,7 @@ continue; } cp = g_new_consumer(gp); - printf("gv_create: calling g_attach\n"); g_attach(cp, pp); - printf("gv_create: calling gv_save_config\n"); gv_save_config(cp, d, sc); g_detach(cp); g_destroy_consumer(cp); ==== //depot/projects/soc2005/gvinum/src/sys/geom/vinum/geom_vinum_init.c#3 (text+ko) ==== @@ -476,12 +476,8 @@ from = sync->from->consumer; to = sync->to->consumer; - printf("gv_sync_td: from=%p, to=%p)\n", from, to); - p = sync->to; - printf("gv_sync_td: plex '%s'\n", p->name); - if (p->flags & GV_PLEX_SYNCING) { printf("GEOM_VINUM: plex '%s' is already syncing.\n", p->name); g_free(sync); @@ -493,11 +489,8 @@ error = 0; - printf("gv_sync_td: locking topology\n"); g_topology_lock(); - printf("gv_sync_td: locked topology\n"); error = g_access(from, 1, 0, 0); - printf("g_access(from, 1, 0, 0) error = %d\n", error); if (error) { g_topology_unlock(); printf("GEOM_VINUM: sync from '%s' failed to access " @@ -515,15 +508,12 @@ g_free(sync); kthread_exit(error); } - printf("gv_sync_td: unlocking topology\n"); g_topology_unlock(); - printf("gv_sync_td: unlocked topology\n"); printf("GEOM_VINUM: plex sync %s -> %s started\n", sync->from->name, sync->to->name); for (i = 0; i < p->size; i+= sync->syncsize) { /* Read some bits from the good plex. */ - printf("g_read_data(%p, %lld, %lld, --)\n", from, (long long int) i, (long long int) sync->syncsize); buf = g_read_data(from, i, sync->syncsize, &error); if (buf == NULL) { printf("GEOM_VINUM: sync read from '%s' failed at " ==== //depot/projects/soc2005/gvinum/src/sys/geom/vinum/geom_vinum_list.c#3 (text+ko) ==== @@ -330,8 +330,6 @@ LIST_FOREACH(s, &p->subdisks, in_plex) gv_lsi(s, sb, flags); } - - printf("gv_lpi: plex %s size %lld\n", p->name, (long long) p->size); } /* List one or more subdisks. */ @@ -361,8 +359,6 @@ void gv_lsi(struct gv_sd *s, struct sbuf *sb, int flags) { - printf("gv_lsi: subdisk '%s', consumer %p, provider %p, size %lld\n", s->name, s->consumer, s->provider, (long long) s->size); - if (flags & GV_FLAG_V) { sbuf_printf(sb, "Subdisk %s:\n", s->name); sbuf_printf(sb, "\t\tSize: %16jd bytes (%jd MB)\n", ==== //depot/projects/soc2005/gvinum/src/sys/geom/vinum/geom_vinum_move.c#17 (text+ko) ==== @@ -79,11 +79,9 @@ return; } - printf("gv_move: getting argv[]\n"); for (i = 0; i < *argc; i++) { snprintf(buf, sizeof(buf), "argv%d", i); object = gctl_get_param(req, buf, NULL); - printf("%s -> %s\n", buf, object); if (NULL == object) continue; if (0 == i) @@ -116,13 +114,9 @@ gctl_error(req, "unknown subdisk '%s'", object); return; } - printf("gv_move: calling gv_move_sd\n"); err = gv_move_sd(sc, req, s, destination, *flags); if (err) -{ - printf("gv_move: gv_move_sd returned %d\n", err); return; -} break; case GV_TYPE_DRIVE: d = gv_find_drive(sc, object); @@ -177,13 +171,9 @@ struct g_consumer *cp; char errstr[ERRBUFSIZ]; - printf("gv_move_sd: entering\n"); - g_topology_assert(); KASSERT(cursd != NULL, ("gv_move_sd: NULL cursd")); - printf("gv_move_sd: topology asserted\n"); - if (!(flags && GV_FLAG_F)) { gctl_error(req, "-f flag not passed; move would be destructive"); return 98; @@ -208,21 +198,16 @@ /* Stale the old subdisk. */ err = gv_set_sd_state(cursd, GV_SD_STALE, GV_SETSTATE_FORCE | GV_SETSTATE_CONFIG); - printf("gv_move_sd: staling old sd\n"); - if (err) { - printf("gv_move_sd: gv_set_sd_state = %d\n", err); + if (err) return err; - } /* Create new subdisk. Ideally, we'd use gv_new_sd, but that requires us to create a string for it to parse, which is silly. TODO: maybe refactor gv_new_sd such that this is no longer the case. */ newsd = g_malloc(sizeof(struct gv_sd), M_WAITOK | M_ZERO); - printf("gv_move_sd: allocated newsd ptr\n"); - if (!newsd) { - printf("gv_move_sd: couldn't allocate memory for new subdisk struct\n"); + if (!newsd) return 95; - } + newsd->plex_offset = cursd->plex_offset; newsd->size = cursd->size; newsd->drive_offset = -1; @@ -231,12 +216,8 @@ strncpy(newsd->plex, cursd->plex, GV_MAXPLEXNAME); newsd->state = GV_SD_STALE; newsd->vinumconf = cursd->vinumconf; - printf("gv_move_sd: initialized newsd; name='%s', drive='%s', size=%lld, plex_offset=%lld\n", - newsd->name, newsd->drive, newsd->size, newsd->plex_offset); err = gv_sd_to_drive(sc, d, newsd, errstr, ERRBUFSIZ); - printf("gv_move_sd: allocated newsd to drive, drive_offset=%lld\n", newsd->drive_offset); if (err) { /* XXX not enough free space? */ - printf("gv_move_sd: gv_sd_to_drive = %d\n", err); gctl_error(req, errstr); g_free(newsd); return err; @@ -245,61 +226,28 @@ /* Replace the old sd by the new one. */ cp = cursd->consumer; g_detach(cp); - printf("gv_move_sd: detached consumer\n"); LIST_FOREACH_SAFE(s, &p->subdisks, in_plex, s2) { - printf("gv_move_sd: traversing in_plex list (s: %p, s->name: '%s', s2: %p)\n", - s, s->name, s2); - printf("gv_move_sd: for sd '%s', consumer = %p\n", s->name, s->consumer); if (s == cursd) { - printf("\thit!\n"); p->sdcount--; p->size -= s->size; err = gv_rm_sd(sc, req, s, 0); - printf("gv_move_sd: removed old subdisk\n"); - if (err) { - printf("gv_move_sd: gv_rm_sd = %d\n", err); + if (err) return err; - } } } - printf("gv_move_sd: completed traversing in_plex\n"); gv_sd_to_plex(p, newsd, 1); - /* newsd->flags |= GV_SD_NEWBORN; */ - printf("gv_move_sd: gave sd to plex, set flags\n"); gv_drive_modify(d); /* Creates the new providers.... */ - printf("gv_move_sd: gv_drive_modify(d)\n"); - printf("cp=%p, newsd=%p, newsd->provider=%p\n", cp, newsd, newsd->provider); /* And reconnect the consumer ... */ newsd->consumer = cp; err = g_attach(cp, newsd->provider); - printf("gv_move_sd: called g_attach(%p, %p) => %d; new consumer %p\n", cp, newsd->provider, err, newsd->consumer); if (err) { g_destroy_consumer(cp); gctl_error(req, "proposed move would create a loop in GEOM config"); return err; - } else { - printf("gv_move_sd: set newsd->consumer to %p\n", newsd->consumer); } - /* newsd->consumer = cp; */ - printf("gv_move_sd: before LIST_INSERT_HEAD\n"); LIST_INSERT_HEAD(&sc->subdisks, newsd, sd); - printf("gv_move_sd: inserted newsd into subdisks list\n"); - - /* LIST_FOREACH(s, &sc->subdisks, sd) - gv_update_sd_state(s); - printf("gv_move_sd: updated subdisk states\n"); - LIST_FOREACH(p, &sc->plexes, plex) - gv_update_plex_config(p); - printf("gv_move_sd: updated plex configs\n"); - LIST_FOREACH(v, &sc->volumes, volume) - gv_update_vol_state(v); - printf("gv_move_sd: updated volume states\n"); */ - gv_save_config_all(sc); - - printf("gv_move_sd: exiting at bottom\n"); - return 0; } ==== //depot/projects/soc2005/gvinum/src/sys/geom/vinum/geom_vinum_plex.c#4 (text+ko) ==== @@ -567,7 +567,7 @@ if (err) { printf("GEOM_VINUM: plex request failed for "); g_print_bio(bp); - printf(", err = %d\n", err); + printf("\n"); TAILQ_FOREACH_SAFE(bq, &wp->bits, queue, bq2) { TAILQ_REMOVE(&wp->bits, bq, queue); g_free(bq); @@ -629,7 +629,7 @@ if (err) { printf("GEOM_VINUM: plex request failed for "); g_print_bio(bp); - printf(", err = %d\n", err); + printf("\n"); cbp = bp->bio_driver1; while (cbp != NULL) { pbp = cbp->bio_caller1; ==== //depot/projects/soc2005/gvinum/src/sys/geom/vinum/geom_vinum_rename.c#9 (text+ko) ==== @@ -152,7 +152,6 @@ LIST_FOREACH(s, &sc->subdisks, sd) { if (!strncmp(s->drive, olddrivename, GV_MAXDRIVENAME)) { - printf("Fixing drive reference for subdisk %s from %s to %s\n", s->name, s->drive, d->name); strncpy(s->drive, d->name, GV_MAXDRIVENAME); } } @@ -188,7 +187,6 @@ return 1; } - printf("oldplexname = %s\n", oldplexname); strncpy(oldplexname, p->name, GV_MAXPLEXNAME); strncpy(p->name, newname, GV_MAXPLEXNAME); @@ -197,13 +195,11 @@ /* Fix up references and potentially rename subdisks. */ LIST_FOREACH(s, &sc->subdisks, sd) { if (!strncmp(s->plex, oldplexname, GV_MAXPLEXNAME)) { - printf("Fixing plex reference for subdisk %s from %s to %s\n", s->name, s->plex, p->name); strncpy(s->plex, p->name, GV_MAXPLEXNAME); if (flags && GV_FLAG_R) { char newsdname[GV_MAXSDNAME]; char oldsdname[GV_MAXSDNAME]; char *poldsdname = oldsdname; - printf("Modifying subdisk %s, s->plex = %s\n", s->name, s->plex); strncpy(oldsdname, s->name, GV_MAXSDNAME); strsep(&poldsdname, "."); strsep(&poldsdname, "."); @@ -211,8 +207,6 @@ if ((err = gv_rename_sd(sc, req, s, newsdname, flags))) return err; } - } else { - printf("Ignoring subdisk %s\n", s->name); } } return (0); @@ -248,7 +242,6 @@ return 1; } - printf("Renaming subdisk %s to %s\n", s->name, newname); strncpy(s->name, newname, GV_MAXSDNAME); /* XXX: can we rename providers here? */ @@ -271,11 +264,8 @@ return 2; } - printf("gv_rename_vol: flags = %x\n", flags); - /* Rename the volume. We need to hold on to the old volume name. */ strncpy(oldvolname, v->name, GV_MAXVOLNAME); - printf("Renaming volume %s to %s\n", v->name, newname); strncpy(v->name, newname, GV_MAXVOLNAME); /* Rename the associated plexes. For each plex, iterate across @@ -285,21 +275,17 @@ LIST_FOREACH(p, &sc->plexes, plex) { if (!strncmp(p->volume, oldvolname, GV_MAXVOLNAME)) { - printf("Fixing volume reference for plex %s from %s to %s\n", p->name, p->volume, v->name); strncpy(p->volume, v->name, GV_MAXVOLNAME); if (flags && GV_FLAG_R) { char newplexname[GV_MAXPLEXNAME]; char oldplexname[GV_MAXPLEXNAME]; char *poldplexname = oldplexname; - printf("Modifying plex %s, p->volume = %s\n", p->name, p->volume); strncpy(oldplexname, p->name, GV_MAXPLEXNAME); strsep(&poldplexname, "."); snprintf(newplexname, GV_MAXPLEXNAME, "%s.%s", v->name, poldplexname); if ((err = gv_rename_plex(sc, req, p, newplexname, flags))) return err; } - } else { - printf("Ignoring plex %s, p->volume = %s\n", p->name, p->volume); } } ==== //depot/projects/soc2005/gvinum/src/sys/geom/vinum/geom_vinum_share.c#4 (text+ko) ==== @@ -573,12 +573,10 @@ s->drive_offset = -1; errors = 0; for (j = 1; j < max; j++) { - /* printf("gv_new_sd: token = '%s'\n", token[j]); */ if (!strcmp(token[j], "name")) { j++; if (j >= max) { errors++; - /* printf("breaking on name '%s'\n", token[j]); */ break; } strncpy(s->name, token[j], GV_MAXSDNAME); @@ -586,7 +584,6 @@ j++; if (j >= max) { errors++; - /* printf("breaking on drive '%s'\n", token[j]); */ break; } strncpy(s->drive, token[j], GV_MAXDRIVENAME); @@ -594,7 +591,6 @@ j++; if (j >= max) { errors++; - /* printf("breaking on plex '%s'\n", token[j]); */ break; } strncpy(s->plex, token[j], GV_MAXPLEXNAME); @@ -602,7 +598,6 @@ j++; if (j >= max) { errors++; - /* printf("breaking on state '%s'\n", token[j]); */ break; } s->state = gv_sdstatei(token[j]); @@ -611,7 +606,6 @@ j++; if (j >= max) { errors++; - /* printf("breakign on length '%s'\n", token[j]); */ break; } s->size = gv_sizespec(token[j]); @@ -621,39 +615,33 @@ j++; if (j >= max) { errors++; - /* printf("breaking on driveoffset '%s'\n", token[j]); */ break; } s->drive_offset = gv_sizespec(token[j]); if (s->drive_offset != 0 && s->drive_offset < GV_DATA_START) { errors++; - /* printf("breaking on invalid drive offset\n"); */ break; } } else if (!strcmp(token[j], "plexoffset")) { j++; if (j >= max) { errors++; - /* printf("breaking on plexoffset '%s'\n", token[j]); */ break; } s->plex_offset = gv_sizespec(token[j]); if (s->plex_offset < 0) { errors++; - /* printf("breaking on invalid plexoffset\n"); */ break; } } else { errors++; - /* printf("breaking on invalid token '%s'\n", token[j]); */ break; } } - if (strlen(s->drive) == 0) { + if (strlen(s->drive) == 0) errors++; - } if (errors) { g_free(s); ==== //depot/projects/soc2005/gvinum/src/sys/geom/vinum/geom_vinum_state.c#3 (text+ko) ==== @@ -269,20 +269,13 @@ /* If our drive isn't up we cannot be up either. */ if (d->state != GV_DRIVE_UP) -{ - printf("gv_update_sd_state: drive '%s' not up, forcing sd '%s' down\n", d->name, s->name); s->state = GV_SD_DOWN; -} /* If this subdisk was just created, we assume it is good.*/ else if (s->flags & GV_SD_NEWBORN) { - printf("gv_update_sd_state: sd '%s' newborn\n", s->name); s->state = GV_SD_UP; s->flags &= ~GV_SD_NEWBORN; } else if (s->state != GV_SD_UP) -{ - printf("gv_update_sd_state: drive '%s' not up, forcing sd '%s' stale\n", d->name, s->name); s->state = GV_SD_STALE; -} else s->state = GV_SD_UP; ==== //depot/projects/soc2005/gvinum/src/sys/geom/vinum/geom_vinum_subr.c#3 (text+ko) ==== @@ -431,8 +431,6 @@ 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")); @@ -442,14 +440,10 @@ 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'", @@ -457,26 +451,16 @@ 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) { @@ -500,7 +484,6 @@ 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. */ @@ -558,7 +541,7 @@ /* This is the free slot that we have found before. */ if (fl == fl2) { - + /* * The subdisk starts at the beginning of the free * slot. @@ -588,7 +571,6 @@ * 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; @@ -621,16 +603,12 @@ } } - 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?200509022329.j82NTG9T095674>