Skip to contentSkip to conversation

LVM2 ./WHATS_NEW lib/cache/lvmcache.c lib/comm ...

PATCH [email protected] 1 participant 1 message Apr 2, 2008

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: agk at sourceware.org 2008-04-02 21:23:39

Modified files:

	.              : WHATS_NEW 
	lib/cache      : lvmcache.c 
	lib/commands   : toolcontext.h 
	tools          : commands.h lvmcmdline.c tools.h 

Log message:
Add per-command flags to control which commands use the VG metadata cache.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.817&r2=1.818
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/cache/lvmcache.c.diff?cvsroot=lvm2&r1=1.40&r2=1.41
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/commands/toolcontext.h.diff?cvsroot=lvm2&r1=1.21&r2=1.22
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/commands.h.diff?cvsroot=lvm2&r1=1.108&r2=1.109
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvmcmdline.c.diff?cvsroot=lvm2&r1=1.61&r2=1.62
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/tools.h.diff?cvsroot=lvm2&r1=1.60&r2=1.61

WHATS_NEW +1 -0
@@ -1,5 +1,6 @@
 Version 2.02.34 -
 ===================================
+  Add per-command flags to control which commands use the VG metadata cache.
   Fix vgsplit locking, remove unneeded error messages when split into new VG.
   Suppress duplicate message when lvresize fails because of invalid vgname.
   Cache VG metadata internally while VG lock is held.
lib/cache/lvmcache.c +2 -1
@@ -868,7 +868,8 @@
 	}
 
 	/* store text representation of vg to cache */
-	if ((vginfo = vginfo_from_vgname(vg->name, NULL)))
+	if (vg->cmd->current_settings.cache_vgmetadata &&
+	    (vginfo = vginfo_from_vgname(vg->name, NULL)))
 		_store_metadata(vginfo, vg, precommitted);
 
 	return 1;
lib/commands/toolcontext.h +1 -0
@@ -34,6 +34,7 @@
 	int archive;		/* should we archive ? */
 	int backup;		/* should we backup ? */
 	int read_ahead;		/* DM_READ_AHEAD_NONE or _AUTO */
+	int cache_vgmetadata;
 	const char *msg_prefix;
 	struct format_type *fmt;
 	uint64_t unit_factor;
tools/commands.h +48 -0

331 lines not on this page · raw message

tools/lvmcmdline.c +11 -8
@@ -421,6 +421,7 @@
 }
 
 static void _create_new_command(const char *name, command_fn command,
+				unsigned flags,
 				const char *desc, const char *usagestr,
 				int nargs, int *args)
 {
@@ -434,12 +435,13 @@
 	nc->desc = desc;
 	nc->usage = usagestr;
 	nc->fn = command;
+	nc->flags = flags;
 	nc->num_args = nargs;
 	nc->valid_args = args;
 }
 
-static void _register_command(const char *name, command_fn fn,
-			      const char *desc, const char *usagestr, ...)
+static void _register_command(const char *name, command_fn fn, const char *desc,
+			      unsigned flags, const char *usagestr, ...)
 {
 	int nargs = 0, i;
 	int *args;
@@ -464,16 +466,16 @@
 	va_end(ap);
 
 	/* enter the command in the register */
-	_create_new_command(name, fn, desc, usagestr, nargs, args);
+	_create_new_command(name, fn, flags, desc, usagestr, nargs, args);
 }
 
 void lvm_register_commands(void)
 {
-#define xx(a, b, c...) _register_command(# a, a, b, ## c, \
-					driverloaded_ARG, \
-					debug_ARG, help_ARG, help2_ARG, \
-					version_ARG, verbose_ARG, \
-					quiet_ARG, config_ARG, -1);
+#define xx(a, b, c, d...) _register_command(# a, a, b, c, ## d, \
+					    driverloaded_ARG, \
+					    debug_ARG, help_ARG, help2_ARG, \
+					    version_ARG, verbose_ARG, \
+					    quiet_ARG, config_ARG, -1);
 #include "commands.h"
 #undef xx
 }
@@ -707,6 +709,7 @@
 
 	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.cache_vgmetadata = cmd->command->flags & CACHE_VGMETADATA ? 1 : 0;
 
 	if (arg_count(cmd, partial_ARG)) {
 		init_partial(1);
tools/tools.h +4 -0
@@ -117,6 +117,8 @@
 	void *ptr;
 };
 
+#define CACHE_VGMETADATA 0x00000001
+
 /* a register of the lvm commands */
 struct command {
 	const char *name;
@@ -124,6 +126,8 @@
 	const char *usage;
 	command_fn fn;
 
+	unsigned flags;
+
 	int num_args;
 	int *valid_args;
 };