Merge branch 'linux-user-disk' into refs/top-bases/linux-zfs-branch

This commit is contained in:
Brian Behlendorf 2010-06-14 16:10:54 -07:00
commit 9193fdea7e
7 changed files with 36 additions and 31 deletions

View File

@ -55,7 +55,6 @@
#include <sys/arc.h>
#include <sys/ddt.h>
#undef ZFS_MAXNAMELEN
#undef verify
#include <libzfs.h>
#define ZDB_COMPRESS_NAME(idx) ((idx) < ZIO_COMPRESS_FUNCTIONS ? \

View File

@ -311,6 +311,7 @@ safe_malloc(size_t size)
return (data);
}
#ifdef HAVE_ZPL
static char *
safe_strdup(char *str)
{
@ -321,6 +322,7 @@ safe_strdup(char *str)
return (dupstr);
}
#endif /* HAVE_ZPL */
/*
* Callback routine that will print out information for each of
@ -488,6 +490,7 @@ parse_depth(char *opt, int *flags)
#define PROGRESS_DELAY 2 /* seconds */
#ifdef HAVE_ZPL
static char *pt_reverse = "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b";
static time_t pt_begin;
static char *pt_header = NULL;
@ -539,6 +542,8 @@ finish_progress(char *done)
free(pt_header);
pt_header = NULL;
}
#endif /* HAVE_ZPL */
/*
* zfs clone [-p] [-o prop=value] ... <snap> <fs | vol>
*

View File

@ -1598,7 +1598,7 @@ do_import(nvlist_t *config, const char *newname, const char *mntopts,
* -c Read pool information from a cachefile instead of searching
* devices.
*
* -d Scan in a specific directory, other than /dev/dsk. More than
* -d Scan in a specific directory, other than /dev/. More than
* one directory can be specified using multiple '-d' options.
*
* -D Scan for previously destroyed pools or import all or only
@ -1757,12 +1757,6 @@ zpool_do_import(int argc, char **argv)
nvlist_add_uint32(policy, ZPOOL_REWIND_REQUEST, rewind_policy) != 0)
goto error;
if (searchdirs == NULL) {
searchdirs = safe_malloc(sizeof (char *));
searchdirs[0] = "/dev/dsk";
nsearch = 1;
}
/* check argument count */
if (do_all) {
if (argc != 0) {

View File

@ -1042,6 +1042,7 @@ ztest_pattern_set(void *buf, uint64_t size, uint64_t value)
*ip++ = value;
}
#ifndef NDEBUG
static boolean_t
ztest_pattern_match(void *buf, uint64_t size, uint64_t value)
{
@ -1054,6 +1055,7 @@ ztest_pattern_match(void *buf, uint64_t size, uint64_t value)
return (diff == 0);
}
#endif
static void
ztest_bt_generate(ztest_block_tag_t *bt, objset_t *os, uint64_t object,
@ -4770,7 +4772,6 @@ ztest_run_zdb(char *pool)
bin,
zopt_verbose >= 3 ? "s" : "",
zopt_verbose >= 4 ? "v" : "",
spa_config_path,
pool);
if (zopt_verbose >= 5)

View File

@ -53,7 +53,6 @@
#include <sys/vtoc.h>
#include <sys/dktp/fdisk.h>
#include <sys/efi_partition.h>
#include <thread_pool.h>
#include <sys/vdev_impl.h>
#ifdef HAVE_LIBBLKID
@ -1004,13 +1003,10 @@ zpool_find_import_impl(libzfs_handle_t *hdl, importargs_t *iarg)
vdev_entry_t *ve, *venext;
config_entry_t *ce, *cenext;
name_entry_t *ne, *nenext;
avl_tree_t slice_cache;
rdsk_node_t *slice;
void *cookie;
verify(poolname == NULL || guid == 0);
verify(iarg->poolname == NULL || iarg->guid == 0);
if (argc == 0) {
if (dirs == 0) {
#ifdef HAVE_LIBBLKID
/* Use libblkid to scan all device for their type */
if (zpool_find_import_blkid(hdl, &pools) == 0)
@ -1020,8 +1016,8 @@ zpool_find_import_impl(libzfs_handle_t *hdl, importargs_t *iarg)
dgettext(TEXT_DOMAIN, "blkid failure falling back "
"to manual probing"));
#endif /* HAVE_LIBBLKID */
argc = 1;
argv = &default_dir;
dirs = 1;
dir = &default_dir;
}
/*
@ -1030,7 +1026,6 @@ zpool_find_import_impl(libzfs_handle_t *hdl, importargs_t *iarg)
* and toplevel GUID.
*/
for (i = 0; i < dirs; i++) {
tpool_t *t;
char *rdsk;
int dfd;
@ -1064,8 +1059,6 @@ zpool_find_import_impl(libzfs_handle_t *hdl, importargs_t *iarg)
goto error;
}
avl_create(&slice_cache, slice_cache_compare,
sizeof (rdsk_node_t), offsetof(rdsk_node_t, rn_node));
/*
* This is not MT-safe, but we have no MT consumers of libzfs
*/
@ -1076,11 +1069,23 @@ zpool_find_import_impl(libzfs_handle_t *hdl, importargs_t *iarg)
continue;
/*
* Do not open /dev/watchdog to stat it because
* it requires a special close or the watchdog
* with be triggered and the system reset.
* Skip checking devices with well known prefixes:
* watchdog - A special close is required to avoid
* triggering it and resetting the system.
* fuse - Fuse control device.
* ppp - Generic PPP driver.
* tty* - Generic serial interface.
* vcs* - Virtual console memory.
* parport* - Parallel port interface.
* lp* - Printer interface.
*/
if (strcmp(name, "watchdog") == 0)
if ((strncmp(name, "watchdog", 8) == 0) ||
(strncmp(name, "fuse", 4) == 0) ||
(strncmp(name, "ppp", 3) == 0) ||
(strncmp(name, "tty", 3) == 0) ||
(strncmp(name, "vcs", 3) == 0) ||
(strncmp(name, "parport", 7) == 0) ||
(strncmp(name, "lp", 2) == 0))
continue;
if ((fd = openat64(dfd, name, O_RDONLY)) < 0)
@ -1129,14 +1134,11 @@ zpool_find_import_impl(libzfs_handle_t *hdl, importargs_t *iarg)
continue;
}
/* use the non-raw path for the config */
(void) strlcpy(end, slice->rn_name, pathleft);
(void) strlcpy(end, name, pathleft);
if (add_config(hdl, &pools, path, config) != 0)
goto error;
}
free(slice->rn_name);
free(slice);
}
avl_destroy(&slice_cache);
(void) closedir(dirp);
dirp = NULL;
@ -1145,7 +1147,7 @@ zpool_find_import_impl(libzfs_handle_t *hdl, importargs_t *iarg)
#ifdef HAVE_LIBBLKID
skip_scanning:
#endif
ret = get_configs(hdl, &pools, active_ok);
ret = get_configs(hdl, &pools, iarg->can_be_active);
error:
for (pe = pools.pools; pe != NULL; pe = penext) {

View File

@ -1353,6 +1353,7 @@ sa_lookup(sa_handle_t *hdl, sa_attr_type_t attr, void *buf, uint32_t buflen)
int
sa_lookup_uio(sa_handle_t *hdl, sa_attr_type_t attr, uio_t *uio)
{
#ifdef HAVE_ZPL
int error;
sa_bulk_attr_t bulk;
@ -1371,7 +1372,9 @@ sa_lookup_uio(sa_handle_t *hdl, sa_attr_type_t attr, uio_t *uio)
}
mutex_exit(&hdl->sa_lock);
return (error);
#else
return ENOSYS;
#endif /* HAVE_ZPL */
}
#endif

View File

@ -67,7 +67,7 @@ sa_attr_reg_t zfs_attr_table[ZPL_END+1] = {
};
#ifdef _KERNEL
#ifdef HAVE_ZPL
int
zfs_sa_readlink(znode_t *zp, uio_t *uio)
{
@ -309,4 +309,5 @@ zfs_sa_upgrade_txholds(dmu_tx_t *tx, znode_t *zp)
}
}
#endif /* HAVE_ZPL */
#endif