Refresh linux-have-zvol
This commit is contained in:
parent
9baaa468ac
commit
0fd95094fd
17
.topmsg
17
.topmsg
|
@ -1,19 +1,6 @@
|
||||||
From: Brian Behlendorf <behlendorf1@llnl.gov>
|
From: Brian Behlendorf <behlendorf1@llnl.gov>
|
||||||
Subject: [PATCH] zfs branch
|
Subject: [PATCH] linux have zvol
|
||||||
|
|
||||||
Merged result of all changes which are relevant to both Solaris
|
Use ZVOL if HAVE_ZVOL defined
|
||||||
and Linux builds of the ZFS code. These are changes where there
|
|
||||||
is a reasonable chance they will be accepted upstream.
|
|
||||||
|
|
||||||
Additionally, since this is effectively the root of the linux
|
|
||||||
ZFS tree the core linux build system is added here. This
|
|
||||||
includes autogen.sh, configure.ac, m4 macros, some scripts/*,
|
|
||||||
and makefiles for all the core ZFS components. Linux-only
|
|
||||||
features which require tweaks to the build system should appear
|
|
||||||
on the relevant topic branches. All autotools products which
|
|
||||||
result from autogen.sh are commited to the linux-configure-branch.
|
|
||||||
|
|
||||||
This branch also contains the META, ChangeLog, AUTHORS,
|
|
||||||
README, and GIT files.
|
|
||||||
|
|
||||||
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
|
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
|
||||||
|
|
|
@ -3981,6 +3981,11 @@ zvol_create_link(libzfs_handle_t *hdl, const char *dataset)
|
||||||
static int
|
static int
|
||||||
zvol_create_link_common(libzfs_handle_t *hdl, const char *dataset, int ifexists)
|
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 };
|
zfs_cmd_t zc = { 0 };
|
||||||
di_devlink_handle_t dhdl;
|
di_devlink_handle_t dhdl;
|
||||||
priv_set_t *priv_effective;
|
priv_set_t *priv_effective;
|
||||||
|
@ -4069,6 +4074,7 @@ zvol_create_link_common(libzfs_handle_t *hdl, const char *dataset, int ifexists)
|
||||||
}
|
}
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -4205,6 +4211,9 @@ zfs_expand_proplist(zfs_handle_t *zhp, zprop_list_t **plp)
|
||||||
int
|
int
|
||||||
zfs_iscsi_perm_check(libzfs_handle_t *hdl, char *dataset, ucred_t *cred)
|
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 };
|
zfs_cmd_t zc = { 0 };
|
||||||
nvlist_t *nvp;
|
nvlist_t *nvp;
|
||||||
gid_t gid;
|
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);
|
error = ioctl(hdl->libzfs_fd, ZFS_IOC_ISCSI_PERM_CHECK, &zc);
|
||||||
nvlist_free(nvp);
|
nvlist_free(nvp);
|
||||||
return (error);
|
return (error);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
|
@ -2087,6 +2087,7 @@ int
|
||||||
zpool_iter_zvol(zpool_handle_t *zhp, int (*cb)(const char *, void *),
|
zpool_iter_zvol(zpool_handle_t *zhp, int (*cb)(const char *, void *),
|
||||||
void *data)
|
void *data)
|
||||||
{
|
{
|
||||||
|
#ifdef HAVE_ZVOL
|
||||||
libzfs_handle_t *hdl = zhp->zpool_hdl;
|
libzfs_handle_t *hdl = zhp->zpool_hdl;
|
||||||
char (*paths)[MAXPATHLEN];
|
char (*paths)[MAXPATHLEN];
|
||||||
size_t size = 4;
|
size_t size = 4;
|
||||||
|
@ -2178,6 +2179,7 @@ zpool_iter_zvol(zpool_handle_t *zhp, int (*cb)(const char *, void *),
|
||||||
err:
|
err:
|
||||||
free(paths);
|
free(paths);
|
||||||
(void) close(base);
|
(void) close(base);
|
||||||
|
#endif
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -76,6 +76,11 @@
|
||||||
#include <sys/zvol.h>
|
#include <sys/zvol.h>
|
||||||
#include <sys/dumphdr.h>
|
#include <sys/dumphdr.h>
|
||||||
|
|
||||||
|
#ifdef HAVE_SPL
|
||||||
|
#include <linux/bitops.h>
|
||||||
|
#include <linux/bitops_compat.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "zfs_namecheck.h"
|
#include "zfs_namecheck.h"
|
||||||
|
|
||||||
static void *zvol_state;
|
static void *zvol_state;
|
||||||
|
@ -159,10 +164,22 @@ zvol_check_volsize(uint64_t volsize, uint64_t blocksize)
|
||||||
if (volsize % blocksize != 0)
|
if (volsize % blocksize != 0)
|
||||||
return (EINVAL);
|
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)
|
if (volsize - 1 > SPEC_MAXOFFSET_T)
|
||||||
return (EOVERFLOW);
|
return (EOVERFLOW);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue