All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takahiro Yasui <tyasui@redhat.com>
To: lvm-devel@redhat.com
Subject: [RFC PATCH 5/7] add metadata cache interface
Date: Thu, 02 Apr 2009 13:19:28 -0400	[thread overview]
Message-ID: <49D4F3A0.70906@redhat.com> (raw)
In-Reply-To: <49D3D9F5.902@redhat.com>

Metadata cache is loaded into lvmcache if the lvm configuration parameter,
"backup/metadata_cache" has a value of "1" and MCACHE_DISABLE flag is not
set in its lvm command context.


Signed-off-by: Takahiro Yasui <tyasui@redhat.com>
---
 lib/commands/toolcontext.c |   14 ++++++++++++++
 lib/config/defaults.h      |    1 +
 tools/lvmcmdline.c         |    4 ++++
 tools/tools.h              |    3 ++-
 4 files changed, 21 insertions(+), 1 deletion(-)

Index: LVM2.02.46-cvs-20090324/lib/commands/toolcontext.c
===================================================================
--- LVM2.02.46-cvs-20090324.orig/lib/commands/toolcontext.c
+++ LVM2.02.46-cvs-20090324/lib/commands/toolcontext.c
@@ -929,6 +929,7 @@ static int _init_backup(struct cmd_conte
 		log_warn("WARNING: Metadata changes will NOT be backed up");
 		backup_init(cmd, "", 0);
 		archive_init(cmd, "", 0, 0, 0);
+		mcache_init(cmd, "", 0);
 		return 1;
 	}
 
@@ -980,6 +981,19 @@ static int _init_backup(struct cmd_conte
 		return 0;
 	}
 
+	/* set up the metadata cache */
+	cmd->default_settings.mcache =
+		find_config_tree_bool(cmd, "backup/metadata_cache",
+				      DEFAULT_MCACHE_ENABLED);
+
+	/* TODO: Currently mcache uses the same directory as backup, but
+	 * mcache should be put in its own directory, ex) /etc/lvm/mcache.
+	 */
+	if (!mcache_init(cmd, dir, cmd->default_settings.mcache)) {
+		log_debug("mcache_init failed.");
+		return 0;
+	}
+
 	return 1;
 }
 
Index: LVM2.02.46-cvs-20090324/lib/config/defaults.h
===================================================================
--- LVM2.02.46-cvs-20090324.orig/lib/config/defaults.h
+++ LVM2.02.46-cvs-20090324/lib/config/defaults.h
@@ -18,6 +18,7 @@
 
 #define DEFAULT_ARCHIVE_ENABLED 1
 #define DEFAULT_BACKUP_ENABLED 1
+#define DEFAULT_MCACHE_ENABLED 0
 
 #define DEFAULT_ARCHIVE_SUBDIR "archive"
 #define DEFAULT_BACKUP_SUBDIR "backup"
Index: LVM2.02.46-cvs-20090324/tools/lvmcmdline.c
===================================================================
--- LVM2.02.46-cvs-20090324.orig/tools/lvmcmdline.c
+++ LVM2.02.46-cvs-20090324/tools/lvmcmdline.c
@@ -777,6 +777,7 @@ static int _get_settings(struct cmd_cont
 
 	cmd->current_settings.archive = arg_int_value(cmd, autobackup_ARG, cmd->current_settings.archive);
 	cmd->current_settings.backup = arg_int_value(cmd, autobackup_ARG, cmd->current_settings.backup);
+	cmd->current_settings.mcache &= cmd->command->flags & MCACHE_DISABLE ? 0 : 1;
 	cmd->current_settings.cache_vgmetadata = cmd->command->flags & CACHE_VGMETADATA ? 1 : 0;
 	cmd->partial_activation = 0;
 
@@ -892,6 +893,7 @@ static void _apply_settings(struct cmd_c
 
 	archive_enable(cmd, cmd->current_settings.archive);
 	backup_enable(cmd, cmd->current_settings.backup);
+	mcache_enable(cmd, cmd->current_settings.mcache);
 
 	set_activation(cmd->current_settings.activation);
 
@@ -1004,6 +1006,8 @@ int lvm_run_command(struct cmd_context *
 		goto out;
 	}
 
+	mcache_load(cmd);
+
 	ret = cmd->command->fn(cmd, argc, argv);
 
 	fin_locking();
Index: LVM2.02.46-cvs-20090324/tools/tools.h
===================================================================
--- LVM2.02.46-cvs-20090324.orig/tools/tools.h
+++ LVM2.02.46-cvs-20090324/tools/tools.h
@@ -116,7 +116,8 @@ struct arg {
 	void *ptr;
 };
 
-#define CACHE_VGMETADATA 0x00000001
+#define CACHE_VGMETADATA	0x00000001
+#define MCACHE_DISABLE		0x00000002
 
 /* a register of the lvm commands */
 struct command {






  parent reply	other threads:[~2009-04-02 17:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <49D3D9F5.902@redhat.com>
2009-04-02 17:19 ` [RFC PATCH 1/7] remove device scan from _text_create_text_instance Takahiro Yasui
2009-04-02 17:19 ` [RFC PATCH 2/7] rename _has_scanned to _need_scan Takahiro Yasui
2009-04-02 17:19 ` [RFC PATCH 3/7] separate metadata parse and verification Takahiro Yasui
2009-04-02 17:19 ` [RFC PATCH 4/7] support metadata cache feature Takahiro Yasui
2009-04-02 17:19 ` Takahiro Yasui [this message]
2009-04-02 17:19 ` [RFC PATCH 6/7] individual lvm command settings Takahiro Yasui
2009-04-02 17:19 ` [RFC PATCH 7/7] introduce metadata cache feature Takahiro Yasui

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=49D4F3A0.70906@redhat.com \
    --to=tyasui@redhat.com \
    --cc=lvm-devel@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.