From owner-freebsd-bugs@FreeBSD.ORG Fri Nov 25 06:00:26 2011 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 644C0106566C for ; Fri, 25 Nov 2011 06:00:26 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 226828FC15 for ; Fri, 25 Nov 2011 06:00:26 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id pAP60PYS007126 for ; Fri, 25 Nov 2011 06:00:26 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id pAP60PeC007125; Fri, 25 Nov 2011 06:00:25 GMT (envelope-from gnats) Resent-Date: Fri, 25 Nov 2011 06:00:25 GMT Resent-Message-Id: <201111250600.pAP60PeC007125@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, KOIE Hidetaka Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 83F44106566B for ; Fri, 25 Nov 2011 05:50:33 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22]) by mx1.freebsd.org (Postfix) with ESMTP id 747F48FC08 for ; Fri, 25 Nov 2011 05:50:33 +0000 (UTC) Received: from red.freebsd.org (localhost [127.0.0.1]) by red.freebsd.org (8.14.4/8.14.4) with ESMTP id pAP5oXY4026551 for ; Fri, 25 Nov 2011 05:50:33 GMT (envelope-from nobody@red.freebsd.org) Received: (from nobody@localhost) by red.freebsd.org (8.14.4/8.14.4/Submit) id pAP5oX2g026550; Fri, 25 Nov 2011 05:50:33 GMT (envelope-from nobody) Message-Id: <201111250550.pAP5oX2g026550@red.freebsd.org> Date: Fri, 25 Nov 2011 05:50:33 GMT From: KOIE Hidetaka To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: kern/162867: better zfs_cv_init X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Nov 2011 06:00:26 -0000 >Number: 162867 >Category: kern >Synopsis: better zfs_cv_init >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Fri Nov 25 06:00:25 UTC 2011 >Closed-Date: >Last-Modified: >Originator: KOIE Hidetaka >Release: 10.0-CURRENT >Organization: Surigiken >Environment: FreeBSD guriandgura 10.0-CURRENT FreeBSD 10.0-CURRENT #0 r227876+c95877008e9f,hgver,npowerd,zfs_cv_init: Thu Nov 24 21:41:32 JST 2011 koie@guriandgura:/usr/obj/usr/src/sys/GURIANDGURA amd64 >Description: condition variables in ZFS are too long to view with ps(1)/top(1). This patch is to set a last member. >How-To-Repeat: >Fix: Patch attached with submission follows: # HG changeset patch # Parent eb7e7f3e356ee376809b5b7819155c8c0d142ad3 diff --git a/sys/cddl/compat/opensolaris/sys/kcondvar.h b/sys/cddl/compat/opensolaris/sys/kcondvar.h --- a/sys/cddl/compat/opensolaris/sys/kcondvar.h +++ b/sys/cddl/compat/opensolaris/sys/kcondvar.h @@ -44,18 +44,21 @@ CV_DRIVER } kcv_type_t; -#define zfs_cv_init(cv, name, type, arg) do { \ - const char *_name; \ - ASSERT((type) == CV_DEFAULT); \ - for (_name = #cv; *_name != '\0'; _name++) { \ - if (*_name >= 'a' && *_name <= 'z') \ +#define zfs_cv_init(cv, name, type, arg) do { \ + ASSERT(type == CV_DEFAULT); \ + const char *n = name; \ + const char *e; \ + for (e = n; *e != '\0'; e++) \ + ; \ + const char *s; \ + for (s = e; n < s; s--) { \ + char c = s[-1]; \ + if (c == '>' || c == '.' || c == '&') \ break; \ } \ - if (*_name == '\0') \ - _name = #cv; \ - cv_init((cv), _name); \ + cv_init(cv, s); \ } while (0) -#define cv_init(cv, name, type, arg) zfs_cv_init((cv), (name), (type), (arg)) +#define cv_init(cv, name, type, arg) zfs_cv_init((cv), #cv, (type), (arg)) #endif /* _KERNEL */ >Release-Note: >Audit-Trail: >Unformatted: