aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/subr_devstat.c
diff options
context:
space:
mode:
authorPoul-Henning Kamp <phk@FreeBSD.org>2003-03-18 09:30:31 +0000
committerPoul-Henning Kamp <phk@FreeBSD.org>2003-03-18 09:30:31 +0000
commitc967bee755008d70c4d376e2c5fc10773fa40a9f (patch)
treecd2934aa49e9d6478486829f3c0ddb9c358b6a5b /sys/kern/subr_devstat.c
parent224d5539a9b84eb4b34200ba7a1a02febd5497dc (diff)
downloadsrc-c967bee755008d70c4d376e2c5fc10773fa40a9f.tar.gz
src-c967bee755008d70c4d376e2c5fc10773fa40a9f.zip
Notes
Diffstat (limited to 'sys/kern/subr_devstat.c')
-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 7277dd1ce89e..43560203d4e2 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);