1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-19 10:53:58 +00:00

top: Change the way the ZFS ARC compression ratio is calculated

Based on feedback from OpenZFS developers Matt Ahrens and George Wilson,
the calculation of the ratio no longer takes in to account overhead.

The old formula could result in reporting a negative compression ratio

This could confuse the user or give a false impression that there would be
an advantage to disabling the compressed ARC feature.

The new formula will more closely match an average of the on-disk
compression ratio, as reported by the ZFS property 'compressratio'

MFC after:	3 days
Sponsored by:	ScaleEngine Inc.
This commit is contained in:
Allan Jude 2017-06-12 19:51:57 +00:00
parent ff6c17c94e
commit d9a7232865
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=319866

View File

@ -188,9 +188,9 @@ char *arcnames[] = {
NULL NULL
}; };
int carc_stats[5]; int carc_stats[4];
char *carcnames[] = { char *carcnames[] = {
"K Compressed, ", "K Uncompressed, ", ":1 Ratio, ", "K Overhead", "K Compressed, ", "K Uncompressed, ", ":1 Ratio, ",
NULL NULL
}; };
@ -580,11 +580,9 @@ get_system_info(struct system_info *si)
if (carc_enabled) { if (carc_enabled) {
GETSYSCTL("kstat.zfs.misc.arcstats.compressed_size", arc_stat); GETSYSCTL("kstat.zfs.misc.arcstats.compressed_size", arc_stat);
carc_stats[0] = arc_stat >> 10; carc_stats[0] = arc_stat >> 10;
carc_stats[2] = arc_stat >> 10; /* For ratio */
GETSYSCTL("kstat.zfs.misc.arcstats.uncompressed_size", arc_stat); GETSYSCTL("kstat.zfs.misc.arcstats.uncompressed_size", arc_stat);
carc_stats[1] = arc_stat >> 10; carc_stats[1] = arc_stat >> 10;
carc_stats[2] = arc_stats[0]; /* ARC Total */
GETSYSCTL("kstat.zfs.misc.arcstats.overhead_size", arc_stat);
carc_stats[3] = arc_stat >> 10;
si->carc = carc_stats; si->carc = carc_stats;
} }