Deleted Added
full compact
zvol.c (196458) zvol.c (196927)
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

--- 139 unchanged lines hidden (view full) ---

148static int zvol_get_data(void *arg, lr_write_t *lr, char *buf, zio_t *zio);
149static int zvol_dumpify(zvol_state_t *zv);
150static int zvol_dump_fini(zvol_state_t *zv);
151static int zvol_dump_init(zvol_state_t *zv, boolean_t resize);
152
153static void
154zvol_size_changed(zvol_state_t *zv, major_t maj)
155{
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

--- 139 unchanged lines hidden (view full) ---

148static int zvol_get_data(void *arg, lr_write_t *lr, char *buf, zio_t *zio);
149static int zvol_dumpify(zvol_state_t *zv);
150static int zvol_dump_fini(zvol_state_t *zv);
151static int zvol_dump_init(zvol_state_t *zv, boolean_t resize);
152
153static void
154zvol_size_changed(zvol_state_t *zv, major_t maj)
155{
156 struct g_provider *pp;
156
157
158 g_topology_assert();
159
160 pp = zv->zv_provider;
161 if (pp == NULL)
162 return;
163 if (zv->zv_volsize == pp->mediasize)
164 return;
165 /*
166 * Changing provider size is not really supported by GEOM, but it
167 * should be safe when provider is closed.
168 */
169 if (zv->zv_total_opens > 0)
170 return;
171 pp->mediasize = zv->zv_volsize;
157}
158
159int
160zvol_check_volsize(uint64_t volsize, uint64_t blocksize)
161{
162 if (volsize == 0)
163 return (EINVAL);
164

--- 93 unchanged lines hidden (view full) ---

258 if (acw > 0 &&
259 ((zv->zv_flags & ZVOL_RDONLY) ||
260 (zv->zv_mode & DS_MODE_READONLY))) {
261 mutex_exit(&zvol_state_lock);
262 return (EROFS);
263 }
264
265 zv->zv_total_opens += acr + acw + ace;
172}
173
174int
175zvol_check_volsize(uint64_t volsize, uint64_t blocksize)
176{
177 if (volsize == 0)
178 return (EINVAL);
179

--- 93 unchanged lines hidden (view full) ---

273 if (acw > 0 &&
274 ((zv->zv_flags & ZVOL_RDONLY) ||
275 (zv->zv_mode & DS_MODE_READONLY))) {
276 mutex_exit(&zvol_state_lock);
277 return (EROFS);
278 }
279
280 zv->zv_total_opens += acr + acw + ace;
281 zvol_size_changed(zv, 0);
266
267 mutex_exit(&zvol_state_lock);
268
269 return (0);
270}
271
272/*
273 * zvol_log_write() handles synchronous writes using TX_WRITE ZIL transactions.

--- 793 unchanged lines hidden (view full) ---

1067 if (error) {
1068 dmu_tx_abort(tx);
1069 } else {
1070 error = dmu_object_set_blocksize(zv->zv_objset, ZVOL_OBJ,
1071 volblocksize, 0, tx);
1072 if (error == ENOTSUP)
1073 error = EBUSY;
1074 dmu_tx_commit(tx);
282
283 mutex_exit(&zvol_state_lock);
284
285 return (0);
286}
287
288/*
289 * zvol_log_write() handles synchronous writes using TX_WRITE ZIL transactions.

--- 793 unchanged lines hidden (view full) ---

1083 if (error) {
1084 dmu_tx_abort(tx);
1085 } else {
1086 error = dmu_object_set_blocksize(zv->zv_objset, ZVOL_OBJ,
1087 volblocksize, 0, tx);
1088 if (error == ENOTSUP)
1089 error = EBUSY;
1090 dmu_tx_commit(tx);
1075 /* XXX: Not supported. */
1076#if 0
1077 if (error == 0)
1078 zv->zv_provider->sectorsize = zc->zc_volblocksize;
1079#endif
1080 }
1081end:
1082 mutex_exit(&zvol_state_lock);
1083 g_topology_unlock();
1084 PICKUP_GIANT();
1085
1086 return (error);
1087}

--- 310 unchanged lines hidden ---
1091 }
1092end:
1093 mutex_exit(&zvol_state_lock);
1094 g_topology_unlock();
1095 PICKUP_GIANT();
1096
1097 return (error);
1098}

--- 310 unchanged lines hidden ---