From owner-svn-src-all@freebsd.org Mon Aug 7 19:18:28 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EAF21DC2B80; Mon, 7 Aug 2017 19:18:28 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 C63F27E81C; Mon, 7 Aug 2017 19:18:28 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v77JIShs052317; Mon, 7 Aug 2017 19:18:28 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v77JISXB052316; Mon, 7 Aug 2017 19:18:28 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201708071918.v77JISXB052316@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Mon, 7 Aug 2017 19:18:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322178 - head/sys/geom/journal X-SVN-Group: head X-SVN-Commit-Author: mckusick X-SVN-Commit-Paths: head/sys/geom/journal X-SVN-Commit-Revision: 322178 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Aug 2017 19:18:29 -0000 Author: mckusick Date: Mon Aug 7 19:18:27 2017 New Revision: 322178 URL: https://svnweb.freebsd.org/changeset/base/322178 Log: sysctl kern.geom.journal.cache.limit shows negative value for FreeBSD/amd64 system having over 4GB RAM. That's due to: 1) the limit being u_int instead of u_long like vm.kmem_size (the limit is half of vm.kmem_size by default for amd64); 2) sysctl handler g_journal_cache_limit_sysctl() using u_int instead of u_long. The fix is to replace u_int with u_long for the kern.geom.journal.cache.limit sysctl variable. PR: 198500 Submitted by: Dr. Andreas Longwitz Reported by: Eugene Grosbein Discussed with: kib MFC after: 1 week Modified: head/sys/geom/journal/g_journal.c Modified: head/sys/geom/journal/g_journal.c ============================================================================== --- head/sys/geom/journal/g_journal.c Mon Aug 7 18:01:27 2017 (r322177) +++ head/sys/geom/journal/g_journal.c Mon Aug 7 19:18:27 2017 (r322178) @@ -130,26 +130,26 @@ SYSCTL_PROC(_kern_geom_journal, OID_AUTO, record_entri SYSCTL_UINT(_kern_geom_journal, OID_AUTO, optimize, CTLFLAG_RW, &g_journal_do_optimize, 0, "Try to combine bios on flush and copy"); -static u_int g_journal_cache_used = 0; -static u_int g_journal_cache_limit = 64 * 1024 * 1024; +static u_long g_journal_cache_used = 0; +static u_long g_journal_cache_limit = 64 * 1024 * 1024; static u_int g_journal_cache_divisor = 2; static u_int g_journal_cache_switch = 90; static u_int g_journal_cache_misses = 0; static u_int g_journal_cache_alloc_failures = 0; -static u_int g_journal_cache_low = 0; +static u_long g_journal_cache_low = 0; static SYSCTL_NODE(_kern_geom_journal, OID_AUTO, cache, CTLFLAG_RW, 0, "GEOM_JOURNAL cache"); -SYSCTL_UINT(_kern_geom_journal_cache, OID_AUTO, used, CTLFLAG_RD, +SYSCTL_ULONG(_kern_geom_journal_cache, OID_AUTO, used, CTLFLAG_RD, &g_journal_cache_used, 0, "Number of allocated bytes"); static int g_journal_cache_limit_sysctl(SYSCTL_HANDLER_ARGS) { - u_int limit; + u_long limit; int error; limit = g_journal_cache_limit; - error = sysctl_handle_int(oidp, &limit, 0, req); + error = sysctl_handle_long(oidp, &limit, 0, req); if (error != 0 || req->newptr == NULL) return (error); g_journal_cache_limit = limit; @@ -157,7 +157,7 @@ g_journal_cache_limit_sysctl(SYSCTL_HANDLER_ARGS) return (0); } SYSCTL_PROC(_kern_geom_journal_cache, OID_AUTO, limit, - CTLTYPE_UINT | CTLFLAG_RWTUN, NULL, 0, g_journal_cache_limit_sysctl, "I", + CTLTYPE_ULONG | CTLFLAG_RWTUN, NULL, 0, g_journal_cache_limit_sysctl, "I", "Maximum number of allocated bytes"); SYSCTL_UINT(_kern_geom_journal_cache, OID_AUTO, divisor, CTLFLAG_RDTUN, &g_journal_cache_divisor, 0, @@ -3046,9 +3046,9 @@ g_journal_switcher(void *arg) kproc_exit(0); } if (error == 0 && g_journal_sync_requested == 0) { - GJ_DEBUG(1, "Out of cache, force switch (used=%u " - "limit=%u).", g_journal_cache_used, - g_journal_cache_limit); + GJ_DEBUG(1, "Out of cache, force switch (used=%jd " + "limit=%jd).", (intmax_t)g_journal_cache_used, + (intmax_t)g_journal_cache_limit); } GJ_TIMER_START(1, &bt); g_journal_do_switch(mp);