spa_config: Rename spa_config_enter_mmp() to spa_config_enter_priority()

Originally this was created for MMP, but now new cases are emerging
where the same mechanism is required. Hence the name's generalization.

Sponsored-by: Klara, Inc.
Sponsored-by: Wasabi Technology, Inc.
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Allan Jude <allan@klarasystems.com>
Reviewed-by: Igor Kozhukhov <igor@dilos.org>
Signed-off-by: Igor Ostapenko <igor.ostapenko@klarasystems.com>
Closes #17793
This commit is contained in:
Igor Ostapenko 2025-09-29 10:52:38 +00:00 committed by Tony Hutter
parent ead0fb736d
commit 01180a63bd
3 changed files with 6 additions and 6 deletions

View File

@ -1030,7 +1030,7 @@ extern void spa_import_progress_set_notes_nolog(spa_t *spa,
extern int spa_config_tryenter(spa_t *spa, int locks, const void *tag, extern int spa_config_tryenter(spa_t *spa, int locks, const void *tag,
krw_t rw); krw_t rw);
extern void spa_config_enter(spa_t *spa, int locks, const void *tag, krw_t rw); extern void spa_config_enter(spa_t *spa, int locks, const void *tag, krw_t rw);
extern void spa_config_enter_mmp(spa_t *spa, int locks, const void *tag, extern void spa_config_enter_priority(spa_t *spa, int locks, const void *tag,
krw_t rw); krw_t rw);
extern void spa_config_exit(spa_t *spa, int locks, const void *tag); extern void spa_config_exit(spa_t *spa, int locks, const void *tag);
extern int spa_config_held(spa_t *spa, int locks, krw_t rw); extern int spa_config_held(spa_t *spa, int locks, krw_t rw);

View File

@ -446,7 +446,7 @@ mmp_write_uberblock(spa_t *spa)
uint64_t offset; uint64_t offset;
hrtime_t lock_acquire_time = gethrtime(); hrtime_t lock_acquire_time = gethrtime();
spa_config_enter_mmp(spa, SCL_STATE, mmp_tag, RW_READER); spa_config_enter_priority(spa, SCL_STATE, mmp_tag, RW_READER);
lock_acquire_time = gethrtime() - lock_acquire_time; lock_acquire_time = gethrtime() - lock_acquire_time;
if (lock_acquire_time > (MSEC2NSEC(MMP_MIN_INTERVAL) / 10)) if (lock_acquire_time > (MSEC2NSEC(MMP_MIN_INTERVAL) / 10))
zfs_dbgmsg("MMP SCL_STATE acquisition pool '%s' took %llu ns " zfs_dbgmsg("MMP SCL_STATE acquisition pool '%s' took %llu ns "

View File

@ -510,7 +510,7 @@ spa_config_tryenter(spa_t *spa, int locks, const void *tag, krw_t rw)
static void static void
spa_config_enter_impl(spa_t *spa, int locks, const void *tag, krw_t rw, spa_config_enter_impl(spa_t *spa, int locks, const void *tag, krw_t rw,
int mmp_flag) int priority_flag)
{ {
(void) tag; (void) tag;
int wlocks_held = 0; int wlocks_held = 0;
@ -526,7 +526,7 @@ spa_config_enter_impl(spa_t *spa, int locks, const void *tag, krw_t rw,
mutex_enter(&scl->scl_lock); mutex_enter(&scl->scl_lock);
if (rw == RW_READER) { if (rw == RW_READER) {
while (scl->scl_writer || while (scl->scl_writer ||
(!mmp_flag && scl->scl_write_wanted)) { (!priority_flag && scl->scl_write_wanted)) {
cv_wait(&scl->scl_cv, &scl->scl_lock); cv_wait(&scl->scl_cv, &scl->scl_lock);
} }
} else { } else {
@ -551,7 +551,7 @@ spa_config_enter(spa_t *spa, int locks, const void *tag, krw_t rw)
} }
/* /*
* The spa_config_enter_mmp() allows the mmp thread to cut in front of * The spa_config_enter_priority() allows the mmp thread to cut in front of
* outstanding write lock requests. This is needed since the mmp updates are * outstanding write lock requests. This is needed since the mmp updates are
* time sensitive and failure to service them promptly will result in a * time sensitive and failure to service them promptly will result in a
* suspended pool. This pool suspension has been seen in practice when there is * suspended pool. This pool suspension has been seen in practice when there is
@ -560,7 +560,7 @@ spa_config_enter(spa_t *spa, int locks, const void *tag, krw_t rw)
*/ */
void void
spa_config_enter_mmp(spa_t *spa, int locks, const void *tag, krw_t rw) spa_config_enter_priority(spa_t *spa, int locks, const void *tag, krw_t rw)
{ {
spa_config_enter_impl(spa, locks, tag, rw, 1); spa_config_enter_impl(spa, locks, tag, rw, 1);
} }