mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
activation: separate prioritized counter
While prioritized_section() based on raised priority works nicely for standard lvm comman - separate counter is actually needed when it's used in daemons like clvmd/dmeventd where priority stays raised all the time.
This commit is contained in:
parent
f6f8f0c7fd
commit
9553dc7761
@ -87,6 +87,7 @@ static void *_malloc_mem = NULL;
|
|||||||
static int _mem_locked = 0;
|
static int _mem_locked = 0;
|
||||||
static int _priority_raised = 0;
|
static int _priority_raised = 0;
|
||||||
static int _critical_section = 0;
|
static int _critical_section = 0;
|
||||||
|
static int _prioritized_section = 0;
|
||||||
static int _memlock_count_daemon = 0;
|
static int _memlock_count_daemon = 0;
|
||||||
static int _priority;
|
static int _priority;
|
||||||
static int _default_priority;
|
static int _default_priority;
|
||||||
@ -618,6 +619,7 @@ void critical_section_inc(struct cmd_context *cmd, const char *reason)
|
|||||||
log_debug_activation("Entering prioritized section (%s).", reason);
|
log_debug_activation("Entering prioritized section (%s).", reason);
|
||||||
|
|
||||||
_raise_priority(cmd);
|
_raise_priority(cmd);
|
||||||
|
_prioritized_section++;
|
||||||
}
|
}
|
||||||
|
|
||||||
void critical_section_dec(struct cmd_context *cmd, const char *reason)
|
void critical_section_dec(struct cmd_context *cmd, const char *reason)
|
||||||
@ -627,6 +629,9 @@ void critical_section_dec(struct cmd_context *cmd, const char *reason)
|
|||||||
log_debug_activation("Leaving critical section (%s).", reason);
|
log_debug_activation("Leaving critical section (%s).", reason);
|
||||||
} else
|
} else
|
||||||
log_debug_activation("Leaving section (%s).", reason);
|
log_debug_activation("Leaving section (%s).", reason);
|
||||||
|
|
||||||
|
if (_prioritized_section > 0)
|
||||||
|
_prioritized_section--;
|
||||||
}
|
}
|
||||||
|
|
||||||
int critical_section(void)
|
int critical_section(void)
|
||||||
@ -636,7 +641,7 @@ int critical_section(void)
|
|||||||
|
|
||||||
int prioritized_section(void)
|
int prioritized_section(void)
|
||||||
{
|
{
|
||||||
return _priority_raised;
|
return _prioritized_section;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -680,6 +685,7 @@ void memlock_reset(void)
|
|||||||
_mem_locked = 0;
|
_mem_locked = 0;
|
||||||
_priority_raised = 0;
|
_priority_raised = 0;
|
||||||
_critical_section = 0;
|
_critical_section = 0;
|
||||||
|
_prioritized_section = 0;
|
||||||
_memlock_count_daemon = 0;
|
_memlock_count_daemon = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user