summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2003-03-18 09:30:31 +0000
committerphk <phk@FreeBSD.org>2003-03-18 09:30:31 +0000
commiteef257a93e011a4e140ebc8b497d65adb03449bb (patch)
treecd2934aa49e9d6478486829f3c0ddb9c358b6a5b
parent45ffc6d11041c87590d2901a12e448fd7b539d2b (diff)
downloadFreeBSD-src-eef257a93e011a4e140ebc8b497d65adb03449bb.zip
FreeBSD-src-eef257a93e011a4e140ebc8b497d65adb03449bb.tar.gz
If devstat_new_entry() is passed a unit number of -1 assume that
the devstat is for an "interior" GEOM node and register using the name argument as a geom identity pointer. Do not put these devstat structures on the list returned by the sysctl. This gives us the ability to tell the two kinds of nodes apart and leave the current "strictly physical" view of devstat intact without modifications, yet be able to use devstat for both kinds of devices. It also saves us bloating struct devstat with another 48 bytes of space for the name. At least for now. Reviewed by: ken
-rw-r--r--sys/kern/subr_devstat.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/sys/kern/subr_devstat.c b/sys/kern/subr_devstat.c
index 7277dd1..4356020 100644
--- a/sys/kern/subr_devstat.c
+++ b/sys/kern/subr_devstat.c
@@ -80,8 +80,14 @@ devstat_new_entry(const void *dev_name,
ds = devstat_alloc();
mtx_lock(&devstat_mutex);
- devstat_add_entry(ds, dev_name, unit_number, block_size,
- flags, device_type, priority);
+ if (unit_number == -1) {
+ ds->id = dev_name;
+ binuptime(&ds->creation_time);
+ devstat_generation++;
+ } else {
+ devstat_add_entry(ds, dev_name, unit_number, block_size,
+ flags, device_type, priority);
+ }
mtx_unlock(&devstat_mutex);
return (ds);
}
@@ -186,8 +192,10 @@ devstat_remove_entry(struct devstat *ds)
/* Remove this entry from the devstat queue */
atomic_add_acq_int(&ds->sequence1, 1);
- devstat_num_devs--;
- STAILQ_REMOVE(devstat_head, ds, devstat, dev_links);
+ if (ds->id == NULL) {
+ devstat_num_devs--;
+ STAILQ_REMOVE(devstat_head, ds, devstat, dev_links);
+ }
devstat_free(ds);
devstat_generation++;
mtx_unlock(&devstat_mutex);
OpenPOWER on IntegriCloud