mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +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
@@ -757,7 +757,7 @@ main(int argc, char **argv)
|
||||
|
||||
process_options(argc, argv);
|
||||
|
||||
kernel_init(FREAD);
|
||||
kernel_init(SPA_MODE_READ);
|
||||
|
||||
/* setup random data because rand() is not reentrant */
|
||||
rand_data = (int *)umem_alloc(SPA_MAXBLOCKSIZE, UMEM_NOFAIL);
|
||||
|
||||
+1
-1
@@ -6781,7 +6781,7 @@ main(int argc, char **argv)
|
||||
*/
|
||||
spa_load_verify_dryrun = B_TRUE;
|
||||
|
||||
kernel_init(FREAD);
|
||||
kernel_init(SPA_MODE_READ);
|
||||
|
||||
if (dump_all)
|
||||
verbose = MAX(verbose, 1);
|
||||
|
||||
+2
-1
@@ -126,7 +126,8 @@ zhack_import(char *target, boolean_t readonly)
|
||||
nvlist_t *props;
|
||||
int error;
|
||||
|
||||
kernel_init(readonly ? FREAD : (FREAD | FWRITE));
|
||||
kernel_init(readonly ? SPA_MODE_READ :
|
||||
(SPA_MODE_READ | SPA_MODE_WRITE));
|
||||
|
||||
dmu_objset_register_type(DMU_OST_ZFS, space_delta_cb);
|
||||
|
||||
|
||||
+7
-7
@@ -5826,8 +5826,8 @@ ztest_fault_inject(ztest_ds_t *zd, uint64_t id)
|
||||
(long long)vd0->vdev_id, (int)maxfaults);
|
||||
|
||||
if (vf != NULL && ztest_random(3) == 0) {
|
||||
(void) close(vf->vf_vnode->v_fd);
|
||||
vf->vf_vnode->v_fd = -1;
|
||||
(void) close(vf->vf_file->f_fd);
|
||||
vf->vf_file->f_fd = -1;
|
||||
} else if (ztest_random(2) == 0) {
|
||||
vd0->vdev_cant_read = B_TRUE;
|
||||
} else {
|
||||
@@ -6933,7 +6933,7 @@ ztest_run(ztest_shared_t *zs)
|
||||
/*
|
||||
* Open our pool.
|
||||
*/
|
||||
kernel_init(FREAD | FWRITE);
|
||||
kernel_init(SPA_MODE_READ | SPA_MODE_WRITE);
|
||||
VERIFY0(spa_open(ztest_opts.zo_pool, &spa, FTAG));
|
||||
metaslab_preload_limit = ztest_random(20) + 1;
|
||||
ztest_spa = spa;
|
||||
@@ -7122,7 +7122,7 @@ ztest_freeze(void)
|
||||
if (ztest_opts.zo_verbose >= 3)
|
||||
(void) printf("testing spa_freeze()...\n");
|
||||
|
||||
kernel_init(FREAD | FWRITE);
|
||||
kernel_init(SPA_MODE_READ | SPA_MODE_WRITE);
|
||||
VERIFY3U(0, ==, spa_open(ztest_opts.zo_pool, &spa, FTAG));
|
||||
VERIFY3U(0, ==, ztest_dataset_open(0));
|
||||
ztest_spa = spa;
|
||||
@@ -7189,7 +7189,7 @@ ztest_freeze(void)
|
||||
/*
|
||||
* Open and close the pool and dataset to induce log replay.
|
||||
*/
|
||||
kernel_init(FREAD | FWRITE);
|
||||
kernel_init(SPA_MODE_READ | SPA_MODE_WRITE);
|
||||
VERIFY3U(0, ==, spa_open(ztest_opts.zo_pool, &spa, FTAG));
|
||||
ASSERT(spa_freeze_txg(spa) == UINT64_MAX);
|
||||
VERIFY3U(0, ==, ztest_dataset_open(0));
|
||||
@@ -7262,7 +7262,7 @@ ztest_import(ztest_shared_t *zs)
|
||||
mutex_init(&ztest_checkpoint_lock, NULL, MUTEX_DEFAULT, NULL);
|
||||
VERIFY0(pthread_rwlock_init(&ztest_name_lock, NULL));
|
||||
|
||||
kernel_init(FREAD | FWRITE);
|
||||
kernel_init(SPA_MODE_READ | SPA_MODE_WRITE);
|
||||
|
||||
searchdirs[0] = ztest_opts.zo_dir;
|
||||
args.paths = nsearch;
|
||||
@@ -7308,7 +7308,7 @@ ztest_init(ztest_shared_t *zs)
|
||||
mutex_init(&ztest_checkpoint_lock, NULL, MUTEX_DEFAULT, NULL);
|
||||
VERIFY0(pthread_rwlock_init(&ztest_name_lock, NULL));
|
||||
|
||||
kernel_init(FREAD | FWRITE);
|
||||
kernel_init(SPA_MODE_READ | SPA_MODE_WRITE);
|
||||
|
||||
/*
|
||||
* Create the storage pool.
|
||||
|
||||
Reference in New Issue
Block a user