Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 31 Mar 2017 03:08:07 +0000 (UTC)
From:      Allan Jude <allanjude@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r316314 - in head/usr.bin: bsdiff/bsdiff top
Message-ID:  <201703310308.v2V387RS016610@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: allanjude
Date: Fri Mar 31 03:08:07 2017
New Revision: 316314
URL: https://svnweb.freebsd.org/changeset/base/316314

Log:
  fix top(1) ZFS compressed ARC support
  
  top(1) read the wrong amount of data from sysctl, uint64_t instead of
  boolean_t, resulting in the stats not showing in many cases.
  
  X-MFC-With:	r315435
  Sponsored by:	ScaleEngine Inc.

Modified:
  head/usr.bin/bsdiff/bsdiff/bsdiff.c
  head/usr.bin/top/machine.c

Modified: head/usr.bin/bsdiff/bsdiff/bsdiff.c
==============================================================================
--- head/usr.bin/bsdiff/bsdiff/bsdiff.c	Fri Mar 31 00:41:54 2017	(r316313)
+++ head/usr.bin/bsdiff/bsdiff/bsdiff.c	Fri Mar 31 03:08:07 2017	(r316314)
@@ -54,8 +54,12 @@ static off_t matchlen(u_char *old,off_t 
 {
 	off_t i;
 
-	for(i=0;(i<oldsize)&&(i<newsize);i++)
+printf("old=%p new=%p\n", old, new);
+//printf("oldsize=%ld newsize=%ld\n", oldsize, newsize);
+	for(i=0;(i<oldsize)&&(i<newsize);i++) {
+//printf("old[%ld] != new[%ld]\n", i, i);
 		if(old[i]!=new[i]) break;
+	}
 
 	return i;
 }
@@ -66,6 +70,9 @@ static off_t search(off_t *I,u_char *old
 	off_t x,y;
 
 	if(en-st<2) {
+printf("oldsize=%ld, newsize=%ld\n", oldsize, newsize);
+printf("x=matchlen(old, oldsize=%ld st=%ld I[st]=%ld, new, newsize=%ld)\n", oldsize-I[st], st, I[st], newsize);
+printf("y=matchlen(old, oldsize=%ld en=%ld I[en]=%ld, new, newsize=%ld)\n", oldsize-I[en], en, I[en], newsize);
 		x=matchlen(old+I[st],oldsize-I[st],new,newsize);
 		y=matchlen(old+I[en],oldsize-I[en],new,newsize);
 

Modified: head/usr.bin/top/machine.c
==============================================================================
--- head/usr.bin/top/machine.c	Fri Mar 31 00:41:54 2017	(r316313)
+++ head/usr.bin/top/machine.c	Fri Mar 31 03:08:07 2017	(r316314)
@@ -316,6 +316,7 @@ machine_init(struct statics *statics, ch
 {
 	int i, j, empty, pagesize;
 	uint64_t arc_size;
+	boolean_t carc_en;
 	size_t size;
 	struct passwd *pw;
 
@@ -327,9 +328,9 @@ machine_init(struct statics *statics, ch
 	    size != sizeof(smpmode))
 		smpmode = 0;
 
-	size = sizeof(arc_size);
-	if (sysctlbyname("vfs.zfs.compressed_arc_enabled", &arc_size, &size,
-	    NULL, 0) == 0 && arc_size == 1)
+	size = sizeof(carc_en);
+	if (sysctlbyname("vfs.zfs.compressed_arc_enabled", &carc_en, &size,
+	    NULL, 0) == 0 && carc_en == 1)
 		carc_enabled = 1;
 	size = sizeof(arc_size);
 	if (sysctlbyname("kstat.zfs.misc.arcstats.size", &arc_size, &size,



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201703310308.v2V387RS016610>