Merge commit 'refs/remotes/origin/linux-user-disk' into HEAD
This commit is contained in:
commit
a98e813b49
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, TODO,
|
||||
and README, files.
|
||||
Use Linux style /dev/disk names
|
||||
|
||||
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
|
||||
|
|
|
@ -1467,7 +1467,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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -49,6 +49,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;
|
||||
|
|
|
@ -1480,7 +1480,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;
|
||||
|
@ -2391,6 +2391,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) {
|
||||
|
@ -2439,9 +2440,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);
|
||||
|
@ -2450,6 +2456,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);
|
||||
|
||||
|
@ -2810,8 +2817,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.
|
||||
|
|
|
@ -401,7 +401,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)
|
||||
|
@ -422,6 +426,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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue