1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-21 11:13:30 +00:00

Changing provider size is not really supported by GEOM, but doing so when

provider is closed should be ok.

When administrator requests to change ZVOL size do it immediately if ZVOL
is closed or do it on last ZVOL close.

PR:		kern/136942
Requested by:	Bernard Buri <bsd@ask-us.at>
MFC after:	1 week
This commit is contained in:
Pawel Jakub Dawidek 2009-09-07 14:16:50 +00:00
parent 481208a815
commit 841bcfea21
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=196927

View File

@ -153,7 +153,22 @@ static int zvol_dump_init(zvol_state_t *zv, boolean_t resize);
static void
zvol_size_changed(zvol_state_t *zv, major_t maj)
{
struct g_provider *pp;
g_topology_assert();
pp = zv->zv_provider;
if (pp == NULL)
return;
if (zv->zv_volsize == pp->mediasize)
return;
/*
* Changing provider size is not really supported by GEOM, but it
* should be safe when provider is closed.
*/
if (zv->zv_total_opens > 0)
return;
pp->mediasize = zv->zv_volsize;
}
int
@ -263,6 +278,7 @@ zvol_access(struct g_provider *pp, int acr, int acw, int ace)
}
zv->zv_total_opens += acr + acw + ace;
zvol_size_changed(zv, 0);
mutex_exit(&zvol_state_lock);
@ -1072,11 +1088,6 @@ zvol_set_volblocksize(const char *name, uint64_t volblocksize)
if (error == ENOTSUP)
error = EBUSY;
dmu_tx_commit(tx);
/* XXX: Not supported. */
#if 0
if (error == 0)
zv->zv_provider->sectorsize = zc->zc_volblocksize;
#endif
}
end:
mutex_exit(&zvol_state_lock);