Date: Thu, 24 Jun 2004 00:11:21 GMT From: Peter Wemm <peter@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 55653 for review Message-ID: <200406240011.i5O0BLWq086843@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=55653 Change 55653 by peter@peter_daintree on 2004/06/24 00:11:01 IFC @55651 Affected files ... .. //depot/projects/hammer/bin/ps/ps.c#15 integrate .. //depot/projects/hammer/lib/libkvm/kvm_proc.c#20 integrate .. //depot/projects/hammer/share/man/man4/usb.4#7 integrate .. //depot/projects/hammer/sys/geom/vinum/geom_vinum_plex.c#4 integrate .. //depot/projects/hammer/sys/geom/vinum/geom_vinum_raid5.c#3 integrate .. //depot/projects/hammer/sys/geom/vinum/geom_vinum_raid5.h#2 integrate Differences ... ==== //depot/projects/hammer/bin/ps/ps.c#15 (text+ko) ==== @@ -47,7 +47,7 @@ #endif #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/bin/ps/ps.c,v 1.101 2004/06/23 11:40:56 gad Exp $"); +__FBSDID("$FreeBSD: src/bin/ps/ps.c,v 1.102 2004/06/23 21:17:25 gad Exp $"); #include <sys/param.h> #include <sys/proc.h> @@ -977,19 +977,27 @@ /* * save arguments if needed */ - if (needcomm && (UREADOK(ki) || (ki->ki_p->ki_args != NULL))) { - ki->ki_args = strdup(fmt(kvm_getargv, ki, ki->ki_p->ki_comm, - MAXCOMLEN)); - } else if (needcomm) { - asprintf(&ki->ki_args, "(%s)", ki->ki_p->ki_comm); + if (needcomm) { + if (ki->ki_p->ki_stat == SZOMB) + ki->ki_args = strdup("<defunct>"); + else if (UREADOK(ki) || (ki->ki_p->ki_args != NULL)) + ki->ki_args = strdup(fmt(kvm_getargv, ki, + ki->ki_p->ki_comm, MAXCOMLEN)); + else + asprintf(&ki->ki_args, "(%s)", ki->ki_p->ki_comm); + if (ki->ki_env == NULL) + errx(1, "malloc failed"); } else { ki->ki_args = NULL; } - if (needenv && UREADOK(ki)) { - ki->ki_env = strdup(fmt(kvm_getenvv, ki, (char *)NULL, 0)); - } else if (needenv) { - ki->ki_env = malloc(3); - strcpy(ki->ki_env, "()"); + if (needenv) { + if (UREADOK(ki)) + ki->ki_env = strdup(fmt(kvm_getenvv, ki, + (char *)NULL, 0)); + else + ki->ki_env = strdup("()"); + if (ki->ki_env == NULL) + errx(1, "malloc failed"); } else { ki->ki_env = NULL; } ==== //depot/projects/hammer/lib/libkvm/kvm_proc.c#20 (text+ko) ==== @@ -42,7 +42,7 @@ #endif #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/lib/libkvm/kvm_proc.c,v 1.76 2004/06/19 14:08:10 gad Exp $"); +__FBSDID("$FreeBSD: src/lib/libkvm/kvm_proc.c,v 1.78 2004/06/23 21:59:56 gad Exp $"); /* * Proc traversal interface for kvm. ps and w are (probably) the exclusive @@ -128,7 +128,7 @@ TAILQ_FIRST(&proc.p_threads)); return (-1); } - if (proc.p_flag & P_SA == 0) { + if ((proc.p_flag & P_SA) == 0) { if (KREAD(kd, (u_long)TAILQ_FIRST(&proc.p_ksegrps), &mkg)) { @@ -328,10 +328,8 @@ continue; break; } - if (proc.p_comm[0] != 0) { - strncpy(kp->ki_comm, proc.p_comm, MAXCOMLEN); - kp->ki_comm[MAXCOMLEN] = 0; - } + if (proc.p_comm[0] != 0) + strlcpy(kp->ki_comm, proc.p_comm, MAXCOMLEN); (void)kvm_read(kd, (u_long)proc.p_sysent, (char *)&sysent, sizeof(sysent)); (void)kvm_read(kd, (u_long)sysent.sv_name, (char *)&svname, ==== //depot/projects/hammer/share/man/man4/usb.4#7 (text+ko) ==== @@ -25,7 +25,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF .\" THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $FreeBSD: src/share/man/man4/usb.4,v 1.30 2003/09/14 13:41:59 ru Exp $ +.\" $FreeBSD: src/share/man/man4/usb.4,v 1.31 2004/06/23 23:25:58 markus Exp $ .\" .Dd February 21, 1999 .Dt USB 4 @@ -236,7 +236,7 @@ .Va udi_config field shows the current configuration of the device. .Pp -.Va udi_peed +.Va udi_speed indicates whether the device is at low speed .Pq Dv USB_SPEED_LOW , full speed ==== //depot/projects/hammer/sys/geom/vinum/geom_vinum_plex.c#4 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/geom/vinum/geom_vinum_plex.c,v 1.3 2004/06/18 19:53:33 le Exp $"); +__FBSDID("$FreeBSD: src/sys/geom/vinum/geom_vinum_plex.c,v 1.4 2004/06/23 23:52:55 le Exp $"); #include <sys/param.h> #include <sys/bio.h> @@ -275,6 +275,8 @@ boff); if (err) { + if (p->org == GV_PLEX_RAID5) + gv_free_raid5_packet(wp); bp->bio_completed += bcount; if (bp->bio_error == 0) bp->bio_error = err; ==== //depot/projects/hammer/sys/geom/vinum/geom_vinum_raid5.c#3 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/geom/vinum/geom_vinum_raid5.c,v 1.3 2004/06/22 14:54:31 le Exp $"); +__FBSDID("$FreeBSD: src/sys/geom/vinum/geom_vinum_raid5.c,v 1.5 2004/06/23 23:52:55 le Exp $"); #include <sys/param.h> #include <sys/bio.h> @@ -70,6 +70,26 @@ return (wp); } +void +gv_free_raid5_packet(struct gv_raid5_packet *wp) +{ + struct gv_raid5_bit *r, *r2; + + /* Remove all the bits from this work packet. */ + TAILQ_FOREACH_SAFE(r, &wp->bits, list, r2) { + TAILQ_REMOVE(&wp->bits, r, list); + if (r->malloc) + g_free(r->buf); + if (r->bio != NULL) + g_destroy_bio(r->bio); + g_free(r); + } + + if (wp->bufmalloc == 1) + g_free(wp->buf); + g_free(wp); +} + /* * Check if the stripe that the work packet wants is already being used by * some other work packet. @@ -109,7 +129,6 @@ mtx_lock(&p->worklist_mtx); for (;;) { restart = 0; - g_trace(G_T_TOPOLOGY, "gv_raid5_worker scan"); TAILQ_FOREACH_SAFE(wp, &p->worklist, list, wpt) { /* This request packet is already being processed. */ if (wp->state == IO) @@ -141,9 +160,7 @@ mtx_lock(&p->worklist_mtx); } TAILQ_REMOVE(&p->worklist, wp, list); - if (wp->bufmalloc == 1) - g_free(wp->buf); - g_free(wp); + gv_free_raid5_packet(wp); restart++; /*break;*/ } @@ -152,7 +169,6 @@ /* Self-destruct. */ if (p->flags & GV_PLEX_THREAD_DIE) break; - g_trace(G_T_TOPOLOGY, "gv_raid5_worker sleep"); error = msleep(p, &p->worklist_mtx, PRIBIO, "-", hz/100); } @@ -240,15 +256,6 @@ break; } - g_destroy_bio(bp); - - if (rbp != NULL) { - if (rbp->malloc == 1) - g_free(rbp->buf); - TAILQ_REMOVE(&wp->bits, rbp, list); - g_free(rbp); - } - /* This request group is done. */ if (wp->active == 0) wp->state = FINISH; ==== //depot/projects/hammer/sys/geom/vinum/geom_vinum_raid5.h#2 (text+ko) ==== @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/geom/vinum/geom_vinum_raid5.h,v 1.1 2004/06/12 21:16:10 le Exp $ + * $FreeBSD: src/sys/geom/vinum/geom_vinum_raid5.h,v 1.2 2004/06/23 23:52:55 le Exp $ */ #ifndef _GEOM_VINUM_RAID5_H_ @@ -85,6 +85,7 @@ int gv_build_raid5_req(struct gv_raid5_packet *, struct bio *, caddr_t, long, off_t); +void gv_free_raid5_packet(struct gv_raid5_packet *); void gv_raid5_done(struct bio *); void gv_raid5_worker(void *); struct gv_raid5_packet *gv_new_raid5_packet(void);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200406240011.i5O0BLWq086843>