Date: Fri, 25 Nov 2011 05:50:33 GMT From: KOIE Hidetaka <koie@suri.co.jp> To: freebsd-gnats-submit@FreeBSD.org Subject: kern/162867: better zfs_cv_init Message-ID: <201111250550.pAP5oX2g026550@red.freebsd.org> Resent-Message-ID: <201111250600.pAP60PeC007125@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>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:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201111250550.pAP5oX2g026550>