Merge branch 'linux-have-zvol' into refs/top-bases/linux-zfs-branch

This commit is contained in:
Brian Behlendorf 2008-12-05 12:43:10 -08:00
commit 3a8d93c102
3 changed files with 30 additions and 1 deletions

View File

@ -3981,6 +3981,11 @@ 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 };
di_devlink_handle_t dhdl;
priv_set_t *priv_effective;
@ -4069,6 +4074,7 @@ zvol_create_link_common(libzfs_handle_t *hdl, const char *dataset, int ifexists)
}
return (0);
#endif
}
/*
@ -4205,6 +4211,9 @@ 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 };
nvlist_t *nvp;
gid_t gid;
@ -4246,6 +4255,7 @@ 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

View File

@ -2088,6 +2088,7 @@ 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;
@ -2179,6 +2180,7 @@ zpool_iter_zvol(zpool_handle_t *zhp, int (*cb)(const char *, void *),
err:
free(paths);
(void) close(base);
#endif
return (-1);
}

View File

@ -76,6 +76,11 @@
#include <sys/zvol.h>
#include <sys/dumphdr.h>
#ifdef HAVE_SPL
#include <linux/bitops.h>
#include <linux/bitops_compat.h>
#endif
#include "zfs_namecheck.h"
static void *zvol_state;
@ -159,10 +164,22 @@ zvol_check_volsize(uint64_t volsize, uint64_t blocksize)
if (volsize % blocksize != 0)
return (EINVAL);
#ifdef _ILP32
#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)
if (volsize - 1 > SPEC_MAXOFFSET_T)
return (EOVERFLOW);
#endif
return (0);
}