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

l2arc alloc details in ioctl #52

Merged
merged 1 commit into from
May 17, 2022
Merged
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
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