Skip to content

Commit

Permalink
l2_arc alloc details in ioctl (#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
datacore-skumar authored May 17, 2022
1 parent 0dc68c0 commit d0ab097
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/sys/zfs_ioctl.h
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,7 @@ typedef struct {

char zpoolHealthState[MAXNAMELEN];
char name[MAXNAMELEN];
unsigned __int64 l2arc_alloc_size;
}zpool_zfs_metrics;

typedef struct {
Expand Down
5 changes: 5 additions & 0 deletions module/os/windows/spl/spl-kstat.c
Original file line number Diff line number Diff line change
Expand Up @@ -2261,6 +2261,11 @@ int spl_kstat_write(PDEVICE_OBJECT DiskDevice, PIRP Irp,
return (0);
}

uint64_t
getL2ArcAllocSize(arc_stats_t* arc_ptr) {
return arc_ptr->arcstat_l2_psize.value.ui64;
}

// Added comments inline referring to perl arcstat.pl
void
arc_cache_counters_perfmon(cache_counters* perf, arc_stats_t* arc_ptr)
Expand Down
8 changes: 8 additions & 0 deletions module/os/windows/zfs/zfs_ioctl_os.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ zfs_vfs_ref(zfsvfs_t **zfvp)
return (error);
}

extern kstat_t* perf_arc_ksp;
NTSTATUS zpool_zfs_get_metrics(PDEVICE_OBJECT DeviceObject, PIRP Irp, PIO_STACK_LOCATION IrpSp)
{
Irp->IoStatus.Information = 0;
Expand All @@ -112,6 +113,7 @@ NTSTATUS zpool_zfs_get_metrics(PDEVICE_OBJECT DeviceObject, PIRP Irp, PIO_STACK_
perf->zpool_size = 0;
perf->zfs_volSize = 0;
strncpy(perf->zpoolHealthState, "", sizeof(perf->zpoolHealthState));
perf->l2arc_alloc_size = 0;

perf->used = getUsedData(perf->name);
perf->compress_ratio = getCompressRatio(perf->name);
Expand Down Expand Up @@ -141,6 +143,12 @@ NTSTATUS zpool_zfs_get_metrics(PDEVICE_OBJECT DeviceObject, PIRP Irp, PIO_STACK_
else
perf->zfs_volSize = getZvolSize(perf->name);

KSTAT_ENTER(perf_arc_ksp);
int error = KSTAT_UPDATE(perf_arc_ksp, KSTAT_READ);
if (!error)
perf->l2arc_alloc_size = getL2ArcAllocSize(perf_arc_ksp->ks_data);
KSTAT_EXIT(perf_arc_ksp);

Irp->IoStatus.Information = sizeof(zpool_zfs_metrics);
return STATUS_SUCCESS;
}
Expand Down

0 comments on commit d0ab097

Please sign in to comment.