Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add spa _os() hooks #12801

Merged
merged 1 commit into from
Feb 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions include/sys/spa.h
Original file line number Diff line number Diff line change
Expand Up @@ -1183,6 +1183,11 @@ extern int spa_wait_tag(const char *name, zpool_wait_activity_t activity,
extern void spa_notify_waiters(spa_t *spa);
extern void spa_wake_waiters(spa_t *spa);

extern void spa_import_os(spa_t *spa);
extern void spa_export_os(spa_t *spa);
extern void spa_activate_os(spa_t *spa);
extern void spa_deactivate_os(spa_t *spa);
lundman marked this conversation as resolved.
Show resolved Hide resolved

/* module param call functions */
int param_set_deadman_ziotime(ZFS_MODULE_PARAM_ARGS);
int param_set_deadman_synctime(ZFS_MODULE_PARAM_ARGS);
Expand Down
24 changes: 24 additions & 0 deletions lib/libzpool/kernel.c
Original file line number Diff line number Diff line change
Expand Up @@ -1405,3 +1405,27 @@ zfsvfs_update_fromname(const char *oldname, const char *newname)
{
(void) oldname, (void) newname;
}

void
spa_import_os(spa_t *spa)
{
(void) spa;
}

void
spa_export_os(spa_t *spa)
{
(void) spa;
}

void
spa_activate_os(spa_t *spa)
{
(void) spa;
}

void
spa_deactivate_os(spa_t *spa)
{
(void) spa;
}
24 changes: 24 additions & 0 deletions module/os/freebsd/zfs/spa_os.c
Original file line number Diff line number Diff line change
Expand Up @@ -268,3 +268,27 @@ spa_history_zone(void)
{
return ("freebsd");
}

void
spa_import_os(spa_t *spa)
{
lundman marked this conversation as resolved.
Show resolved Hide resolved
(void) spa;
}

void
spa_export_os(spa_t *spa)
{
(void) spa;
}

void
spa_activate_os(spa_t *spa)
{
(void) spa;
}

void
spa_deactivate_os(spa_t *spa)
{
(void) spa;
}
24 changes: 24 additions & 0 deletions module/os/linux/zfs/spa_misc_os.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,27 @@ spa_history_zone(void)
{
return ("linux");
}

void
spa_import_os(spa_t *spa)
{
(void) spa;
}

void
spa_export_os(spa_t *spa)
{
(void) spa;
}

void
spa_activate_os(spa_t *spa)
{
(void) spa;
}

void
spa_deactivate_os(spa_t *spa)
{
(void) spa;
}
11 changes: 11 additions & 0 deletions module/zfs/spa.c
Original file line number Diff line number Diff line change
Expand Up @@ -1315,6 +1315,8 @@ spa_activate(spa_t *spa, spa_mode_t mode)
spa_error_entry_compare, sizeof (spa_error_entry_t),
offsetof(spa_error_entry_t, se_avl));

spa_activate_os(spa);

spa_keystore_init(&spa->spa_keystore);

/*
Expand Down Expand Up @@ -1451,6 +1453,9 @@ spa_deactivate(spa_t *spa)
thread_join(spa->spa_did);
spa->spa_did = 0;
}

spa_deactivate_os(spa);

}

/*
Expand Down Expand Up @@ -6023,6 +6028,8 @@ spa_create(const char *pool, nvlist_t *nvroot, nvlist_t *props,
spa->spa_minref = zfs_refcount_count(&spa->spa_refcount);
spa->spa_load_state = SPA_LOAD_NONE;

spa_import_os(spa);

mutex_exit(&spa_namespace_lock);

return (0);
Expand Down Expand Up @@ -6206,6 +6213,8 @@ spa_import(char *pool, nvlist_t *config, nvlist_t *props, uint64_t flags)

zvol_create_minors_recursive(pool);

spa_import_os(spa);

return (0);
}

Expand Down Expand Up @@ -6435,6 +6444,8 @@ spa_export_common(const char *pool, int new_state, nvlist_t **oldconfig,
}

export_spa:
spa_export_os(spa);

if (new_state == POOL_STATE_DESTROYED)
spa_event_notify(spa, NULL, NULL, ESC_ZFS_POOL_DESTROY);
else if (new_state == POOL_STATE_EXPORTED)
Expand Down