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
This commit is contained in:
parent
25f8576d1a
commit
72b9baaf8e
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user