From owner-svn-src-head@FreeBSD.ORG Sat Jun 14 12:26:12 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DE757D27; Sat, 14 Jun 2014 12:26:12 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B13BB2BF7; Sat, 14 Jun 2014 12:26:12 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s5ECQCqv050380; Sat, 14 Jun 2014 12:26:12 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s5ECQCUo050378; Sat, 14 Jun 2014 12:26:12 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201406141226.s5ECQCUo050378@svn.freebsd.org> From: Alexander Motin Date: Sat, 14 Jun 2014 12:26:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r267479 - head/sys/nfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Jun 2014 12:26:13 -0000 Author: mav Date: Sat Jun 14 12:26:12 2014 New Revision: 267479 URL: http://svnweb.freebsd.org/changeset/base/267479 Log: Fix/improve fhe_stats sysctl output. MFC after: 2 weeks Modified: head/sys/nfs/nfs_fha.c Modified: head/sys/nfs/nfs_fha.c ============================================================================== --- head/sys/nfs/nfs_fha.c Sat Jun 14 12:17:45 2014 (r267478) +++ head/sys/nfs/nfs_fha.c Sat Jun 14 12:26:12 2014 (r267479) @@ -468,14 +468,14 @@ fha_nd_complete(SVCTHREAD *thread, struc int fhe_stats_sysctl(SYSCTL_HANDLER_ARGS, struct fha_params *softc) { - int error, count, i; + int error, i; struct sbuf sb; struct fha_hash_entry *fhe; - bool_t first = TRUE; + bool_t first, hfirst; SVCTHREAD *thread; SVCPOOL *pool; - sbuf_new(&sb, NULL, 4096, SBUF_FIXEDLEN); + sbuf_new(&sb, NULL, 65536, SBUF_FIXEDLEN); pool = NULL; @@ -485,42 +485,44 @@ fhe_stats_sysctl(SYSCTL_HANDLER_ARGS, st } pool = *softc->pool; - count = 0; for (i = 0; i < FHA_HASH_SIZE; i++) if (!LIST_EMPTY(&softc->fha_hash[i].list)) - count++; + break; - if (count == 0) { + if (i == FHA_HASH_SIZE) { sbuf_printf(&sb, "No file handle entries.\n"); goto out; } - for (i = 0; i < FHA_HASH_SIZE; i++) { + hfirst = TRUE; + for (; i < FHA_HASH_SIZE; i++) { mtx_lock(&softc->fha_hash[i].mtx); + if (LIST_EMPTY(&softc->fha_hash[i].list)) { + mtx_unlock(&softc->fha_hash[i].mtx); + continue; + } + sbuf_printf(&sb, "%shash %d: {\n", hfirst ? "" : ", ", i); + first = TRUE; LIST_FOREACH(fhe, &softc->fha_hash[i].list, link) { - sbuf_printf(&sb, "%sfhe %p: {\n", first ? "" : ", ", fhe); + sbuf_printf(&sb, "%sfhe %p: {\n", first ? " " : ", ", fhe); sbuf_printf(&sb, " fh: %ju\n", (uintmax_t) fhe->fh); - sbuf_printf(&sb, " num_rw: %d\n", fhe->num_rw); - sbuf_printf(&sb, " num_exclusive: %d\n", fhe->num_exclusive); + sbuf_printf(&sb, " num_rw/exclusive: %d/%d\n", + fhe->num_rw, fhe->num_exclusive); sbuf_printf(&sb, " num_threads: %d\n", fhe->num_threads); LIST_FOREACH(thread, &fhe->threads, st_alink) { - sbuf_printf(&sb, " thread %p offset %ju " - "(count %d)\n", thread, + sbuf_printf(&sb, " thread %p offset %ju " + "reqs %d\n", thread, thread->st_p3, thread->st_p2); } - sbuf_printf(&sb, "}"); + sbuf_printf(&sb, " }"); first = FALSE; - - /* Limit the output. */ - if (++count > 128) { - sbuf_printf(&sb, "..."); - break; - } } + sbuf_printf(&sb, "\n}"); mtx_unlock(&softc->fha_hash[i].mtx); + hfirst = FALSE; } out: