From b38252d3eca74421e35124d4fffeab6fc099e47e Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Sun, 15 Nov 2009 15:52:29 -0800 Subject: [PATCH] Revert contents of linux-have-zvol topic branch. --- lib/libzfs/libzfs_dataset.c | 10 ---------- lib/libzfs/libzfs_pool.c | 4 +--- module/zfs/dsl_dataset.c | 2 -- module/zfs/zfs_ioctl.c | 33 +-------------------------------- module/zfs/zvol.c | 35 +---------------------------------- 5 files changed, 3 insertions(+), 81 deletions(-) diff --git a/lib/libzfs/libzfs_dataset.c b/lib/libzfs/libzfs_dataset.c index 30765cef7d..899ffdaaed 100644 --- a/lib/libzfs/libzfs_dataset.c +++ b/lib/libzfs/libzfs_dataset.c @@ -3631,11 +3631,6 @@ zvol_create_link(libzfs_handle_t *hdl, const char *dataset) static int zvol_create_link_common(libzfs_handle_t *hdl, const char *dataset, int ifexists) { -#if !defined(HAVE_ZVOL) - return (zfs_standard_error_fmt(hdl, ENOTSUP, - dgettext(TEXT_DOMAIN, "cannot create device links " - "for '%s'"), dataset)); -#else zfs_cmd_t zc = { "\0", "\0", "\0", 0 }; di_devlink_handle_t dhdl; priv_set_t *priv_effective; @@ -3724,7 +3719,6 @@ zvol_create_link_common(libzfs_handle_t *hdl, const char *dataset, int ifexists) } return (0); -#endif } /* @@ -3861,9 +3855,6 @@ zfs_expand_proplist(zfs_handle_t *zhp, zprop_list_t **plp) int zfs_iscsi_perm_check(libzfs_handle_t *hdl, char *dataset, ucred_t *cred) { -#if !defined(HAVE_ZVOL) - return (ENOTSUP); -#else zfs_cmd_t zc = { "\0", "\0", "\0", 0 }; nvlist_t *nvp; gid_t gid; @@ -3905,7 +3896,6 @@ zfs_iscsi_perm_check(libzfs_handle_t *hdl, char *dataset, ucred_t *cred) error = ioctl(hdl->libzfs_fd, ZFS_IOC_ISCSI_PERM_CHECK, &zc); nvlist_free(nvp); return (error); -#endif } int diff --git a/lib/libzfs/libzfs_pool.c b/lib/libzfs/libzfs_pool.c index be8d414942..b8989a026e 100644 --- a/lib/libzfs/libzfs_pool.c +++ b/lib/libzfs/libzfs_pool.c @@ -2358,7 +2358,6 @@ int zpool_iter_zvol(zpool_handle_t *zhp, int (*cb)(const char *, void *), void *data) { -#ifdef HAVE_ZVOL libzfs_handle_t *hdl = zhp->zpool_hdl; char (*paths)[MAXPATHLEN]; size_t size = 4; @@ -2450,8 +2449,7 @@ zpool_iter_zvol(zpool_handle_t *zhp, int (*cb)(const char *, void *), err: free(paths); (void) close(base); -#endif - return (0); + return (-1); } typedef struct zvol_cb { diff --git a/module/zfs/dsl_dataset.c b/module/zfs/dsl_dataset.c index 397ea3149e..9260348369 100644 --- a/module/zfs/dsl_dataset.c +++ b/module/zfs/dsl_dataset.c @@ -973,10 +973,8 @@ dsl_dataset_zvol_cleanup(dsl_dataset_t *ds, const char *name) if (error) return (error); -#ifdef HAVE_ZVOL if (dmu_objset_type(os) == DMU_OST_ZVOL) error = zvol_remove_minor(name); -#endif /* HAVE_ZVOL */ dmu_objset_close(os); return (error); diff --git a/module/zfs/zfs_ioctl.c b/module/zfs/zfs_ioctl.c index 7c6f0976ae..b039414dbe 100644 --- a/module/zfs/zfs_ioctl.c +++ b/module/zfs/zfs_ioctl.c @@ -1779,7 +1779,6 @@ zfs_set_prop_nvlist(const char *name, nvlist_t *nvl) goto out; break; -#ifdef HAVE_ZVOL case ZFS_PROP_VOLSIZE: if ((error = nvpair_value_uint64(elem, &intval)) != 0 || (error = zvol_set_volsize(name, @@ -1792,11 +1791,6 @@ zfs_set_prop_nvlist(const char *name, nvlist_t *nvl) (error = zvol_set_volblocksize(name, intval)) != 0) goto out; break; -#else - case ZFS_PROP_VOLSIZE: - case ZFS_PROP_VOLBLOCKSIZE: - return (ENOTSUP); -#endif /* HAVE_ZVOL */ case ZFS_PROP_VERSION: { @@ -2153,11 +2147,7 @@ zfs_ioc_get_fsacl(zfs_cmd_t *zc) static int zfs_ioc_create_minor(zfs_cmd_t *zc) { -#ifdef HAVE_ZVOL return (zvol_create_minor(zc->zc_name, ddi_driver_major(zfs_dip))); -#else - return (ENOTSUP); -#endif /* HAVE_ZVOL */ } /* @@ -2169,11 +2159,7 @@ zfs_ioc_create_minor(zfs_cmd_t *zc) static int zfs_ioc_remove_minor(zfs_cmd_t *zc) { -#ifdef HAVE_ZVOL return (zvol_remove_minor(zc->zc_name)); -#else - return (ENOTSUP); -#endif /* HAVE_ZVOL */ } /* @@ -2387,11 +2373,9 @@ zfs_ioc_create(zfs_cmd_t *zc) cbfunc = zfs_create_cb; break; -#ifdef HAVE_ZVOL case DMU_OST_ZVOL: cbfunc = zvol_create_cb; break; -#endif /* HAVE_ZVOL */ default: cbfunc = NULL; @@ -2442,7 +2426,6 @@ zfs_ioc_create(zfs_cmd_t *zc) return (EINVAL); } -#ifdef HAVE_ZVOL if (type == DMU_OST_ZVOL) { uint64_t volsize, volblocksize; @@ -2472,9 +2455,7 @@ zfs_ioc_create(zfs_cmd_t *zc) nvlist_free(nvprops); return (error); } - } else -#endif /* HAVE_ZVOL */ - if (type == DMU_OST_ZFS) { + } else if (type == DMU_OST_ZFS) { int error; /* @@ -3658,10 +3639,8 @@ zfsdev_ioctl(dev_t dev, int cmd, intptr_t arg, int flag, cred_t *cr, int *rvalp) uint_t vec; int error, rc; -#ifdef HAVE_ZVOL if (getminor(dev) != 0) return (zvol_ioctl(dev, cmd, arg, flag, cr, rvalp)); -#endif vec = cmd - ZFS_IOC; ASSERT3U(getmajor(dev), ==, ddi_driver_major(zfs_dip)); @@ -3780,7 +3759,6 @@ zfs_info(dev_info_t *dip, ddi_info_cmd_t infocmd, void *arg, void **result) * so most of the standard driver entry points are in zvol.c. */ static struct cb_ops zfs_cb_ops = { -#ifdef HAVE_ZVOL zvol_open, /* open */ zvol_close, /* close */ zvol_strategy, /* strategy */ @@ -3788,15 +3766,6 @@ static struct cb_ops zfs_cb_ops = { zvol_dump, /* dump */ zvol_read, /* read */ zvol_write, /* write */ -#else - nodev, /* open */ - nodev, /* close */ - nodev, /* strategy */ - nodev, /* print */ - nodev, /* dump */ - nodev, /* read */ - nodev, /* write */ -#endif /* HAVE_ZVOL */ zfsdev_ioctl, /* ioctl */ nodev, /* devmap */ nodev, /* mmap */ diff --git a/module/zfs/zvol.c b/module/zfs/zvol.c index 9b34c0ead1..cfd3b3dbdb 100644 --- a/module/zfs/zvol.c +++ b/module/zfs/zvol.c @@ -77,14 +77,8 @@ #include #include -#ifdef HAVE_SPL -#include -#include -#endif - #include "zfs_namecheck.h" -#ifdef HAVE_ZVOL static void *zvol_state; #define ZVOL_DUMPSIZE "dumpsize" @@ -156,7 +150,6 @@ zvol_size_changed(zvol_state_t *zv, major_t maj) spec_size_invalidate(dev, VBLK); spec_size_invalidate(dev, VCHR); } -#endif /* HAVE_ZVOL */ int zvol_check_volsize(uint64_t volsize, uint64_t blocksize) @@ -167,22 +160,10 @@ zvol_check_volsize(uint64_t volsize, uint64_t blocksize) if (volsize % blocksize != 0) return (EINVAL); -#ifdef HAVE_SPL - if (volsize % 512 != 0) - return (EINVAL); - - /* - * On Linux, the maximum allowed block device size depends on the size - * of sector_t. - */ - if (fls64(volsize / 512 - 1) > NBBY * sizeof (sector_t)) - return (EOVERFLOW); - -#elif defined(_ILP32) +#ifdef _ILP32 if (volsize - 1 > SPEC_MAXOFFSET_T) return (EOVERFLOW); #endif - return (0); } @@ -197,7 +178,6 @@ zvol_check_volblocksize(uint64_t volblocksize) return (0); } -#ifdef HAVE_ZVOL static void zvol_readonly_changed_cb(void *arg, uint64_t newval) { @@ -208,7 +188,6 @@ zvol_readonly_changed_cb(void *arg, uint64_t newval) else zv->zv_flags &= ~ZVOL_RDONLY; } -#endif /* HAVE_ZVOL */ int zvol_get_stats(objset_t *os, nvlist_t *nv) @@ -234,7 +213,6 @@ zvol_get_stats(objset_t *os, nvlist_t *nv) return (error); } -#ifdef HAVE_ZVOL /* * Find a free minor number. */ @@ -1607,37 +1585,27 @@ zvol_ioctl(dev_t dev, int cmd, intptr_t arg, int flag, cred_t *cr, int *rvalp) mutex_exit(&zvol_state_lock); return (error); } -#endif /* HAVE_ZVOL */ int zvol_busy(void) { -#ifdef HAVE_ZVOL return (zvol_minors != 0); -#else - return 0; -#endif /* HAVE_ZVOL */ } void zvol_init(void) { -#ifdef HAVE_ZVOL VERIFY(ddi_soft_state_init(&zvol_state, sizeof (zvol_state_t), 1) == 0); mutex_init(&zvol_state_lock, NULL, MUTEX_DEFAULT, NULL); -#endif /* HAVE_ZVOL */ } void zvol_fini(void) { -#ifdef HAVE_ZVOL mutex_destroy(&zvol_state_lock); ddi_soft_state_fini(&zvol_state); -#endif /* HAVE_ZVOL */ } -#ifdef HAVE_ZVOL static boolean_t zvol_is_swap(zvol_state_t *zv) { @@ -1865,4 +1833,3 @@ zvol_dump_fini(zvol_state_t *zv) return (0); } -#endif /* HAVE_ZVOL */