mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-24 19:28:53 +03:00
Add zfs_file_* interface, remove vnodes
Provide a common zfs_file_* interface which can be implemented on all platforms to perform normal file access from either the kernel module or the libzpool library. This allows all non-portable vnode_t usage in the common code to be replaced by the new portable zfs_file_t. The associated vnode and kobj compatibility functions, types, and macros have been removed from the SPL. Moving forward, vnodes should only be used in platform specific code when provided by the native operating system. Reviewed-by: Sean Eric Fagan <sef@ixsystems.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Igor Kozhukhov <igor@dilos.org> Reviewed-by: Jorgen Lundman <lundman@lundman.net> Signed-off-by: Matt Macy <mmacy@FreeBSD.org> Closes #9556
This commit is contained in:
committed by
Brian Behlendorf
parent
67a6c3bc9f
commit
da92d5cbb3
+10
-11
@@ -319,7 +319,7 @@ spa_prop_get_config(spa_t *spa, nvlist_t **nvp)
|
||||
spa_prop_add_list(*nvp, ZPOOL_PROP_EXPANDSZ, NULL,
|
||||
metaslab_class_expandable_space(mc), src);
|
||||
spa_prop_add_list(*nvp, ZPOOL_PROP_READONLY, NULL,
|
||||
(spa_mode(spa) == FREAD), src);
|
||||
(spa_mode(spa) == SPA_MODE_READ), src);
|
||||
|
||||
cap = (size == 0) ? 0 : (alloc * 100 / size);
|
||||
spa_prop_add_list(*nvp, ZPOOL_PROP_CAPACITY, NULL, cap, src);
|
||||
@@ -1196,7 +1196,7 @@ spa_thread(void *arg)
|
||||
* Activate an uninitialized pool.
|
||||
*/
|
||||
static void
|
||||
spa_activate(spa_t *spa, int mode)
|
||||
spa_activate(spa_t *spa, spa_mode_t mode)
|
||||
{
|
||||
ASSERT(spa->spa_state == POOL_STATE_UNINITIALIZED);
|
||||
|
||||
@@ -3362,7 +3362,7 @@ spa_ld_open_vdevs(spa_t *spa)
|
||||
if (spa->spa_missing_tvds != 0) {
|
||||
spa_load_note(spa, "vdev tree has %lld missing top-level "
|
||||
"vdevs.", (u_longlong_t)spa->spa_missing_tvds);
|
||||
if (spa->spa_trust_config && (spa->spa_mode & FWRITE)) {
|
||||
if (spa->spa_trust_config && (spa->spa_mode & SPA_MODE_WRITE)) {
|
||||
/*
|
||||
* Although theoretically we could allow users to open
|
||||
* incomplete pools in RW mode, we'd need to add a lot
|
||||
@@ -4358,7 +4358,7 @@ spa_ld_check_for_config_update(spa_t *spa, uint64_t config_cache_txg,
|
||||
static void
|
||||
spa_ld_prepare_for_reload(spa_t *spa)
|
||||
{
|
||||
int mode = spa->spa_mode;
|
||||
spa_mode_t mode = spa->spa_mode;
|
||||
int async_suspended = spa->spa_async_suspended;
|
||||
|
||||
spa_unload(spa);
|
||||
@@ -4868,7 +4868,7 @@ spa_load_impl(spa_t *spa, spa_import_type_t type, char **ereport)
|
||||
static int
|
||||
spa_load_retry(spa_t *spa, spa_load_state_t state)
|
||||
{
|
||||
int mode = spa->spa_mode;
|
||||
spa_mode_t mode = spa->spa_mode;
|
||||
|
||||
spa_unload(spa);
|
||||
spa_deactivate(spa);
|
||||
@@ -5915,7 +5915,7 @@ spa_import(char *pool, nvlist_t *config, nvlist_t *props, uint64_t flags)
|
||||
char *altroot = NULL;
|
||||
spa_load_state_t state = SPA_LOAD_IMPORT;
|
||||
zpool_load_policy_t policy;
|
||||
uint64_t mode = spa_mode_global;
|
||||
spa_mode_t mode = spa_mode_global;
|
||||
uint64_t readonly = B_FALSE;
|
||||
int error;
|
||||
nvlist_t *nvroot;
|
||||
@@ -5939,7 +5939,7 @@ spa_import(char *pool, nvlist_t *config, nvlist_t *props, uint64_t flags)
|
||||
(void) nvlist_lookup_uint64(props,
|
||||
zpool_prop_to_name(ZPOOL_PROP_READONLY), &readonly);
|
||||
if (readonly)
|
||||
mode = FREAD;
|
||||
mode = SPA_MODE_READ;
|
||||
spa = spa_add(pool, config, altroot);
|
||||
spa->spa_import_flags = flags;
|
||||
|
||||
@@ -6109,7 +6109,7 @@ spa_tryimport(nvlist_t *tryconfig)
|
||||
*/
|
||||
mutex_enter(&spa_namespace_lock);
|
||||
spa = spa_add(TRYIMPORT_NAME, tryconfig, NULL);
|
||||
spa_activate(spa, FREAD);
|
||||
spa_activate(spa, SPA_MODE_READ);
|
||||
|
||||
/*
|
||||
* Rewind pool if a max txg was provided.
|
||||
@@ -6219,7 +6219,7 @@ spa_export_common(char *pool, int new_state, nvlist_t **oldconfig,
|
||||
if (oldconfig)
|
||||
*oldconfig = NULL;
|
||||
|
||||
if (!(spa_mode_global & FWRITE))
|
||||
if (!(spa_mode_global & SPA_MODE_WRITE))
|
||||
return (SET_ERROR(EROFS));
|
||||
|
||||
mutex_enter(&spa_namespace_lock);
|
||||
@@ -8073,8 +8073,7 @@ spa_async_dispatch(spa_t *spa)
|
||||
mutex_enter(&spa->spa_async_lock);
|
||||
if (spa_async_tasks_pending(spa) &&
|
||||
!spa->spa_async_suspended &&
|
||||
spa->spa_async_thread == NULL &&
|
||||
rootdir != NULL)
|
||||
spa->spa_async_thread == NULL)
|
||||
spa->spa_async_thread = thread_create(NULL, 0,
|
||||
spa_async_thread, spa, 0, &p0, TS_RUN, maxclsyspri);
|
||||
mutex_exit(&spa->spa_async_lock);
|
||||
|
||||
Reference in New Issue
Block a user