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_state_t *zv;
|
||||
struct dk_cinfo dki;
|
||||
struct dk_minfo dkm;
|
||||
struct dk_callback *dkc;
|
||||
int error = 0;
|
||||
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) {
|
||||
|
||||
case DKIOCINFO:
|
||||
{
|
||||
struct dk_cinfo dki;
|
||||
|
||||
bzero(&dki, sizeof (dki));
|
||||
(void) strcpy(dki.dki_cname, "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))
|
||||
error = SET_ERROR(EFAULT);
|
||||
return (error);
|
||||
}
|
||||
|
||||
case DKIOCGMEDIAINFO:
|
||||
{
|
||||
struct dk_minfo dkm;
|
||||
|
||||
bzero(&dkm, sizeof (dkm));
|
||||
dkm.dki_lbsize = 1U << 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))
|
||||
error = SET_ERROR(EFAULT);
|
||||
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:
|
||||
{
|
||||
uint64_t vs = zv->zv_volsize;
|
||||
uint8_t bs = zv->zv_min_bs;
|
||||
{
|
||||
uint64_t vs = zv->zv_volsize;
|
||||
uint8_t bs = zv->zv_min_bs;
|
||||
|
||||
mutex_exit(&zfsdev_state_lock);
|
||||
error = zvol_getefi((void *)arg, flag, vs, bs);
|
||||
return (error);
|
||||
}
|
||||
mutex_exit(&zfsdev_state_lock);
|
||||
error = zvol_getefi((void *)arg, flag, vs, bs);
|
||||
return (error);
|
||||
}
|
||||
|
||||
case DKIOCFLUSHWRITECACHE:
|
||||
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);
|
||||
|
||||
case DKIOCGETWCE:
|
||||
{
|
||||
int wce = (zv->zv_flags & ZVOL_WCE) ? 1 : 0;
|
||||
if (ddi_copyout(&wce, (void *)arg, sizeof (int),
|
||||
flag))
|
||||
error = SET_ERROR(EFAULT);
|
||||
{
|
||||
int wce = (zv->zv_flags & ZVOL_WCE) ? 1 : 0;
|
||||
if (ddi_copyout(&wce, (void *)arg, sizeof (int),
|
||||
flag))
|
||||
error = SET_ERROR(EFAULT);
|
||||
break;
|
||||
}
|
||||
case DKIOCSETWCE:
|
||||
{
|
||||
int wce;
|
||||
if (ddi_copyin((void *)arg, &wce, sizeof (int),
|
||||
flag)) {
|
||||
error = SET_ERROR(EFAULT);
|
||||
break;
|
||||
}
|
||||
case DKIOCSETWCE:
|
||||
{
|
||||
int wce;
|
||||
if (ddi_copyin((void *)arg, &wce, sizeof (int),
|
||||
flag)) {
|
||||
error = SET_ERROR(EFAULT);
|
||||
break;
|
||||
}
|
||||
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);
|
||||
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);
|
||||
}
|
||||
|
||||
case DKIOCGGEOM:
|
||||
case DKIOCGVTOC:
|
||||
|
Loading…
x
Reference in New Issue
Block a user