Conserve stack in zfs_sa_upgrade()
[zfs.git] / module / zfs / zfs_vfsops.c
index cb8c1d0..4e571ed 100644 (file)
@@ -65,6 +65,7 @@
 #include <sys/sa.h>
 #include "zfs_comutil.h"
 
+#ifdef HAVE_ZPL
 int zfsfstype;
 vfsops_t *zfs_vfsops = NULL;
 static major_t zfs_major;
@@ -74,11 +75,7 @@ static kmutex_t      zfs_dev_mtx;
 extern int sys_shutdown;
 
 static int zfs_mount(vfs_t *vfsp, vnode_t *mvp, struct mounta *uap, cred_t *cr);
-static int zfs_umount(vfs_t *vfsp, int fflag, cred_t *cr);
 static int zfs_mountroot(vfs_t *vfsp, enum whymountroot);
-static int zfs_root(vfs_t *vfsp, vnode_t **vpp);
-static int zfs_statvfs(vfs_t *vfsp, struct statvfs64 *statp);
-static int zfs_vget(vfs_t *vfsp, vnode_t **vpp, fid_t *fidp);
 static void zfs_freevfs(vfs_t *vfsp);
 
 static const fs_operation_def_t zfs_vfsops_template[] = {
@@ -180,6 +177,7 @@ zfs_sync(vfs_t *vfsp, short flag, cred_t *cr)
 
        return (0);
 }
+EXPORT_SYMBOL(zfs_sync);
 
 static int
 zfs_create_unique_device(dev_t *dev)
@@ -391,7 +389,7 @@ acl_inherit_changed_cb(void *arg, uint64_t newval)
        zfsvfs->z_acl_inherit = newval;
 }
 
-static int
+int
 zfs_register_callbacks(vfs_t *vfsp)
 {
        struct dsl_dataset *ds = NULL;
@@ -484,8 +482,8 @@ zfs_register_callbacks(vfs_t *vfsp)
                char osname[MAXNAMELEN];
 
                dmu_objset_name(os, osname);
-               if (error = dsl_prop_get_integer(osname, "nbmand", &nbmand,
-                   NULL)) {
+               if ((error = dsl_prop_get_integer(osname, "nbmand", &nbmand,
+                   NULL))) {
                        return (error);
                }
        }
@@ -560,6 +558,8 @@ unregister:
        return (error);
 
 }
+EXPORT_SYMBOL(zfs_register_callbacks);
+#endif /* HAVE_ZPL */
 
 static int
 zfs_space_delta_cb(dmu_object_type_t bonustype, void *data,
@@ -610,6 +610,7 @@ zfs_space_delta_cb(dmu_object_type_t bonustype, void *data,
        return (error);
 }
 
+#ifdef HAVE_ZPL
 static void
 fuidstr_to_sid(zfsvfs_t *zfsvfs, const char *fuidstr,
     char *domainbuf, int buflen, uid_t *ridp)
@@ -639,6 +640,8 @@ zfs_userquota_prop_to_obj(zfsvfs_t *zfsvfs, zfs_userquota_prop_t type)
                return (zfsvfs->z_userquota_obj);
        case ZFS_PROP_GROUPQUOTA:
                return (zfsvfs->z_groupquota_obj);
+       default:
+               return (ENOTSUP);
        }
        return (0);
 }
@@ -684,6 +687,7 @@ zfs_userspace_many(zfsvfs_t *zfsvfs, zfs_userquota_prop_t type,
        zap_cursor_fini(&zc);
        return (error);
 }
+EXPORT_SYMBOL(zfs_userspace_many);
 
 /*
  * buf must be big enough (eg, 32 bytes)
@@ -731,6 +735,7 @@ zfs_userspace_one(zfsvfs_t *zfsvfs, zfs_userquota_prop_t type,
                err = 0;
        return (err);
 }
+EXPORT_SYMBOL(zfs_userspace_one);
 
 int
 zfs_set_userquota(zfsvfs_t *zfsvfs, zfs_userquota_prop_t type,
@@ -792,6 +797,7 @@ zfs_set_userquota(zfsvfs_t *zfsvfs, zfs_userquota_prop_t type,
        dmu_tx_commit(tx);
        return (err);
 }
+EXPORT_SYMBOL(zfs_set_userquota);
 
 boolean_t
 zfs_fuid_overquota(zfsvfs_t *zfsvfs, boolean_t isgroup, uint64_t fuid)
@@ -816,6 +822,7 @@ zfs_fuid_overquota(zfsvfs_t *zfsvfs, boolean_t isgroup, uint64_t fuid)
                return (B_FALSE);
        return (used >= quota);
 }
+EXPORT_SYMBOL(zfs_fuid_overquota);
 
 boolean_t
 zfs_owner_overquota(zfsvfs_t *zfsvfs, znode_t *zp, boolean_t isgroup)
@@ -832,6 +839,7 @@ zfs_owner_overquota(zfsvfs_t *zfsvfs, znode_t *zp, boolean_t isgroup)
 
        return (zfs_fuid_overquota(zfsvfs, isgroup, fuid));
 }
+EXPORT_SYMBOL(zfs_owner_overquota);
 
 int
 zfsvfs_create(const char *osname, zfsvfs_t **zfvp)
@@ -870,7 +878,7 @@ zfsvfs_create(const char *osname, zfsvfs_t **zfvp)
                goto out;
        } else if (zfsvfs->z_version >
            zfs_zpl_version_map(spa_version(dmu_objset_spa(os)))) {
-               (void) printf("Can't mount a version %lld file system "
+               (void) printk("Can't mount a version %lld file system "
                    "on a version %lld pool\n. Pool must be upgraded to mount "
                    "this file system.", (u_longlong_t)zfsvfs->z_version,
                    (u_longlong_t)spa_version(dmu_objset_spa(os)));
@@ -1097,7 +1105,7 @@ zfs_set_fuid_feature(zfsvfs_t *zfsvfs)
        zfsvfs->z_use_sa = USE_SA(zfsvfs->z_version, zfsvfs->z_os);
 }
 
-static int
+int
 zfs_domount(vfs_t *vfsp, char *osname)
 {
        dev_t mount_dev;
@@ -1123,8 +1131,8 @@ zfs_domount(vfs_t *vfsp, char *osname)
        }
        ASSERT(vfs_devismounted(mount_dev) == 0);
 
-       if (error = dsl_prop_get_integer(osname, "recordsize", &recordsize,
-           NULL))
+       if ((error = dsl_prop_get_integer(osname, "recordsize",
+           &recordsize, NULL)))
                goto out;
 
        vfsp->vfs_dev = mount_dev;
@@ -1166,7 +1174,7 @@ zfs_domount(vfs_t *vfsp, char *osname)
 
                atime_changed_cb(zfsvfs, B_FALSE);
                readonly_changed_cb(zfsvfs, B_TRUE);
-               if (error = dsl_prop_get_integer(osname, "xattr", &pval, NULL))
+               if ((error = dsl_prop_get_integer(osname,"xattr",&pval,NULL)))
                        goto out;
                xattr_changed_cb(zfsvfs, pval);
                zfsvfs->z_issnap = B_TRUE;
@@ -1191,6 +1199,7 @@ out:
 
        return (error);
 }
+EXPORT_SYMBOL(zfs_domount);
 
 void
 zfs_unregister_callbacks(zfsvfs_t *zfsvfs)
@@ -1234,6 +1243,7 @@ zfs_unregister_callbacks(zfsvfs_t *zfsvfs)
                    vscan_changed_cb, zfsvfs) == 0);
        }
 }
+EXPORT_SYMBOL(zfs_unregister_callbacks);
 
 /*
  * Convert a decimal digit string to a uint64_t integer.
@@ -1562,7 +1572,7 @@ zfs_mount(vfs_t *vfsp, vnode_t *mvp, struct mounta *uap, cred_t *cr)
        /*
         * Get the objset name (the "special" mount argument).
         */
-       if (error = pn_get(uap->spec, fromspace, &spn))
+       if ((error = pn_get(uap->spec, fromspace, &spn)))
                return (error);
 
        osname = spn.pn_path;
@@ -1638,7 +1648,7 @@ out:
        return (error);
 }
 
-static int
+int
 zfs_statvfs(vfs_t *vfsp, struct statvfs64 *statp)
 {
        zfsvfs_t *zfsvfs = vfsp->vfs_data;
@@ -1701,8 +1711,9 @@ zfs_statvfs(vfs_t *vfsp, struct statvfs64 *statp)
        ZFS_EXIT(zfsvfs);
        return (0);
 }
+EXPORT_SYMBOL(zfs_statvfs);
 
-static int
+int
 zfs_root(vfs_t *vfsp, vnode_t **vpp)
 {
        zfsvfs_t *zfsvfs = vfsp->vfs_data;
@@ -1718,6 +1729,7 @@ zfs_root(vfs_t *vfsp, vnode_t **vpp)
        ZFS_EXIT(zfsvfs);
        return (error);
 }
+EXPORT_SYMBOL(zfs_root);
 
 /*
  * Teardown the zfsvfs::z_os.
@@ -1816,7 +1828,7 @@ zfsvfs_teardown(zfsvfs_t *zfsvfs, boolean_t unmounting)
 }
 
 /*ARGSUSED*/
-static int
+int
 zfs_umount(vfs_t *vfsp, int fflag, cred_t *cr)
 {
        zfsvfs_t *zfsvfs = vfsp->vfs_data;
@@ -1899,8 +1911,9 @@ zfs_umount(vfs_t *vfsp, int fflag, cred_t *cr)
 
        return (0);
 }
+EXPORT_SYMBOL(zfs_umount);
 
-static int
+int
 zfs_vget(vfs_t *vfsp, vnode_t **vpp, fid_t *fidp)
 {
        zfsvfs_t        *zfsvfs = vfsp->vfs_data;
@@ -1965,7 +1978,7 @@ zfs_vget(vfs_t *vfsp, vnode_t **vpp, fid_t *fidp)
        gen_mask = -1ULL >> (64 - 8 * i);
 
        dprintf("getting %llu [%u mask %llx]\n", object, fid_gen, gen_mask);
-       if (err = zfs_zget(zfsvfs, object, &zp)) {
+       if ((err = zfs_zget(zfsvfs, object, &zp))) {
                ZFS_EXIT(zfsvfs);
                return (err);
        }
@@ -1985,6 +1998,7 @@ zfs_vget(vfs_t *vfsp, vnode_t **vpp, fid_t *fidp)
        ZFS_EXIT(zfsvfs);
        return (0);
 }
+EXPORT_SYMBOL(zfs_vget);
 
 /*
  * Block out VOPs and close zfsvfs_t::z_os
@@ -2003,6 +2017,7 @@ zfs_suspend_fs(zfsvfs_t *zfsvfs)
 
        return (0);
 }
+EXPORT_SYMBOL(zfs_suspend_fs);
 
 /*
  * Reopen zfsvfs_t::z_os and release VOPs.
@@ -2066,6 +2081,7 @@ bail:
        }
        return (err);
 }
+EXPORT_SYMBOL(zfs_resume_fs);
 
 static void
 zfs_freevfs(vfs_t *vfsp)
@@ -2127,10 +2143,12 @@ zfs_vfsinit(int fstype, char *name)
 
        return (0);
 }
+#endif /* HAVE_ZPL */
 
 void
 zfs_init(void)
 {
+#ifdef HAVE_ZPL
        /*
         * Initialize .zfs directory structures
         */
@@ -2140,6 +2158,7 @@ zfs_init(void)
         * Initialize znode cache, vnode ops, etc...
         */
        zfs_znode_init();
+#endif /* HAVE_ZPL */
 
        dmu_objset_register_type(DMU_OST_ZFS, zfs_space_delta_cb);
 }
@@ -2147,16 +2166,13 @@ zfs_init(void)
 void
 zfs_fini(void)
 {
+#ifdef HAVE_ZPL
        zfsctl_fini();
        zfs_znode_fini();
+#endif /* HAVE_ZPL */
 }
 
-int
-zfs_busy(void)
-{
-       return (zfs_active_fs_count != 0);
-}
-
+#ifdef HAVE_ZPL
 int
 zfs_set_version(zfsvfs_t *zfsvfs, uint64_t newvers)
 {
@@ -2224,6 +2240,8 @@ zfs_set_version(zfsvfs_t *zfsvfs, uint64_t newvers)
 
        return (0);
 }
+EXPORT_SYMBOL(zfs_set_version);
+#endif /* HAVE_ZPL */
 
 /*
  * Read a property stored within the master node.
@@ -2267,6 +2285,7 @@ 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,
@@ -2279,3 +2298,4 @@ static vfsdef_t vfw = {
 struct modlfs zfs_modlfs = {
        &mod_fsops, "ZFS filesystem version " SPA_VERSION_STRING, &vfw
 };
+#endif /* HAVE_ZPL */