diff --git a/lib/libzfs/libzfs_dataset.c b/lib/libzfs/libzfs_dataset.c index f414924ba0..638cd19261 100644 --- a/lib/libzfs/libzfs_dataset.c +++ b/lib/libzfs/libzfs_dataset.c @@ -3649,11 +3649,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; @@ -3742,7 +3737,6 @@ zvol_create_link_common(libzfs_handle_t *hdl, const char *dataset, int ifexists) } return (0); -#endif } /* @@ -3879,9 +3873,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; @@ -3923,7 +3914,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 8acb0c4af8..38cc627fcb 100644 --- a/lib/libzfs/libzfs_pool.c +++ b/lib/libzfs/libzfs_pool.c @@ -2350,7 +2350,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; @@ -2442,8 +2441,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 f24b95d5c2..dd74ad5103 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 52b63798c3..f993177667 100644 --- a/module/zfs/zfs_ioctl.c +++ b/module/zfs/zfs_ioctl.c @@ -1799,7 +1799,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, @@ -1812,11 +1811,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: { @@ -2182,11 +2176,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 */ } /* @@ -2198,11 +2188,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 */ } #ifdef HAVE_ZPL @@ -2418,11 +2404,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; @@ -2473,7 +2457,6 @@ zfs_ioc_create(zfs_cmd_t *zc) return (EINVAL); } -#ifdef HAVE_ZVOL if (type == DMU_OST_ZVOL) { uint64_t volsize, volblocksize; @@ -2503,9 +2486,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; /* @@ -3726,10 +3707,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)); @@ -3848,7 +3827,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 */ @@ -3856,15 +3834,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 */