mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-26 03:09:34 +03:00
Remove Solaris VFS Hooks
The ZFS code is being restructured to act as a library and a stand alone module. This allows us to leverage most of the existing code with minimal modification. It also means we need to drop the Solaris vfs/vnode functions they will be replaced by Linux equivilants and updated to be Linux friendly.
This commit is contained in:
parent
960e08fe3e
commit
4b3f12ecd5
@ -128,15 +128,6 @@ static vnode_t *zfsctl_mknode_shares(vnode_t *);
|
||||
static vnode_t *zfsctl_snapshot_mknode(vnode_t *, uint64_t objset);
|
||||
static int zfsctl_unmount_snap(zfs_snapentry_t *, int, cred_t *);
|
||||
|
||||
static gfs_opsvec_t zfsctl_opsvec[] = {
|
||||
{ ".zfs", zfsctl_tops_root, &zfsctl_ops_root },
|
||||
{ ".zfs/snapshot", zfsctl_tops_snapdir, &zfsctl_ops_snapdir },
|
||||
{ ".zfs/snapshot/vnode", zfsctl_tops_snapshot, &zfsctl_ops_snapshot },
|
||||
{ ".zfs/shares", zfsctl_tops_shares, &zfsctl_ops_shares_dir },
|
||||
{ ".zfs/shares/vnode", zfsctl_tops_shares, &zfsctl_ops_shares },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
/*
|
||||
* Root directory elements. We only have two entries
|
||||
* snapshot and shares.
|
||||
@ -160,7 +151,6 @@ static gfs_dirent_t zfsctl_root_entries[] = {
|
||||
void
|
||||
zfsctl_init(void)
|
||||
{
|
||||
VERIFY(gfs_make_opsvec(zfsctl_opsvec) == 0);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -67,7 +67,6 @@
|
||||
|
||||
#ifdef HAVE_ZPL
|
||||
int zfsfstype;
|
||||
vfsops_t *zfs_vfsops = NULL;
|
||||
static major_t zfs_major;
|
||||
static minor_t zfs_minor;
|
||||
static kmutex_t zfs_dev_mtx;
|
||||
@ -78,23 +77,6 @@ static int zfs_mount(vfs_t *vfsp, vnode_t *mvp, struct mounta *uap, cred_t *cr);
|
||||
static int zfs_mountroot(vfs_t *vfsp, enum whymountroot);
|
||||
static void zfs_freevfs(vfs_t *vfsp);
|
||||
|
||||
static const fs_operation_def_t zfs_vfsops_template[] = {
|
||||
VFSNAME_MOUNT, { .vfs_mount = zfs_mount },
|
||||
VFSNAME_MOUNTROOT, { .vfs_mountroot = zfs_mountroot },
|
||||
VFSNAME_UNMOUNT, { .vfs_unmount = zfs_umount },
|
||||
VFSNAME_ROOT, { .vfs_root = zfs_root },
|
||||
VFSNAME_STATVFS, { .vfs_statvfs = zfs_statvfs },
|
||||
VFSNAME_SYNC, { .vfs_sync = zfs_sync },
|
||||
VFSNAME_VGET, { .vfs_vget = zfs_vget },
|
||||
VFSNAME_FREEVFS, { .vfs_freevfs = zfs_freevfs },
|
||||
NULL, NULL
|
||||
};
|
||||
|
||||
static const fs_operation_def_t zfs_vfsops_eio_template[] = {
|
||||
VFSNAME_FREEVFS, { .vfs_freevfs = zfs_freevfs },
|
||||
NULL, NULL
|
||||
};
|
||||
|
||||
/*
|
||||
* We need to keep a count of active fs's.
|
||||
* This is necessary to prevent our module
|
||||
@ -2065,23 +2047,6 @@ zfs_vfsinit(int fstype, char *name)
|
||||
int error;
|
||||
|
||||
zfsfstype = fstype;
|
||||
|
||||
/*
|
||||
* Setup vfsops and vnodeops tables.
|
||||
*/
|
||||
error = vfs_setfsops(fstype, zfs_vfsops_template, &zfs_vfsops);
|
||||
if (error != 0) {
|
||||
cmn_err(CE_WARN, "zfs: bad vfs ops template");
|
||||
}
|
||||
|
||||
error = zfs_create_op_tables();
|
||||
if (error) {
|
||||
zfs_remove_op_tables();
|
||||
cmn_err(CE_WARN, "zfs: bad vnode ops template");
|
||||
(void) vfs_freevfsops_by_type(zfsfstype);
|
||||
return (error);
|
||||
}
|
||||
|
||||
mutex_init(&zfs_dev_mtx, NULL, MUTEX_DEFAULT, NULL);
|
||||
|
||||
/*
|
||||
@ -2234,18 +2199,3 @@ zfs_get_zplprop(objset_t *os, zfs_prop_t prop, uint64_t *value)
|
||||
}
|
||||
return (error);
|
||||
}
|
||||
|
||||
#ifdef HAVE_ZPL
|
||||
static vfsdef_t vfw = {
|
||||
VFSDEF_VERSION,
|
||||
MNTTYPE_ZFS,
|
||||
zfs_vfsinit,
|
||||
VSW_HASPROTO|VSW_CANRWRO|VSW_CANREMOUNT|VSW_VOLATILEDEV|VSW_STATS|
|
||||
VSW_XID|VSW_ZMOUNT,
|
||||
&zfs_mntopts
|
||||
};
|
||||
|
||||
struct modlfs zfs_modlfs = {
|
||||
&mod_fsops, "ZFS filesystem version " SPA_VERSION_STRING, &vfw
|
||||
};
|
||||
#endif /* HAVE_ZPL */
|
||||
|
@ -164,13 +164,6 @@ zfs_znode_init(void)
|
||||
void
|
||||
zfs_znode_fini(void)
|
||||
{
|
||||
/*
|
||||
* Cleanup vfs & vnode ops
|
||||
*/
|
||||
#ifdef HAVE_ZPL
|
||||
zfs_remove_op_tables();
|
||||
#endif /* HAVE_ZPL */
|
||||
|
||||
/*
|
||||
* Cleanup zcache
|
||||
*/
|
||||
@ -181,98 +174,6 @@ zfs_znode_fini(void)
|
||||
}
|
||||
|
||||
#ifdef HAVE_ZPL
|
||||
struct vnodeops *zfs_dvnodeops;
|
||||
struct vnodeops *zfs_fvnodeops;
|
||||
struct vnodeops *zfs_symvnodeops;
|
||||
struct vnodeops *zfs_xdvnodeops;
|
||||
struct vnodeops *zfs_evnodeops;
|
||||
struct vnodeops *zfs_sharevnodeops;
|
||||
|
||||
void
|
||||
zfs_remove_op_tables()
|
||||
{
|
||||
/*
|
||||
* Remove vfs ops
|
||||
*/
|
||||
ASSERT(zfsfstype);
|
||||
(void) vfs_freevfsops_by_type(zfsfstype);
|
||||
zfsfstype = 0;
|
||||
|
||||
/*
|
||||
* Remove vnode ops
|
||||
*/
|
||||
if (zfs_dvnodeops)
|
||||
vn_freevnodeops(zfs_dvnodeops);
|
||||
if (zfs_fvnodeops)
|
||||
vn_freevnodeops(zfs_fvnodeops);
|
||||
if (zfs_symvnodeops)
|
||||
vn_freevnodeops(zfs_symvnodeops);
|
||||
if (zfs_xdvnodeops)
|
||||
vn_freevnodeops(zfs_xdvnodeops);
|
||||
if (zfs_evnodeops)
|
||||
vn_freevnodeops(zfs_evnodeops);
|
||||
if (zfs_sharevnodeops)
|
||||
vn_freevnodeops(zfs_sharevnodeops);
|
||||
|
||||
zfs_dvnodeops = NULL;
|
||||
zfs_fvnodeops = NULL;
|
||||
zfs_symvnodeops = NULL;
|
||||
zfs_xdvnodeops = NULL;
|
||||
zfs_evnodeops = NULL;
|
||||
zfs_sharevnodeops = NULL;
|
||||
}
|
||||
|
||||
extern const fs_operation_def_t zfs_dvnodeops_template[];
|
||||
extern const fs_operation_def_t zfs_fvnodeops_template[];
|
||||
extern const fs_operation_def_t zfs_xdvnodeops_template[];
|
||||
extern const fs_operation_def_t zfs_symvnodeops_template[];
|
||||
extern const fs_operation_def_t zfs_evnodeops_template[];
|
||||
extern const fs_operation_def_t zfs_sharevnodeops_template[];
|
||||
|
||||
int
|
||||
zfs_create_op_tables()
|
||||
{
|
||||
int error;
|
||||
|
||||
/*
|
||||
* zfs_dvnodeops can be set if mod_remove() calls mod_installfs()
|
||||
* due to a failure to remove the the 2nd modlinkage (zfs_modldrv).
|
||||
* In this case we just return as the ops vectors are already set up.
|
||||
*/
|
||||
if (zfs_dvnodeops)
|
||||
return (0);
|
||||
|
||||
error = vn_make_ops(MNTTYPE_ZFS, zfs_dvnodeops_template,
|
||||
&zfs_dvnodeops);
|
||||
if (error)
|
||||
return (error);
|
||||
|
||||
error = vn_make_ops(MNTTYPE_ZFS, zfs_fvnodeops_template,
|
||||
&zfs_fvnodeops);
|
||||
if (error)
|
||||
return (error);
|
||||
|
||||
error = vn_make_ops(MNTTYPE_ZFS, zfs_symvnodeops_template,
|
||||
&zfs_symvnodeops);
|
||||
if (error)
|
||||
return (error);
|
||||
|
||||
error = vn_make_ops(MNTTYPE_ZFS, zfs_xdvnodeops_template,
|
||||
&zfs_xdvnodeops);
|
||||
if (error)
|
||||
return (error);
|
||||
|
||||
error = vn_make_ops(MNTTYPE_ZFS, zfs_evnodeops_template,
|
||||
&zfs_evnodeops);
|
||||
if (error)
|
||||
return (error);
|
||||
|
||||
error = vn_make_ops(MNTTYPE_ZFS, zfs_sharevnodeops_template,
|
||||
&zfs_sharevnodeops);
|
||||
|
||||
return (error);
|
||||
}
|
||||
|
||||
int
|
||||
zfs_create_share_dir(zfsvfs_t *zfsvfs, dmu_tx_t *tx)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user