git://git.camperquake.de
/
zfs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Remove inconsistent use of EOPNOTSUPP
[zfs.git]
/
module
/
zfs
/
vdev_file.c
diff --git
a/module/zfs/vdev_file.c
b/module/zfs/vdev_file.c
index
dc0e920
..
f31389a
100644
(file)
--- a/
module/zfs/vdev_file.c
+++ b/
module/zfs/vdev_file.c
@@
-19,8
+19,7
@@
* CDDL HEADER END
*/
/*
* CDDL HEADER END
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
+ * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
*/
#include <sys/zfs_context.h>
*/
#include <sys/zfs_context.h>
@@
-35,6
+34,18
@@
* Virtual device vector for files.
*/
* Virtual device vector for files.
*/
+static void
+vdev_file_hold(vdev_t *vd)
+{
+ ASSERT(vd->vdev_path != NULL);
+}
+
+static void
+vdev_file_rele(vdev_t *vd)
+{
+ ASSERT(vd->vdev_path != NULL);
+}
+
static int
vdev_file_open(vdev_t *vd, uint64_t *psize, uint64_t *ashift)
{
static int
vdev_file_open(vdev_t *vd, uint64_t *psize, uint64_t *ashift)
{
@@
-51,6
+62,16
@@
vdev_file_open(vdev_t *vd, uint64_t *psize, uint64_t *ashift)
return (EINVAL);
}
return (EINVAL);
}
+ /*
+ * Reopen the device if it's not currently open. Otherwise,
+ * just update the physical size of the device.
+ */
+ if (vd->vdev_tsd != NULL) {
+ ASSERT(vd->vdev_reopening);
+ vf = vd->vdev_tsd;
+ goto skip_open;
+ }
+
vf = vd->vdev_tsd = kmem_zalloc(sizeof (vdev_file_t), KM_SLEEP);
/*
vf = vd->vdev_tsd = kmem_zalloc(sizeof (vdev_file_t), KM_SLEEP);
/*
@@
-61,7
+82,7
@@
vdev_file_open(vdev_t *vd, uint64_t *psize, uint64_t *ashift)
*/
ASSERT(vd->vdev_path != NULL && vd->vdev_path[0] == '/');
error = vn_openat(vd->vdev_path + 1, UIO_SYSSPACE,
*/
ASSERT(vd->vdev_path != NULL && vd->vdev_path[0] == '/');
error = vn_openat(vd->vdev_path + 1, UIO_SYSSPACE,
- spa_mode | FOFFMAX, 0, &vp, 0, 0, rootdir, -1);
+ spa_mode
(vd->vdev_spa)
| FOFFMAX, 0, &vp, 0, 0, rootdir, -1);
if (error) {
vd->vdev_stat.vs_aux = VDEV_AUX_OPEN_FAILED;
if (error) {
vd->vdev_stat.vs_aux = VDEV_AUX_OPEN_FAILED;
@@
-79,6
+100,8
@@
vdev_file_open(vdev_t *vd, uint64_t *psize, uint64_t *ashift)
return (ENODEV);
}
#endif
return (ENODEV);
}
#endif
+
+skip_open:
/*
* Determine the physical size of the file.
*/
/*
* Determine the physical size of the file.
*/
@@
-100,15
+123,17
@@
vdev_file_close(vdev_t *vd)
{
vdev_file_t *vf = vd->vdev_tsd;
{
vdev_file_t *vf = vd->vdev_tsd;
- if (vf == NULL)
+ if (v
d->vdev_reopening || v
f == NULL)
return;
if (vf->vf_vnode != NULL) {
(void) VOP_PUTPAGE(vf->vf_vnode, 0, 0, B_INVAL, kcred, NULL);
return;
if (vf->vf_vnode != NULL) {
(void) VOP_PUTPAGE(vf->vf_vnode, 0, 0, B_INVAL, kcred, NULL);
- (void) VOP_CLOSE(vf->vf_vnode, spa_mode, 1, 0, kcred, NULL);
+ (void) VOP_CLOSE(vf->vf_vnode, spa_mode(vd->vdev_spa), 1, 0,
+ kcred, NULL);
VN_RELE(vf->vf_vnode);
}
VN_RELE(vf->vf_vnode);
}
+ vd->vdev_delayed_close = B_FALSE;
kmem_free(vf, sizeof (vdev_file_t));
vd->vdev_tsd = NULL;
}
kmem_free(vf, sizeof (vdev_file_t));
vd->vdev_tsd = NULL;
}
@@
-118,7
+143,7
@@
vdev_file_io_start(zio_t *zio)
{
vdev_t *vd = zio->io_vd;
vdev_file_t *vf = vd->vdev_tsd;
{
vdev_t *vd = zio->io_vd;
vdev_file_t *vf = vd->vdev_tsd;
- ssize_t resid;
+ ssize_t resid
= 0
;
if (zio->io_type == ZIO_TYPE_IOCTL) {
/* XXPOLICY */
if (zio->io_type == ZIO_TYPE_IOCTL) {
/* XXPOLICY */
@@
-165,6
+190,8
@@
vdev_ops_t vdev_file_ops = {
vdev_file_io_start,
vdev_file_io_done,
NULL,
vdev_file_io_start,
vdev_file_io_done,
NULL,
+ vdev_file_hold,
+ vdev_file_rele,
VDEV_TYPE_FILE, /* name of this vdev type */
B_TRUE /* leaf vdev */
};
VDEV_TYPE_FILE, /* name of this vdev type */
B_TRUE /* leaf vdev */
};
@@
-181,6
+208,8
@@
vdev_ops_t vdev_disk_ops = {
vdev_file_io_start,
vdev_file_io_done,
NULL,
vdev_file_io_start,
vdev_file_io_done,
NULL,
+ vdev_file_hold,
+ vdev_file_rele,
VDEV_TYPE_DISK, /* name of this vdev type */
B_TRUE /* leaf vdev */
};
VDEV_TYPE_DISK, /* name of this vdev type */
B_TRUE /* leaf vdev */
};