3580 Want zvols to return volblocksize when queried for physical block size
illumos/illumos-gate@a0b60564df
This commit is contained in:
parent
69dd9f346a
commit
432048d130
@ -1627,8 +1627,6 @@ int
|
|||||||
zvol_ioctl(dev_t dev, int cmd, intptr_t arg, int flag, cred_t *cr, int *rvalp)
|
zvol_ioctl(dev_t dev, int cmd, intptr_t arg, int flag, cred_t *cr, int *rvalp)
|
||||||
{
|
{
|
||||||
zvol_state_t *zv;
|
zvol_state_t *zv;
|
||||||
struct dk_cinfo dki;
|
|
||||||
struct dk_minfo dkm;
|
|
||||||
struct dk_callback *dkc;
|
struct dk_callback *dkc;
|
||||||
int error = 0;
|
int error = 0;
|
||||||
rl_t *rl;
|
rl_t *rl;
|
||||||
@ -1646,6 +1644,9 @@ zvol_ioctl(dev_t dev, int cmd, intptr_t arg, int flag, cred_t *cr, int *rvalp)
|
|||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
|
|
||||||
case DKIOCINFO:
|
case DKIOCINFO:
|
||||||
|
{
|
||||||
|
struct dk_cinfo dki;
|
||||||
|
|
||||||
bzero(&dki, sizeof (dki));
|
bzero(&dki, sizeof (dki));
|
||||||
(void) strcpy(dki.dki_cname, "zvol");
|
(void) strcpy(dki.dki_cname, "zvol");
|
||||||
(void) strcpy(dki.dki_dname, "zvol");
|
(void) strcpy(dki.dki_dname, "zvol");
|
||||||
@ -1656,8 +1657,12 @@ zvol_ioctl(dev_t dev, int cmd, intptr_t arg, int flag, cred_t *cr, int *rvalp)
|
|||||||
if (ddi_copyout(&dki, (void *)arg, sizeof (dki), flag))
|
if (ddi_copyout(&dki, (void *)arg, sizeof (dki), flag))
|
||||||
error = SET_ERROR(EFAULT);
|
error = SET_ERROR(EFAULT);
|
||||||
return (error);
|
return (error);
|
||||||
|
}
|
||||||
|
|
||||||
case DKIOCGMEDIAINFO:
|
case DKIOCGMEDIAINFO:
|
||||||
|
{
|
||||||
|
struct dk_minfo dkm;
|
||||||
|
|
||||||
bzero(&dkm, sizeof (dkm));
|
bzero(&dkm, sizeof (dkm));
|
||||||
dkm.dki_lbsize = 1U << zv->zv_min_bs;
|
dkm.dki_lbsize = 1U << zv->zv_min_bs;
|
||||||
dkm.dki_capacity = zv->zv_volsize >> zv->zv_min_bs;
|
dkm.dki_capacity = zv->zv_volsize >> zv->zv_min_bs;
|
||||||
@ -1666,16 +1671,32 @@ zvol_ioctl(dev_t dev, int cmd, intptr_t arg, int flag, cred_t *cr, int *rvalp)
|
|||||||
if (ddi_copyout(&dkm, (void *)arg, sizeof (dkm), flag))
|
if (ddi_copyout(&dkm, (void *)arg, sizeof (dkm), flag))
|
||||||
error = SET_ERROR(EFAULT);
|
error = SET_ERROR(EFAULT);
|
||||||
return (error);
|
return (error);
|
||||||
|
}
|
||||||
|
|
||||||
|
case DKIOCGMEDIAINFOEXT:
|
||||||
|
{
|
||||||
|
struct dk_minfo_ext dkmext;
|
||||||
|
|
||||||
|
bzero(&dkmext, sizeof (dkmext));
|
||||||
|
dkmext.dki_lbsize = 1U << zv->zv_min_bs;
|
||||||
|
dkmext.dki_pbsize = zv->zv_volblocksize;
|
||||||
|
dkmext.dki_capacity = zv->zv_volsize >> zv->zv_min_bs;
|
||||||
|
dkmext.dki_media_type = DK_UNKNOWN;
|
||||||
|
mutex_exit(&zfsdev_state_lock);
|
||||||
|
if (ddi_copyout(&dkmext, (void *)arg, sizeof (dkmext), flag))
|
||||||
|
error = SET_ERROR(EFAULT);
|
||||||
|
return (error);
|
||||||
|
}
|
||||||
|
|
||||||
case DKIOCGETEFI:
|
case DKIOCGETEFI:
|
||||||
{
|
{
|
||||||
uint64_t vs = zv->zv_volsize;
|
uint64_t vs = zv->zv_volsize;
|
||||||
uint8_t bs = zv->zv_min_bs;
|
uint8_t bs = zv->zv_min_bs;
|
||||||
|
|
||||||
mutex_exit(&zfsdev_state_lock);
|
mutex_exit(&zfsdev_state_lock);
|
||||||
error = zvol_getefi((void *)arg, flag, vs, bs);
|
error = zvol_getefi((void *)arg, flag, vs, bs);
|
||||||
return (error);
|
return (error);
|
||||||
}
|
}
|
||||||
|
|
||||||
case DKIOCFLUSHWRITECACHE:
|
case DKIOCFLUSHWRITECACHE:
|
||||||
dkc = (struct dk_callback *)arg;
|
dkc = (struct dk_callback *)arg;
|
||||||
@ -1688,31 +1709,31 @@ zvol_ioctl(dev_t dev, int cmd, intptr_t arg, int flag, cred_t *cr, int *rvalp)
|
|||||||
return (error);
|
return (error);
|
||||||
|
|
||||||
case DKIOCGETWCE:
|
case DKIOCGETWCE:
|
||||||
{
|
{
|
||||||
int wce = (zv->zv_flags & ZVOL_WCE) ? 1 : 0;
|
int wce = (zv->zv_flags & ZVOL_WCE) ? 1 : 0;
|
||||||
if (ddi_copyout(&wce, (void *)arg, sizeof (int),
|
if (ddi_copyout(&wce, (void *)arg, sizeof (int),
|
||||||
flag))
|
flag))
|
||||||
error = SET_ERROR(EFAULT);
|
error = SET_ERROR(EFAULT);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case DKIOCSETWCE:
|
||||||
|
{
|
||||||
|
int wce;
|
||||||
|
if (ddi_copyin((void *)arg, &wce, sizeof (int),
|
||||||
|
flag)) {
|
||||||
|
error = SET_ERROR(EFAULT);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case DKIOCSETWCE:
|
if (wce) {
|
||||||
{
|
zv->zv_flags |= ZVOL_WCE;
|
||||||
int wce;
|
mutex_exit(&zfsdev_state_lock);
|
||||||
if (ddi_copyin((void *)arg, &wce, sizeof (int),
|
} else {
|
||||||
flag)) {
|
zv->zv_flags &= ~ZVOL_WCE;
|
||||||
error = SET_ERROR(EFAULT);
|
mutex_exit(&zfsdev_state_lock);
|
||||||
break;
|
zil_commit(zv->zv_zilog, ZVOL_OBJ);
|
||||||
}
|
|
||||||
if (wce) {
|
|
||||||
zv->zv_flags |= ZVOL_WCE;
|
|
||||||
mutex_exit(&zfsdev_state_lock);
|
|
||||||
} else {
|
|
||||||
zv->zv_flags &= ~ZVOL_WCE;
|
|
||||||
mutex_exit(&zfsdev_state_lock);
|
|
||||||
zil_commit(zv->zv_zilog, ZVOL_OBJ);
|
|
||||||
}
|
|
||||||
return (0);
|
|
||||||
}
|
}
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
case DKIOCGGEOM:
|
case DKIOCGGEOM:
|
||||||
case DKIOCGVTOC:
|
case DKIOCGVTOC:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user