Date: Sun, 19 Aug 2007 12:12:25 GMT From: Sonja Milicic <smilicic@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 125344 for review Message-ID: <200708191212.l7JCCPfa015827@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=125344 Change 125344 by smilicic@tanarri_marilith on 2007/08/19 12:12:06 userland dumper utility cleaned up unnecessary debug messages fixed a bug with snapshot files not being truncated Affected files ... .. //depot/projects/soc2007/smilicic_glog/sbin/geom/log/glog_dump.c#1 add .. //depot/projects/soc2007/smilicic_glog/sys/geom/log/glog.c#10 edit .. //depot/projects/soc2007/smilicic_glog/sys/geom/log/glog_alloctable.c#3 edit .. //depot/projects/soc2007/smilicic_glog/sys/geom/log/glog_fileops.c#5 edit Differences ... ==== //depot/projects/soc2007/smilicic_glog/sys/geom/log/glog.c#10 (text+ko) ==== @@ -255,7 +255,7 @@ } /*warn if the log file was made with different version of glog*/ if (head.version != G_LOG_VERSION) - G_LOG_DEBUG(0, "Header version: %d\nCurrent version: %d" + G_LOG_DEBUG(0, "Header version: %d Current version: %d" , head.version, G_LOG_VERSION); /*restore alloc table from file*/ sc->sc_curr_offset = sizeof(head); @@ -364,7 +364,6 @@ if (*num_arg == 2) { prov = gctl_get_asciiparam(req, "arg0"); file = gctl_get_asciiparam(req, "arg1"); - G_LOG_DEBUG(0, "Start"); gp = g_log_create_geom(prov, file, mp, &err); sc = gp->softc; KASSERT(sc != NULL, ("%s: sc is null", __func__)); @@ -480,12 +479,10 @@ switch(bp->bio_cmd) { case BIO_WRITE: - G_LOG_DEBUG(0, "Write request received."); g_log_post_event(&sc->sc_events, GLOG_EVWRITE, GLOG_FLAG_WAKEUP_SC, bp, 0); break; case BIO_READ: - G_LOG_DEBUG(0, "Read request received."); g_log_post_event(&sc->sc_events, GLOG_EVREAD, GLOG_FLAG_WAKEUP_SC, bp, 0); break; @@ -657,8 +654,6 @@ free(ev,M_GLOG); sleep: tsleep(es, PRIBIO, "glogidle", hz); } - G_LOG_DEBUG(0, "Worker died."); - } /* adds event to event queue */ static int @@ -772,8 +767,6 @@ /*reset buffer offset*/ offset_buf = 0; - G_LOG_DEBUG(0, "Requested %jd, %jd", bp->bio_offset, bp->bio_length); - /*retrieve request sublist*/ g_log_alloctable_get(sc, bp->bio_offset, (ssize_t)bp->bio_length); @@ -799,13 +792,8 @@ M_GLOG); } - /*dumping bio_data*/ - G_LOG_DEBUG(0, "Dumping bio data"); - for (i = 0; i < bp->bio_length; i++) - printf("%c", (char)(bp->bio_data[i])); bp->bio_completed = bp->bio_length; g_io_deliver(bp, 0); - printf("\nDone."); } /*commits the log file*/ @@ -874,11 +862,14 @@ char *data; size_t offset, filesize; - ss_vn = g_log_open_file(sc->sc_snapshot, FWRITE | O_CREAT | O_TRUNC, S_IWUSR); + ss_vn = g_log_open_file(sc->sc_snapshot, FWRITE | O_CREAT | O_TRUNC, + S_IWUSR); head = malloc(sizeof(*head), M_GLOG, M_WAITOK | M_ZERO); gd = malloc(sizeof(*gd), M_GLOG, M_WAITOK | M_ZERO); offset = 0; filesize = g_log_get_size(sc->sc_vn); + /*truncate snapshot file*/ + ss_vn = g_log_empty_file(ss_vn, sc->sc_snapshot); /*copy the contents of current log file to snapshot file*/ /*first, the header*/ g_log_read_data(sc->sc_vn, head, sizeof(*head), 0); ==== //depot/projects/soc2007/smilicic_glog/sys/geom/log/glog_alloctable.c#3 (text+ko) ==== @@ -80,7 +80,6 @@ ae->data_size = OFFSET_RANGE; g_log_alloctable_add(ae, sc->sc_alloctable, type); } - G_LOG_DEBUG(0, "Done adding"); } /*restore an alloc table from a log file*/ @@ -100,20 +99,15 @@ /*read entries from the log file one by one and convert them to entries in alloc list*/ filesize = g_log_get_size(sc->sc_vn); - G_LOG_DEBUG(0, "filesize = %d", filesize); while (sc->sc_curr_offset < filesize){ err = g_log_read_data(vp, gd, sizeof(*gd), sc->sc_curr_offset); ae->offset_disk = gd->offset_disk; ae->offset_log = gd->offset_log; ae->data_size = gd->data_size; sc->sc_curr_offset += gd->offset_log + gd->data_size; - G_LOG_DEBUG(0, "Found element %jd %jd %d, adding, curr offset " - "%jd", ae->offset_disk, ae->offset_log, ae->data_size, - sc->sc_curr_offset); g_log_alloctable_add(ae, sc->sc_alloctable, type); } - G_LOG_DEBUG(0, "Done adding"); free(gd, type); free(ae, type); } @@ -285,8 +279,6 @@ g_log_alloctable_get_rec(sc, 0, size, key+1, pos); } else { - G_LOG_DEBUG(0, "Adding %jd %d", ae->offset_disk, - ae->data_size); size -= ae->data_size; gd.offset_disk = ae->offset_disk; gd.offset_log = ae->offset_log; ==== //depot/projects/soc2007/smilicic_glog/sys/geom/log/glog_fileops.c#5 (text+ko) ==== @@ -82,7 +82,6 @@ strcpy(head.text, "GEOM_LOG"); head.version = G_LOG_VERSION; - G_LOG_DEBUG(0, "Writing %s %d", head.text, head.version); g_log_write_file(vp, &head, sizeof(head),0); } int @@ -182,8 +181,6 @@ int err, i; KASSERT(sc != 0, ("%s: sc is null", __func__)); - G_LOG_DEBUG(0, "Reading element %jd, %jd, %d", gd->offset_disk, - gd->offset_log, gd->data_size); if (gd->offset_log == -1) {/*read from disk*/ tmp_buf = g_read_data(sc->sc_cons_disk, gd->offset_disk, gd->data_size, &err);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200708191212.l7JCCPfa015827>