summaryrefslogtreecommitdiffstats
path: root/module/spl/spl-kstat.c
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2012-01-30 12:15:31 -0800
committerBrian Behlendorf <[email protected]>2012-02-02 11:28:00 -0800
commit9a8b7a7458a3d76d35b26e7f2b737abd9ab4c6ef (patch)
treed18ccbb60e2a38087166dcfb92e6d843841808f4 /module/spl/spl-kstat.c
parent4b2220f0b937018b79154ac368c845e6176a8a66 (diff)
Add basic dynamic kstat support
Add the bare minimum functionality to support dynamic kstats. A complete kstat implementation should be done as part of issue #84. Signed-off-by: Brian Behlendorf <[email protected]> Issue #84
Diffstat (limited to 'module/spl/spl-kstat.c')
-rw-r--r--module/spl/spl-kstat.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/module/spl/spl-kstat.c b/module/spl/spl-kstat.c
index ee9dfdf03..48fab972b 100644
--- a/module/spl/spl-kstat.c
+++ b/module/spl/spl-kstat.c
@@ -223,6 +223,13 @@ kstat_seq_show(struct seq_file *f, void *p)
return rc;
}
+int
+kstat_default_update(kstat_t *ksp, int rw)
+{
+ ASSERT(ksp != NULL);
+ return 0;
+}
+
static void *
kstat_seq_data_addr(kstat_t *ksp, loff_t n)
{
@@ -260,6 +267,9 @@ kstat_seq_start(struct seq_file *f, loff_t *pos)
ASSERT(ksp->ks_magic == KS_MAGIC);
SENTRY;
+ /* Dynamically update kstat, on error existing kstats are used */
+ (void) ksp->ks_update(ksp, KSTAT_READ);
+
spin_lock(&ksp->ks_lock);
ksp->ks_snaptime = gethrtime();
@@ -361,6 +371,8 @@ __kstat_create(const char *ks_module, int ks_instance, const char *ks_name,
strncpy(ksp->ks_class, ks_class, KSTAT_STRLEN);
ksp->ks_type = ks_type;
ksp->ks_flags = ks_flags;
+ ksp->ks_update = kstat_default_update;
+ ksp->ks_private = NULL;
switch (ksp->ks_type) {
case KSTAT_TYPE_RAW: