Refresh linux-user-disk
This commit is contained in:
parent
9baaa468ac
commit
fa94f86d0b
17
.topmsg
17
.topmsg
|
@ -1,19 +1,6 @@
|
|||
From: Brian Behlendorf <behlendorf1@llnl.gov>
|
||||
Subject: [PATCH] zfs branch
|
||||
Subject: [PATCH] linux user disk
|
||||
|
||||
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 Linux style /dev/disk names
|
||||
|
||||
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
|
||||
|
|
|
@ -400,7 +400,11 @@ vn_open(char *path, int x1, int flags, int mode, vnode_t **vpp, int x2, int x3)
|
|||
* for its size. So -- gag -- we open the block device to get
|
||||
* its size, and remember it for subsequent VOP_GETATTR().
|
||||
*/
|
||||
#if defined(__sun__) || defined(__sun)
|
||||
if (strncmp(path, "/dev/", 5) == 0) {
|
||||
#else
|
||||
if (0) {
|
||||
#endif
|
||||
char *dsk;
|
||||
fd = open64(path, O_RDONLY);
|
||||
if (fd == -1)
|
||||
|
@ -421,6 +425,14 @@ vn_open(char *path, int x1, int flags, int mode, vnode_t **vpp, int x2, int x3)
|
|||
return (errno);
|
||||
}
|
||||
|
||||
#ifdef __linux__
|
||||
if (!(flags & FCREAT) && S_ISBLK(st.st_mode)) {
|
||||
flags |= O_DIRECT;
|
||||
if (flags & FWRITE)
|
||||
flags |= O_EXCL;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (flags & FCREAT)
|
||||
old_umask = umask(0);
|
||||
|
||||
|
|
|
@ -48,6 +48,20 @@ extern "C" {
|
|||
#define ZFS_MAXPROPLEN MAXPATHLEN
|
||||
#define ZPOOL_MAXPROPLEN MAXPATHLEN
|
||||
|
||||
/*
|
||||
* Default device paths
|
||||
*/
|
||||
|
||||
#if defined(__sun__) || defined(__sun)
|
||||
#define DISK_ROOT "/dev/dsk"
|
||||
#define RDISK_ROOT "/dev/rdsk"
|
||||
#define BACKUP_SLICE "s2"
|
||||
#endif
|
||||
|
||||
#ifdef __linux__
|
||||
#define DISK_ROOT "/dev"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* libzfs errors
|
||||
*/
|
||||
|
|
|
@ -796,7 +796,7 @@ zpool_find_import_impl(libzfs_handle_t *hdl, int argc, char **argv,
|
|||
size_t pathleft;
|
||||
struct stat64 statbuf;
|
||||
nvlist_t *ret = NULL, *config;
|
||||
static char *default_dir = "/dev/dsk";
|
||||
static char *default_dir = DISK_ROOT;
|
||||
int fd;
|
||||
pool_list_t pools = { 0 };
|
||||
pool_entry_t *pe, *penext;
|
||||
|
|
|
@ -1434,7 +1434,7 @@ zpool_find_vdev(zpool_handle_t *zhp, const char *path, boolean_t *avail_spare,
|
|||
if (guid != 0 && *end == '\0') {
|
||||
search = NULL;
|
||||
} else if (path[0] != '/') {
|
||||
(void) snprintf(buf, sizeof (buf), "%s%s", "/dev/dsk/", path);
|
||||
(void) snprintf(buf, sizeof (buf), "%s/%s", DISK_ROOT, path);
|
||||
search = buf;
|
||||
} else {
|
||||
search = path;
|
||||
|
@ -2345,6 +2345,7 @@ zpool_vdev_name(libzfs_handle_t *hdl, zpool_handle_t *zhp, nvlist_t *nv)
|
|||
char buf[64];
|
||||
vdev_stat_t *vs;
|
||||
uint_t vsc;
|
||||
size_t droot_len = strlen(DISK_ROOT) + 1;
|
||||
|
||||
if (nvlist_lookup_uint64(nv, ZPOOL_CONFIG_NOT_PRESENT,
|
||||
&value) == 0) {
|
||||
|
@ -2393,9 +2394,14 @@ zpool_vdev_name(libzfs_handle_t *hdl, zpool_handle_t *zhp, nvlist_t *nv)
|
|||
devid_str_free(newdevid);
|
||||
}
|
||||
|
||||
if (strncmp(path, "/dev/dsk/", 9) == 0)
|
||||
path += 9;
|
||||
if (strncmp(path, DISK_ROOT "/", droot_len) == 0)
|
||||
path += droot_len;
|
||||
|
||||
#if defined(__sun__) || defined(__sun)
|
||||
/*
|
||||
* The following code strips the slice from the device path.
|
||||
* This is only meaningful in Solaris.
|
||||
*/
|
||||
if (nvlist_lookup_uint64(nv, ZPOOL_CONFIG_WHOLE_DISK,
|
||||
&value) == 0 && value) {
|
||||
char *tmp = zfs_strdup(hdl, path);
|
||||
|
@ -2404,6 +2410,7 @@ zpool_vdev_name(libzfs_handle_t *hdl, zpool_handle_t *zhp, nvlist_t *nv)
|
|||
tmp[strlen(path) - 2] = '\0';
|
||||
return (tmp);
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
verify(nvlist_lookup_string(nv, ZPOOL_CONFIG_TYPE, &path) == 0);
|
||||
|
||||
|
@ -2764,8 +2771,6 @@ zpool_obj_to_path(zpool_handle_t *zhp, uint64_t dsobj, uint64_t obj,
|
|||
free(mntpnt);
|
||||
}
|
||||
|
||||
#define RDISK_ROOT "/dev/rdsk"
|
||||
#define BACKUP_SLICE "s2"
|
||||
/*
|
||||
* Don't start the slice at the default block of 34; many storage
|
||||
* devices will use a stripe width of 128k, so start there instead.
|
||||
|
|
|
@ -1458,7 +1458,7 @@ zpool_do_import(int argc, char **argv)
|
|||
|
||||
if (searchdirs == NULL) {
|
||||
searchdirs = safe_malloc(sizeof (char *));
|
||||
searchdirs[0] = "/dev/dsk";
|
||||
searchdirs[0] = DISK_ROOT;
|
||||
nsearch = 1;
|
||||
}
|
||||
|
||||
|
@ -2212,14 +2212,15 @@ zpool_get_vdev_by_name(nvlist_t *nv, char *name)
|
|||
uint_t c, children;
|
||||
nvlist_t *match;
|
||||
char *path;
|
||||
size_t droot_len = strlen(DISK_ROOT) + 1;
|
||||
|
||||
if (nvlist_lookup_nvlist_array(nv, ZPOOL_CONFIG_CHILDREN,
|
||||
&child, &children) != 0) {
|
||||
verify(nvlist_lookup_string(nv, ZPOOL_CONFIG_PATH, &path) == 0);
|
||||
if (strncmp(name, "/dev/dsk/", 9) == 0)
|
||||
name += 9;
|
||||
if (strncmp(path, "/dev/dsk/", 9) == 0)
|
||||
path += 9;
|
||||
if (strncmp(name, DISK_ROOT "/", droot_len) == 0)
|
||||
name += droot_len;
|
||||
if (strncmp(path, DISK_ROOT "/", droot_len) == 0)
|
||||
path += droot_len;
|
||||
if (strcmp(name, path) == 0)
|
||||
return (nv);
|
||||
return (NULL);
|
||||
|
|
|
@ -77,10 +77,6 @@
|
|||
|
||||
#include "zpool_util.h"
|
||||
|
||||
#define DISK_ROOT "/dev/dsk"
|
||||
#define RDISK_ROOT "/dev/rdsk"
|
||||
#define BACKUP_SLICE "s2"
|
||||
|
||||
/*
|
||||
* For any given vdev specification, we can have multiple errors. The
|
||||
* vdev_error() function keeps track of whether we have seen an error yet, and
|
||||
|
|
Loading…
Reference in New Issue