diff options
| author | haad <haad@NetBSD.org> | 2009-04-06 22:58:10 +0000 |
|---|---|---|
| committer | haad <haad@NetBSD.org> | 2009-04-06 22:58:10 +0000 |
| commit | ba7fcfeeb5aa605a8b013b145dcb4660a1d7b810 (patch) | |
| tree | 75827033971576a37a0ff375309c14f2b2045d89 /sys/dev/dm/dm_ioctl.c | |
| parent | 57fb98e3bfed1466091bb338a3317e436d30f9d5 (diff) | |
Use functions from disk(9) framework. Initialize disk/disklabel during
dm_device_create_ioctl, before calling dmgetdisklabel.
Use disk_busy/disk_unbusy in dmstrategy to display LVM LV's in iostat
output.
Diffstat (limited to 'sys/dev/dm/dm_ioctl.c')
| -rw-r--r-- | sys/dev/dm/dm_ioctl.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/sys/dev/dm/dm_ioctl.c b/sys/dev/dm/dm_ioctl.c index 9d76065083e..0f3feada2c5 100644 --- a/sys/dev/dm/dm_ioctl.c +++ b/sys/dev/dm/dm_ioctl.c @@ -1,4 +1,4 @@ -/* $NetBSD: dm_ioctl.c,v 1.9 2009/03/08 02:07:38 agc Exp $ */ +/* $NetBSD: dm_ioctl.c,v 1.10 2009/04/06 22:58:10 haad Exp $ */ /* * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -93,6 +93,7 @@ #include "dm.h" static uint64_t sc_minor_num; +extern const struct dkdriver dmdkdriver; uint64_t dev_counter; #define DM_REMOVE_FLAG(flag, name) do { \ @@ -247,9 +248,12 @@ dm_dev_create_ioctl(prop_dictionary_t dm_dict) prop_dictionary_set_uint32(dm_dict, DM_IOCTL_MINOR, dmv->minor); - disk_init(dmv->diskp, dmv->name, NULL); - + disk_init(dmv->diskp, dmv->name, &dmdkdriver); + disk_attach(dmv->diskp); + if ((r = dm_dev_insert(dmv)) != 0){ + mutex_destroy(&dmv->dev_mtx); + cv_destroy(&dmv->dev_cv); dm_dev_free(dmv); } @@ -398,6 +402,10 @@ dm_dev_remove_ioctl(prop_dictionary_t dm_dict) mutex_destroy(&dmv->dev_mtx); cv_destroy(&dmv->dev_cv); + + /* Destroy disk device structure */ + disk_detach(dmv->diskp); + disk_destroy(dmv->diskp); /* Destroy device */ (void)dm_dev_free(dmv); @@ -535,16 +543,12 @@ dm_dev_resume_ioctl(prop_dictionary_t dm_dict) atomic_and_32(&dmv->flags, ~(DM_SUSPEND_FLAG | DM_INACTIVE_PRESENT_FLAG)); atomic_or_32(&dmv->flags, DM_ACTIVE_PRESENT_FLAG); - dm_table_switch_tables(&dmv->table_head); DM_ADD_FLAG(flags, DM_EXISTS_FLAG); dmgetdisklabel(dmv->diskp->dk_label, &dmv->table_head); - - disk_attach(dmv->diskp); - dmgetdisklabel(dmv->diskp->dk_label, &dmv->table_head); prop_dictionary_set_uint32(dm_dict, DM_IOCTL_OPEN, dmv->table_head.io_cnt); prop_dictionary_set_uint32(dm_dict, DM_IOCTL_FLAGS, dmv->flags); |
