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:
parent
62514c9edc
commit
7cac36f2c2
@ -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);
|
||||
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user