summaryrefslogtreecommitdiff
path: root/lib/mm/memlock.c
diff options
context:
space:
mode:
authorPeter Rajnoha <prajnoha@redhat.com>2013-06-25 12:27:04 +0200
committerPeter Rajnoha <prajnoha@redhat.com>2013-07-02 15:19:08 +0200
commitebc236d085116e869b5873e2b5409674c2cd2a8d (patch)
treed5a3337462255ea3df80af0832bfccdc45aadd65 /lib/mm/memlock.c
parentf89a8b81cf795d9e658341b4755046b3824acdaa (diff)
downloadlvm2-ebc236d085116e869b5873e2b5409674c2cd2a8d.tar.gz
config: add support for loading profiles
This patch adds --profile arg to lvm cmds and adds config/profile_dir configuration setting to select the directory where profiles are stored By default it's /etc/lvm/profile. The profiles are added by using new "add_profile" fn and then loaded using the "load_profile" fn. All profiles are stored in a cmd context within the new "struct profile_params": struct profile_params { const char *dir; struct profile *global_profile; struct dm_list profiles_to_load; struct dm_list profiles; }; ...where "dir" is the directory with profiles, "global_profile" is the profile that is set globally via the --profile arg (IOW, not set per VG/LV basis based on metadata record) and the "profiles" is the list with loaded profiles.
Diffstat (limited to 'lib/mm/memlock.c')
-rw-r--r--lib/mm/memlock.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/mm/memlock.c b/lib/mm/memlock.c
index 08876b0e6..fda3bb81b 100644
--- a/lib/mm/memlock.c
+++ b/lib/mm/memlock.c
@@ -406,6 +406,13 @@ static void _unlock_mem_if_possible(struct cmd_context *cmd)
void critical_section_inc(struct cmd_context *cmd, const char *reason)
{
+ /*
+ * Profiles are loaded on-demand so make sure that before
+ * entering the critical section all needed profiles are
+ * loaded to avoid the disk access later.
+ */
+ load_pending_profiles(cmd);
+
if (!_critical_section) {
_critical_section = 1;
log_debug_mem("Entering critical section (%s).", reason);