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>
|
||||
Subject: [PATCH] zfs branch
|
||||
Subject: [PATCH] linux have zvol
|
||||
|
||||
Merged result of all changes which are relevant to both Solaris
|
||||
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.
|
||||
Use ZVOL if HAVE_ZVOL defined
|
||||
|
||||
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -2087,6 +2087,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;
|
||||
|
@ -2178,6 +2179,7 @@ zpool_iter_zvol(zpool_handle_t *zhp, int (*cb)(const char *, void *),
|
|||
err:
|
||||
free(paths);
|
||||
(void) close(base);
|
||||
#endif
|
||||
return (-1);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue