mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-25 19:57:43 +03:00
mmp: add spa_load_name() for tryimport
Tryimport adds a unique prefix to the pool name to avoid name collisions. This makes it awkward to log user-friendly info during a tryimport. Add a spa_load_name() function which can be used to report the unmodified pool name. Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Tony Hutter <hutter2@llnl.gov> Reviewed-by: Olaf Faaland <faaland1@llnl.gov> Reviewed-by: Akash B <akash-b@hpe.com>
This commit is contained in:
committed by
Tony Hutter
parent
62a1bf7d19
commit
2f048ced4d
+19
-2
@@ -414,7 +414,7 @@ spa_load_failed(spa_t *spa, const char *fmt, ...)
|
||||
(void) vsnprintf(buf, sizeof (buf), fmt, adx);
|
||||
va_end(adx);
|
||||
|
||||
zfs_dbgmsg("spa_load(%s, config %s): FAILED: %s", spa->spa_name,
|
||||
zfs_dbgmsg("spa_load(%s, config %s): FAILED: %s", spa_load_name(spa),
|
||||
spa->spa_trust_config ? "trusted" : "untrusted", buf);
|
||||
}
|
||||
|
||||
@@ -428,7 +428,7 @@ spa_load_note(spa_t *spa, const char *fmt, ...)
|
||||
(void) vsnprintf(buf, sizeof (buf), fmt, adx);
|
||||
va_end(adx);
|
||||
|
||||
zfs_dbgmsg("spa_load(%s, config %s): %s", spa->spa_name,
|
||||
zfs_dbgmsg("spa_load(%s, config %s): %s", spa_load_name(spa),
|
||||
spa->spa_trust_config ? "trusted" : "untrusted", buf);
|
||||
|
||||
spa_import_progress_set_notes_nolog(spa, "%s", buf);
|
||||
@@ -902,6 +902,9 @@ spa_remove(spa_t *spa)
|
||||
if (spa->spa_root)
|
||||
spa_strfree(spa->spa_root);
|
||||
|
||||
if (spa->spa_load_name)
|
||||
spa_strfree(spa->spa_load_name);
|
||||
|
||||
while ((dp = list_remove_head(&spa->spa_config_list)) != NULL) {
|
||||
if (dp->scd_path != NULL)
|
||||
spa_strfree(dp->scd_path);
|
||||
@@ -1818,6 +1821,19 @@ spa_name(spa_t *spa)
|
||||
return (spa->spa_name);
|
||||
}
|
||||
|
||||
char *
|
||||
spa_load_name(spa_t *spa)
|
||||
{
|
||||
/*
|
||||
* During spa_tryimport() the pool name includes a unique prefix.
|
||||
* Returns the original name which can be used for log messages.
|
||||
*/
|
||||
if (spa->spa_load_name)
|
||||
return (spa->spa_load_name);
|
||||
|
||||
return (spa->spa_name);
|
||||
}
|
||||
|
||||
uint64_t
|
||||
spa_guid(spa_t *spa)
|
||||
{
|
||||
@@ -3141,6 +3157,7 @@ EXPORT_SYMBOL(spa_set_rootblkptr);
|
||||
EXPORT_SYMBOL(spa_altroot);
|
||||
EXPORT_SYMBOL(spa_sync_pass);
|
||||
EXPORT_SYMBOL(spa_name);
|
||||
EXPORT_SYMBOL(spa_load_name);
|
||||
EXPORT_SYMBOL(spa_guid);
|
||||
EXPORT_SYMBOL(spa_last_synced_txg);
|
||||
EXPORT_SYMBOL(spa_first_txg);
|
||||
|
||||
Reference in New Issue
Block a user