Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add ARC & L2ARC hit/miss bytes to arcstat #16726

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions include/sys/arc_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,10 @@ typedef struct arc_stats {
kstat_named_t arcstat_mfu_ghost_hits;
kstat_named_t arcstat_uncached_hits;
kstat_named_t arcstat_deleted;
/* Number of bytes that were satisfied without I/O. */
kstat_named_t arcstat_hit_bytes;
/* Number of bytes for which I/O has to be issued. */
kstat_named_t arcstat_miss_bytes;
/*
* Number of buffers that could not be evicted because the hash lock
* was held by another thread. The lock may not necessarily be held
Expand Down Expand Up @@ -793,6 +797,8 @@ typedef struct arc_stats {
kstat_named_t arcstat_l2_bufc_metadata_asize;
kstat_named_t arcstat_l2_feeds;
kstat_named_t arcstat_l2_rw_clash;
kstat_named_t arcstat_l2_hit_bytes;
kstat_named_t arcstat_l2_miss_bytes;
kstat_named_t arcstat_l2_read_bytes;
kstat_named_t arcstat_l2_write_bytes;
kstat_named_t arcstat_l2_writes_sent;
Expand Down Expand Up @@ -932,6 +938,8 @@ typedef struct arc_sums {
wmsum_t arcstat_mfu_ghost_hits;
wmsum_t arcstat_uncached_hits;
wmsum_t arcstat_deleted;
wmsum_t arcstat_hit_bytes;
wmsum_t arcstat_miss_bytes;
wmsum_t arcstat_mutex_miss;
wmsum_t arcstat_access_skip;
wmsum_t arcstat_evict_skip;
Expand Down Expand Up @@ -963,6 +971,8 @@ typedef struct arc_sums {
wmsum_t arcstat_l2_bufc_metadata_asize;
wmsum_t arcstat_l2_feeds;
wmsum_t arcstat_l2_rw_clash;
wmsum_t arcstat_l2_hit_bytes;
wmsum_t arcstat_l2_miss_bytes;
wmsum_t arcstat_l2_read_bytes;
wmsum_t arcstat_l2_write_bytes;
wmsum_t arcstat_l2_writes_sent;
Expand Down
29 changes: 29 additions & 0 deletions module/zfs/arc.c
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,8 @@ arc_stats_t arc_stats = {
{ "mfu_ghost_hits", KSTAT_DATA_UINT64 },
{ "uncached_hits", KSTAT_DATA_UINT64 },
{ "deleted", KSTAT_DATA_UINT64 },
{ "hit_bytes", KSTAT_DATA_UINT64 },
{ "miss_bytes", KSTAT_DATA_UINT64 },
{ "mutex_miss", KSTAT_DATA_UINT64 },
{ "access_skip", KSTAT_DATA_UINT64 },
{ "evict_skip", KSTAT_DATA_UINT64 },
Expand Down Expand Up @@ -569,6 +571,8 @@ arc_stats_t arc_stats = {
{ "l2_bufc_metadata_asize", KSTAT_DATA_UINT64 },
{ "l2_feeds", KSTAT_DATA_UINT64 },
{ "l2_rw_clash", KSTAT_DATA_UINT64 },
{ "l2_hit_bytes", KSTAT_DATA_UINT64 },
{ "l2_miss_bytes", KSTAT_DATA_UINT64 },
{ "l2_read_bytes", KSTAT_DATA_UINT64 },
{ "l2_write_bytes", KSTAT_DATA_UINT64 },
{ "l2_writes_sent", KSTAT_DATA_UINT64 },
Expand Down Expand Up @@ -5218,6 +5222,7 @@ arc_buf_access(arc_buf_t *buf)
hdr->b_l1hdr.b_state == arc_uncached);

DTRACE_PROBE1(arc__hit, arc_buf_hdr_t *, hdr);
ARCSTAT_INCR(arcstat_hit_bytes, HDR_GET_PSIZE(hdr));
arc_access(hdr, 0, B_TRUE);
mutex_exit(hash_lock);

Expand Down Expand Up @@ -5716,6 +5721,7 @@ arc_read(zio_t *pio, spa_t *spa, const blkptr_t *bp,
hdr->b_l1hdr.b_state == arc_uncached);

DTRACE_PROBE1(arc__hit, arc_buf_hdr_t *, hdr);
ARCSTAT_INCR(arcstat_hit_bytes, HDR_GET_PSIZE(hdr));
arc_access(hdr, *arc_flags, B_TRUE);

if (done && !no_buf) {
Expand Down Expand Up @@ -5964,6 +5970,7 @@ arc_read(zio_t *pio, spa_t *spa, const blkptr_t *bp,
blkptr_t *, bp, uint64_t, lsize,
zbookmark_phys_t *, zb);
ARCSTAT_BUMP(arcstat_misses);
ARCSTAT_INCR(arcstat_miss_bytes, HDR_GET_PSIZE(hdr));
ARCSTAT_CONDSTAT(!(*arc_flags & ARC_FLAG_PREFETCH),
demand, prefetch, !HDR_ISTYPE_METADATA(hdr), data,
metadata, misses);
Expand Down Expand Up @@ -6046,6 +6053,8 @@ arc_read(zio_t *pio, spa_t *spa, const blkptr_t *bp,

DTRACE_PROBE2(l2arc__read, vdev_t *, vd,
zio_t *, rzio);
ARCSTAT_INCR(arcstat_l2_hit_bytes,
HDR_GET_PSIZE(hdr));
ARCSTAT_INCR(arcstat_l2_read_bytes,
HDR_GET_PSIZE(hdr));

Expand All @@ -6065,6 +6074,8 @@ arc_read(zio_t *pio, spa_t *spa, const blkptr_t *bp,
DTRACE_PROBE1(l2arc__miss,
arc_buf_hdr_t *, hdr);
ARCSTAT_BUMP(arcstat_l2_misses);
ARCSTAT_INCR(arcstat_l2_miss_bytes,
HDR_GET_PSIZE(hdr));
if (HDR_L2_WRITING(hdr))
ARCSTAT_BUMP(arcstat_l2_rw_clash);
spa_config_exit(spa, SCL_L2ARC, vd);
Expand All @@ -6089,6 +6100,8 @@ arc_read(zio_t *pio, spa_t *spa, const blkptr_t *bp,
DTRACE_PROBE1(l2arc__miss,
arc_buf_hdr_t *, hdr);
ARCSTAT_BUMP(arcstat_l2_misses);
ARCSTAT_INCR(arcstat_l2_miss_bytes,
HDR_GET_PSIZE(hdr));
}
}
}
Expand Down Expand Up @@ -6988,6 +7001,10 @@ arc_kstat_update(kstat_t *ksp, int rw)
wmsum_value(&arc_sums.arcstat_uncached_hits);
as->arcstat_deleted.value.ui64 =
wmsum_value(&arc_sums.arcstat_deleted);
as->arcstat_hit_bytes.value.ui64 =
wmsum_value(&arc_sums.arcstat_hit_bytes);
as->arcstat_miss_bytes.value.ui64 =
wmsum_value(&arc_sums.arcstat_miss_bytes);
as->arcstat_mutex_miss.value.ui64 =
wmsum_value(&arc_sums.arcstat_mutex_miss);
as->arcstat_access_skip.value.ui64 =
Expand Down Expand Up @@ -7094,6 +7111,10 @@ arc_kstat_update(kstat_t *ksp, int rw)
wmsum_value(&arc_sums.arcstat_l2_feeds);
as->arcstat_l2_rw_clash.value.ui64 =
wmsum_value(&arc_sums.arcstat_l2_rw_clash);
as->arcstat_l2_hit_bytes.value.ui64 =
wmsum_value(&arc_sums.arcstat_l2_hit_bytes);
as->arcstat_l2_miss_bytes.value.ui64 =
wmsum_value(&arc_sums.arcstat_l2_miss_bytes);
as->arcstat_l2_read_bytes.value.ui64 =
wmsum_value(&arc_sums.arcstat_l2_read_bytes);
as->arcstat_l2_write_bytes.value.ui64 =
Expand Down Expand Up @@ -7422,6 +7443,8 @@ arc_state_init(void)
wmsum_init(&arc_sums.arcstat_mfu_ghost_hits, 0);
wmsum_init(&arc_sums.arcstat_uncached_hits, 0);
wmsum_init(&arc_sums.arcstat_deleted, 0);
wmsum_init(&arc_sums.arcstat_hit_bytes, 0);
wmsum_init(&arc_sums.arcstat_miss_bytes, 0);
wmsum_init(&arc_sums.arcstat_mutex_miss, 0);
wmsum_init(&arc_sums.arcstat_access_skip, 0);
wmsum_init(&arc_sums.arcstat_evict_skip, 0);
Expand Down Expand Up @@ -7453,6 +7476,8 @@ arc_state_init(void)
wmsum_init(&arc_sums.arcstat_l2_bufc_metadata_asize, 0);
wmsum_init(&arc_sums.arcstat_l2_feeds, 0);
wmsum_init(&arc_sums.arcstat_l2_rw_clash, 0);
wmsum_init(&arc_sums.arcstat_l2_hit_bytes, 0);
wmsum_init(&arc_sums.arcstat_l2_miss_bytes, 0);
wmsum_init(&arc_sums.arcstat_l2_read_bytes, 0);
wmsum_init(&arc_sums.arcstat_l2_write_bytes, 0);
wmsum_init(&arc_sums.arcstat_l2_writes_sent, 0);
Expand Down Expand Up @@ -7580,6 +7605,8 @@ arc_state_fini(void)
wmsum_fini(&arc_sums.arcstat_mfu_ghost_hits);
wmsum_fini(&arc_sums.arcstat_uncached_hits);
wmsum_fini(&arc_sums.arcstat_deleted);
wmsum_fini(&arc_sums.arcstat_hit_bytes);
wmsum_fini(&arc_sums.arcstat_miss_bytes);
wmsum_fini(&arc_sums.arcstat_mutex_miss);
wmsum_fini(&arc_sums.arcstat_access_skip);
wmsum_fini(&arc_sums.arcstat_evict_skip);
Expand Down Expand Up @@ -7611,6 +7638,8 @@ arc_state_fini(void)
wmsum_fini(&arc_sums.arcstat_l2_bufc_metadata_asize);
wmsum_fini(&arc_sums.arcstat_l2_feeds);
wmsum_fini(&arc_sums.arcstat_l2_rw_clash);
wmsum_fini(&arc_sums.arcstat_l2_hit_bytes);
wmsum_fini(&arc_sums.arcstat_l2_miss_bytes);
wmsum_fini(&arc_sums.arcstat_l2_read_bytes);
wmsum_fini(&arc_sums.arcstat_l2_write_bytes);
wmsum_fini(&arc_sums.arcstat_l2_writes_sent);
Expand Down
Loading