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.
This commit is contained in:
Allan Jude 2017-03-31 03:08:07 +00:00
parent 6ebc1b7b7d
commit 8554754c7b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=316314
2 changed files with 12 additions and 4 deletions

View file

@ -54,8 +54,12 @@ static off_t matchlen(u_char *old,off_t oldsize,u_char *new,off_t newsize)
{
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 oldsize,
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);

View file

@ -316,6 +316,7 @@ machine_init(struct statics *statics, char do_unames)
{
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, char do_unames)
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,