public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
* LVM2 ./WHATS_NEW_DM man/dmsetup.8.in tools/dms ...
@ 2012-01-11 12:46 prajnoha
  0 siblings, 0 replies; 5+ messages in thread
From: prajnoha @ 2012-01-11 12:46 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	prajnoha@sourceware.org	2012-01-11 12:46:20

Modified files:
	.              : WHATS_NEW_DM 
	man            : dmsetup.8.in 
	tools          : dmsetup.c 

Log message:
	Support different device name types on output of dmsetup deps, ls and info -c command.
	
	Add 'blkdevname' and 'blkdevs_used' field to dmsetup info -c -o.
	Add 'blkdevname' option to dmsetup ls --tree to see block device names.
	Add '-o options' to dmsetup deps and ls to select device name type on output.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW_DM.diff?cvsroot=lvm2&r1=1.530&r2=1.531
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/man/dmsetup.8.in.diff?cvsroot=lvm2&r1=1.48&r2=1.49
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/dmsetup.c.diff?cvsroot=lvm2&r1=1.170&r2=1.171

--- LVM2/WHATS_NEW_DM	2012/01/11 12:34:44	1.530
+++ LVM2/WHATS_NEW_DM	2012/01/11 12:46:19	1.531
@@ -1,5 +1,8 @@
 Version 1.02.68 -
 ==================================
+  Add 'blkdevname' and 'blkdevs_used' field to dmsetup info -c -o.
+  Add 'blkdevname' option to dmsetup ls --tree to see block device names.
+  Add '-o options' to dmsetup deps and ls to select device name type on output.
   Add dm_device_get_name to get map name or block device name for given devno.
   Remove empty devices when clearing left-over inactive tables in deptree.
   Add dm_uuid_prefix/dm_set_uuid_prefix to override hard-coded LVM- prefix.
--- LVM2/man/dmsetup.8.in	2012/01/09 12:28:47	1.48
+++ LVM2/man/dmsetup.8.in	2012/01/11 12:46:20	1.49
@@ -20,6 +20,8 @@
 .RE
 .br
 .B dmsetup deps
+.RB [ \-o
+.IR options ]
 .RI [ device_name ]
 .br
 .B dmsetup help
@@ -51,10 +53,9 @@
 .IR target_type ]
 .RB [ \-\-exec
 .IR command ]
-.RB [ \-\-tree
-.RS
+.RB [ \-\-tree ]
 .RB [ \-o
-.IR options ]]
+.IR options ]
 .RE
 .br
 .B dmsetup message
@@ -268,10 +269,14 @@
 .br
 .TP
 .B deps
+.RB [ \-o
+.IR options ]
 .RI [ device_name ]
 .br
-Outputs a list of (major, minor) pairs for devices referenced by the
-live table for the specified device.
+Outputs a list of devices referenced by the live table for the specified
+device. Device names on output can be customised by following options:
+devno (major and minor pair, used by default), blkdevname (block device name),
+devname (map name for device-mapper devices, equal to blkdevname otherwise).
 .br
 .TP
 .B help
@@ -323,17 +328,20 @@
 .IR target_type ]
 .RB [ \-\-exec
 .IR command ]
-.RB [ \-\-tree
+.RB [ \-\-tree ]
 .RB [ \-o
-.IR options ]]
+.IR options ]
 .br
 List device names.  Optionally only list devices that have at least
 one target of the specified type.  Optionally execute a command for
 each device.  The device name is appended to the supplied command.
+Device names on output can be customised by following options: devno (major
+and minor pair, used by default), blkdevname (block device name),
+devname (map name for device-mapper devices, equal to blkdevname otherwise).
 --tree displays dependencies between devices as a tree.
 It accepts a comma-separate list of options.
 Some specify the information displayed against each node:
-device/nodevice; active, open, rw, uuid.
+device/nodevice; blkdevname; active, open, rw, uuid.
 Others specify how the tree is displayed:
 ascii, utf, vt100; compact, inverted, notrunc.
 .br
--- LVM2/tools/dmsetup.c	2011/12/01 14:57:30	1.170
+++ LVM2/tools/dmsetup.c	2012/01/11 12:46:20	1.171
@@ -168,6 +168,12 @@
 	DR_NAME = 16
 } report_type_t;
 
+typedef enum {
+	DN_DEVNO,	/* Major and minor number pair */
+	DN_BLK,		/* Block device name (e.g. dm-0) */
+	DN_MAP		/* Map name (for dm devices only, equal to DN_BLK otherwise) */
+} dev_name_t;
+
 static int _switches[NUM_SWITCHES];
 static int _int_args[NUM_SWITCHES];
 static char *_string_args[NUM_SWITCHES];
@@ -182,6 +188,7 @@
 static struct dm_tree *_dtree;
 static struct dm_report *_report;
 static report_type_t _report_type;
+static dev_name_t _dev_name_type;
 
 /*
  * Commands
@@ -1767,6 +1774,8 @@
 	struct dm_task *dmt;
 	struct dm_info info;
 	char *name = NULL;
+	char dev_name[PATH_MAX];
+	int major, minor;
 
 	if (names)
 		name = names->name;
@@ -1813,10 +1822,17 @@
 		printf("%s: ", name);
 	printf("%d dependencies\t:", deps->count);
 
-	for (i = 0; i < deps->count; i++)
-		printf(" (%d, %d)",
-		       (int) MAJOR(deps->device[i]),
-		       (int) MINOR(deps->device[i]));
+	for (i = 0; i < deps->count; i++) {
+		major = (int) MAJOR(deps->device[i]);
+		minor = (int) MINOR(deps->device[i]);
+
+		if ((_dev_name_type == DN_BLK || _dev_name_type == DN_MAP) &&
+		    dm_device_get_name(major, minor, _dev_name_type == DN_BLK,
+				       dev_name, PATH_MAX))
+			printf(" (%s)", dev_name);
+		else
+			printf(" (%d, %d)", major, minor);
+	}
 	printf("\n");
 
 	if (multiple_devices && _switches[VERBOSE_ARG])
@@ -1831,8 +1847,16 @@
 
 static int _display_name(CMD_ARGS)
 {
-	printf("%s\t(%d, %d)\n", names->name,
-	       (int) MAJOR(names->dev), (int) MINOR(names->dev));
+	char dev_name[PATH_MAX];
+
+	if ((_dev_name_type == DN_BLK || _dev_name_type == DN_MAP) &&
+	    dm_device_get_name((int) MAJOR(names->dev), (int) MINOR(names->dev),
+			       _dev_name_type == DN_BLK, dev_name, PATH_MAX))
+		printf("%s\t(%s)\n", names->name, dev_name);
+	else
+		printf("%s\t(%d:%d)\n", names->name,
+					(int) MAJOR(names->dev),
+					(int) MINOR(names->dev));
 
 	return 1;
 }
@@ -1843,6 +1867,7 @@
 
 enum {
 	TR_DEVICE=0,	/* display device major:minor number */
+	TR_BLKDEVNAME,	/* display device kernel name */
 	TR_TABLE,
 	TR_STATUS,
 	TR_ACTIVE,
@@ -2062,6 +2087,7 @@
 	const char *name;
 	const struct dm_info *info;
 	int first_on_line = 0;
+	char dev_name[PATH_MAX];
 
 	/* Sub-tree for targets has 2 more depth */
 	if (depth + 2 > MAX_DEPTH)
@@ -2069,7 +2095,8 @@
 
 	name = dm_tree_node_get_name(node);
 
-	if ((!name || !*name) && !_tree_switches[TR_DEVICE])
+	if ((!name || !*name) &&
+	    (!_tree_switches[TR_DEVICE] && !_tree_switches[TR_BLKDEVNAME]))
 		return;
 
 	/* Indicate whether there are more nodes at this depth */
@@ -2094,6 +2121,13 @@
 
 	info = dm_tree_node_get_info(node);
 
+	if (_tree_switches[TR_BLKDEVNAME] &&
+	    dm_device_get_name(info->major, info->minor, 1, dev_name, PATH_MAX)) {
+		_out_string(name ? " <" : "<");
+		_out_string(dev_name);
+		_out_char('>');
+	}
+
 	if (_tree_switches[TR_DEVICE]) {
 		_out_string(name ? " (" : "(");
 		(void) _out_int(info->major);
@@ -2244,6 +2278,24 @@
 	return dm_report_field_uint32(rh, field, &value);
 }
 
+static int _dm_blk_name_disp(struct dm_report *rh,
+			     struct dm_pool *mem __attribute__((unused)),
+			     struct dm_report_field *field, const void *data,
+			     void *private __attribute__((unused)))
+{
+	char dev_name[PATH_MAX];
+	const char *s = dev_name;
+	const struct dm_info *info = data;
+
+	if (!dm_device_get_name(info->major, info->minor, 1, dev_name, PATH_MAX)) {
+		log_error("Could not resolve block device name for %d:%d.",
+			  info->major, info->minor);
+		return 0;
+	}
+
+	return dm_report_field_string(rh, field, &s);
+}
+
 static int _dm_info_status_disp(struct dm_report *rh,
 				struct dm_pool *mem __attribute__((unused)),
 				struct dm_report_field *field, const void *data,
@@ -2323,7 +2375,7 @@
 			       struct dm_report_field *field, const void *data,
 			       void *private)
 {
-	char buf[DM_MAX_TYPE_NAME], *repstr;
+	char buf[PATH_MAX], *repstr;
 	const struct dm_info *info = data;
 
 	if (!dm_pool_begin_object(mem, 8)) {
@@ -2331,10 +2383,17 @@
 		return 0;
 	}
 
-	if (dm_snprintf(buf, sizeof(buf), "%d:%d",
-			info->major, info->minor) < 0) {
-		log_error("dm_pool_alloc failed");
-		goto out_abandon;
+	if (private) {
+		if (!dm_device_get_name(info->major, info->minor,
+					1, buf, PATH_MAX))
+			goto out_abandon;
+	}
+	else {
+		if (dm_snprintf(buf, sizeof(buf), "%d:%d",
+				info->major, info->minor) < 0) {
+			log_error("dm_pool_alloc failed");
+			goto out_abandon;
+		}
 	}
 
 	if (!dm_pool_grow_object(mem, buf, strlen(buf) + 1)) {
@@ -2475,13 +2534,14 @@
 	return dm_report_field_int(rh, field, &num_parent);
 }
 
-static int _dm_deps_disp(struct dm_report *rh, struct dm_pool *mem,
-			 struct dm_report_field *field, const void *data,
-			 void *private)
+static int _dm_deps_disp_common(struct dm_report *rh, struct dm_pool*mem,
+				struct dm_report_field *field, const void *data,
+				void *private, int disp_blk_dev_names)
 {
 	const struct dm_deps *deps = data;
+	char buf[PATH_MAX], *repstr;
+	int major, minor;
 	unsigned i;
-	char buf[DM_MAX_TYPE_NAME], *repstr;
 
 	if (!dm_pool_begin_object(mem, 16)) {
 		log_error("dm_pool_begin_object failed");
@@ -2489,16 +2549,27 @@
 	}
 
 	for (i = 0; i < deps->count; i++) {
-		if (dm_snprintf(buf, sizeof(buf), "%d:%d",
-		       (int) MAJOR(deps->device[i]),
-		       (int) MINOR(deps->device[i])) < 0) {
+		major = (int) MAJOR(deps->device[i]);
+		minor = (int) MINOR(deps->device[i]);
+
+		if (disp_blk_dev_names) {
+			if (!dm_device_get_name(major, minor, 1, buf, PATH_MAX)) {
+				log_error("Could not resolve block device "
+					  "name for %d:%d.", major, minor);
+				goto out_abandon;
+			}
+		}
+		else if (dm_snprintf(buf, sizeof(buf), "%d:%d",
+				     major, minor) < 0) {
 			log_error("dm_snprintf failed");
 			goto out_abandon;
 		}
+
 		if (!dm_pool_grow_object(mem, buf, 0)) {
 			log_error("dm_pool_grow_object failed");
 			goto out_abandon;
 		}
+
 		if (i + 1 < deps->count && !dm_pool_grow_object(mem, ",", 1)) {
 			log_error("dm_pool_grow_object failed");
 			goto out_abandon;
@@ -2519,6 +2590,20 @@
 	return 0;
 }
 
+static int _dm_deps_disp(struct dm_report *rh, struct dm_pool *mem,
+			 struct dm_report_field *field, const void *data,
+			 void *private)
+{
+	return _dm_deps_disp_common(rh, mem, field, data, private, 0);
+}
+
+static int _dm_deps_blk_names_disp(struct dm_report *rh, struct dm_pool *mem,
+				   struct dm_report_field *field,
+				   const void *data, void *private)
+{
+	return _dm_deps_disp_common(rh, mem, field, data, private, 1);
+}
+
 static int _dm_subsystem_disp(struct dm_report *rh,
 			       struct dm_pool *mem __attribute__((unused)),
 			       struct dm_report_field *field, const void *data,
@@ -2603,6 +2688,7 @@
 /* FIXME Next one should be INFO */
 FIELD_F(TASK, NUM, "RAhead", 6, dm_read_ahead, "read_ahead", "Read ahead in sectors.")
 
+FIELD_F(INFO, STR, "BlkDevName", 16, dm_blk_name, "blkdevname", "Name of block device.")
 FIELD_F(INFO, STR, "Stat", 4, dm_info_status, "attr", "(L)ive, (I)nactive, (s)uspended, (r)ead-only, read-(w)rite.")
 FIELD_F(INFO, STR, "Tables", 6, dm_info_table_loaded, "tables_loaded", "Which of the live and inactive table slots are filled.")
 FIELD_F(INFO, STR, "Suspended", 9, dm_info_suspended, "suspended", "Whether the device is suspended.")
@@ -2617,6 +2703,7 @@
 FIELD_O(DEPS, dm_deps, NUM, "#Devs", count, 5, int32, "device_count", "Number of devices used by this one.")
 FIELD_F(TREE, STR, "DevNames", 8, dm_deps_names, "devs_used", "List of names of mapped devices used by this one.")
 FIELD_F(DEPS, STR, "DevNos", 6, dm_deps, "devnos_used", "List of device numbers of devices used by this one.")
+FIELD_F(DEPS, STR, "BlkDevNames", 16, dm_deps_blk_names, "blkdevs_used", "List of names of block devices used by this one.")
 
 FIELD_F(TREE, NUM, "#Refs", 5, dm_tree_parents_count, "device_ref_count", "Number of mapped devices referencing this one.")
 FIELD_F(TREE, STR, "RefNames", 8, dm_tree_parents_names, "names_using_dev", "List of names of mapped devices using this one.")
@@ -2785,9 +2872,9 @@
 	{"reload", "<device> [<table_file>]", 0, 2, 0, _load},
 	{"rename", "<device> [--setuuid] <new_name_or_uuid>", 1, 2, 0, _rename},
 	{"message", "<device> <sector> <message>", 2, -1, 0, _message},
-	{"ls", "[--target <target_type>] [--exec <command>] [--tree [-o options]]", 0, 0, 0, _ls},
+	{"ls", "[--target <target_type>] [--exec <command>] [-o options] [--tree]", 0, 0, 0, _ls},
 	{"info", "[<device>]", 0, -1, 1, _info},
-	{"deps", "[<device>]", 0, -1, 1, _deps},
+	{"deps", "[-o options] [<device>]", 0, -1, 1, _deps},
 	{"status", "[<device>] [--target <target_type>]", 0, -1, 1, _status},
 	{"table", "[<device>] [--target <target_type>] [--showkeys]", 0, -1, 1, _status},
 	{"wait", "<device> [<event_nr>]", 0, 2, 0, _wait},
@@ -2823,8 +2910,9 @@
 		     "-j <major> -m <minor>\n");
 	fprintf(out, "<fields> are comma-separated.  Use 'help -c' for list.\n");
 	fprintf(out, "Table_file contents may be supplied on stdin.\n");
-	fprintf(out, "Tree options are: ascii, utf, vt100; compact, inverted, notrunc;\n"
-		     "                  [no]device, active, open, rw and uuid.\n");
+	fprintf(out, "Options are: devno, devname, blkdevname.\n");
+	fprintf(out, "Tree specific options are: ascii, utf, vt100; compact, inverted, notrunc;\n"
+		     "                           blkdevname, [no]device, active, open, rw and uuid.\n");
 	fprintf(out, "\n");
 }
 
@@ -2888,6 +2976,8 @@
 			;
 		if (!strncmp(s, "device", len))
 			_tree_switches[TR_DEVICE] = 1;
+		else if (!strncmp(s, "blkdevname", len))
+			_tree_switches[TR_BLKDEVNAME] = 1;
 		else if (!strncmp(s, "nodevice", len))
 			_tree_switches[TR_DEVICE] = 0;
 		else if (!strncmp(s, "status", len))
@@ -3157,6 +3247,50 @@
 	return 1;
 }
 
+static int _process_options(const char *options)
+{
+	const char *s, *end;
+	size_t len;
+
+	/* Tree options are processed separately. */
+	if (_switches[TREE_ARG])
+		return _process_tree_options(_string_args[OPTIONS_ARG]);
+
+	/* Column options are processed separately by _report_init (called later). */
+	if (_switches[COLS_ARG])
+		return 1;
+
+	/* No options specified. */
+	if (!_switches[OPTIONS_ARG])
+		return 1;
+
+	/* Set defaults. */
+	_dev_name_type = DN_DEVNO;
+
+	/* Parse. */
+	for (s = options; s && *s; s++) {
+		len = 0;
+		for (end = s; *end && *end != ','; end++, len++)
+			;
+		if (!strncmp(s, "devno", len))
+			_dev_name_type = DN_DEVNO;
+		else if (!strncmp(s, "blkdevname", len))
+			_dev_name_type = DN_BLK;
+		else if (!strncmp(s, "devname", len))
+			_dev_name_type = DN_MAP;
+		else {
+			fprintf(stderr, "Option not recognised: %s\n", s);
+			return 0;
+		}
+
+		if (!*end)
+			break;
+		s = end;
+	}
+
+	return 1;
+}
+
 static int _process_switches(int *argc, char ***argv, const char *dev_dir)
 {
 	char *base, *namebase, *s;
@@ -3402,7 +3536,7 @@
 		return 0;
 	}
 
-	if (_switches[TREE_ARG] && !_process_tree_options(_string_args[OPTIONS_ARG]))
+	if (!_process_options(_string_args[OPTIONS_ARG]))
 		return 0;
 
 	if (_switches[TABLE_ARG] && _switches[NOTABLE_ARG]) {


^ permalink raw reply	[flat|nested] 5+ messages in thread

* LVM2 ./WHATS_NEW_DM man/dmsetup.8.in tools/dms ...
@ 2012-01-18 18:52 agk
  0 siblings, 0 replies; 5+ messages in thread
From: agk @ 2012-01-18 18:52 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk@sourceware.org	2012-01-18 18:52:03

Modified files:
	.              : WHATS_NEW_DM 
	man            : dmsetup.8.in 
	tools          : dmsetup.c 

Log message:
	Add dmsetup 'wipe_table' to replace table with one that uses error target.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW_DM.diff?cvsroot=lvm2&r1=1.531&r2=1.532
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/man/dmsetup.8.in.diff?cvsroot=lvm2&r1=1.49&r2=1.50
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/dmsetup.c.diff?cvsroot=lvm2&r1=1.171&r2=1.172

--- LVM2/WHATS_NEW_DM	2012/01/11 12:46:19	1.531
+++ LVM2/WHATS_NEW_DM	2012/01/18 18:52:02	1.532
@@ -1,5 +1,6 @@
 Version 1.02.68 -
 ==================================
+  Add dmsetup wipe_table to replace table with one that uses error target.
   Add 'blkdevname' and 'blkdevs_used' field to dmsetup info -c -o.
   Add 'blkdevname' option to dmsetup ls --tree to see block device names.
   Add '-o options' to dmsetup deps and ls to select device name type on output.
--- LVM2/man/dmsetup.8.in	2012/01/11 12:46:20	1.49
+++ LVM2/man/dmsetup.8.in	2012/01/18 18:52:02	1.50
@@ -69,6 +69,9 @@
 .RB [ \-\-table
 .RI < table >| table_file ]
 .br
+.B dmsetup wipe_table
+.I device_name
+.br
 .B dmsetup remove
 .RB [ \-f | \-\-force ]
 .RB [ \-\-retry ]
@@ -355,6 +358,15 @@
 If neither is supplied, reads a table from standard input.
 .br
 .HP
+.B wipe_table
+.I device_name
+.br
+Wait for any I/O in-flight through the device to complete, then
+replace the table with a new table that fails any new I/O
+sent to the device.  If successful, this should release any devices 
+held open by the device's table(s).
+.br
+.HP
 .B message
 .I device_name sector message
 .br
--- LVM2/tools/dmsetup.c	2012/01/11 12:46:20	1.171
+++ LVM2/tools/dmsetup.c	2012/01/18 18:52:02	1.172
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
- * Copyright (C) 2004-2011 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2004-2012 Red Hat, Inc. All rights reserved.
  * Copyright (C) 2005-2007 NEC Corporation
  *
  * This file is part of the device-mapper userspace tools.
@@ -2870,6 +2870,7 @@
 	{"load", "<device> [<table_file>]", 0, 2, 0, _load},
 	{"clear", "<device>", 0, -1, 1, _clear},
 	{"reload", "<device> [<table_file>]", 0, 2, 0, _load},
+	{"wipe_table", "<device>", 0, -1, 1, _error_device},
 	{"rename", "<device> [--setuuid] <new_name_or_uuid>", 1, 2, 0, _rename},
 	{"message", "<device> <sector> <message>", 2, -1, 0, _message},
 	{"ls", "[--target <target_type>] [--exec <command>] [-o options] [--tree]", 0, 0, 0, _ls},


^ permalink raw reply	[flat|nested] 5+ messages in thread

* LVM2 ./WHATS_NEW_DM man/dmsetup.8.in tools/dms ...
@ 2011-09-22 17:12 prajnoha
  0 siblings, 0 replies; 5+ messages in thread
From: prajnoha @ 2011-09-22 17:12 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	prajnoha@sourceware.org	2011-09-22 17:12:28

Modified files:
	.              : WHATS_NEW_DM 
	man            : dmsetup.8.in 
	tools          : dmsetup.c 

Log message:
	Add --retry option for dmsetup remove to retry removal if not successful.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW_DM.diff?cvsroot=lvm2&r1=1.500&r2=1.501
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/man/dmsetup.8.in.diff?cvsroot=lvm2&r1=1.42&r2=1.43
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/dmsetup.c.diff?cvsroot=lvm2&r1=1.168&r2=1.169

--- LVM2/WHATS_NEW_DM	2011/09/22 17:09:48	1.500
+++ LVM2/WHATS_NEW_DM	2011/09/22 17:12:28	1.501
@@ -1,5 +1,6 @@
 Version 1.02.68 -
 ==================================
+  Add --retry option for dmsetup remove to retry removal if not successful.
   Add dm_task_retry_remove fn to use retry logic for device removal.
   Remove unused passed parameters for _mirror_emit_segment_line().
   Add dm_config and string character escaping functions to libdevmapper.
--- LVM2/man/dmsetup.8.in	2011/07/01 14:09:20	1.42
+++ LVM2/man/dmsetup.8.in	2011/09/22 17:12:28	1.43
@@ -11,7 +11,7 @@
 .I [{ --addnodeonresume | --addnodeoncreate }]
 .br
 .B dmsetup remove
-.I [-f|--force] device_name
+.I [-f|--force] [--retry] device_name
 .br
 .B dmsetup remove_all
 .I [-f|--force]
@@ -280,7 +280,7 @@
 correspond to mapped devices currently loaded by the device-mapper kernel
 driver, adding, changing or removing nodes as necessary.
 .IP \fBremove
-.I [-f|--force] device_name
+.I [-f|--force] [--retry] device_name
 .br
 Removes a device.  It will no longer be visible to dmsetup.
 Open devices cannot be removed except with older kernels
@@ -290,7 +290,10 @@
 be removed because an uninterruptible process is waiting for
 I/O to return from it, adding --force will replace the table 
 with one that fails all I/O, which might allow the 
-process to be killed.
+process to be killed. If an attempt to remove a device fails,
+perhaps because a process run from a quick udev rule
+temporarily opened the device, the --retry option will cause
+the operation to be retried for a few seconds before failing.
 .IP \fBremove_all
 .I [-f|--force]
 .br
--- LVM2/tools/dmsetup.c	2011/08/11 19:18:18	1.168
+++ LVM2/tools/dmsetup.c	2011/09/22 17:12:28	1.169
@@ -140,6 +140,7 @@
 	NOUDEVSYNC_ARG,
 	OPTIONS_ARG,
 	READAHEAD_ARG,
+	RETRY_ARG,
 	ROWS_ARG,
 	SEPARATOR_ARG,
 	SETUUID_ARG,
@@ -1279,6 +1280,9 @@
 	if (udev_wait_flag && !dm_task_set_cookie(dmt, &cookie, udev_flags))
 		goto out;
 
+	if (_switches[RETRY_ARG] && task == DM_DEVICE_REMOVE)
+		dm_task_retry_remove(dmt);
+
 	r = dm_task_run(dmt);
 
       out:
@@ -2805,7 +2809,7 @@
 		"        [--checks] [-v|--verbose [-v|--verbose ...]]\n"
 		"        [-r|--readonly] [--noopencount] [--nolockfs] [--inactive]\n"
 		"        [--udevcookie [cookie]] [--noudevrules] [--noudevsync] [--verifyudev]\n"
-		"        [-y|--yes] [--readahead [+]<sectors>|auto|none]\n"
+		"        [-y|--yes] [--readahead [+]<sectors>|auto|none] [--retry]\n"
 		"        [-c|-C|--columns] [-o <fields>] [-O|--sort <sort_fields>]\n"
 		"        [--nameprefixes] [--noheadings] [--separator <separator>]\n\n");
 	for (i = 0; _commands[i].name; i++)
@@ -3178,6 +3182,7 @@
 		{"noudevsync", 0, &ind, NOUDEVSYNC_ARG},
 		{"options", 1, &ind, OPTIONS_ARG},
 		{"readahead", 1, &ind, READAHEAD_ARG},
+		{"retry", 0, &ind, RETRY_ARG},
 		{"rows", 0, &ind, ROWS_ARG},
 		{"separator", 1, &ind, SEPARATOR_ARG},
 		{"setuuid", 0, &ind, SETUUID_ARG},
@@ -3362,6 +3367,8 @@
 				}
 			}
 		}
+		if ((ind == RETRY_ARG))
+			_switches[RETRY_ARG]++;
 		if ((ind == ROWS_ARG))
 			_switches[ROWS_ARG]++;
 		if ((ind == SETUUID_ARG))


^ permalink raw reply	[flat|nested] 5+ messages in thread

* LVM2 ./WHATS_NEW_DM man/dmsetup.8.in tools/dms ...
@ 2010-03-08 16:05 mbroz
  0 siblings, 0 replies; 5+ messages in thread
From: mbroz @ 2010-03-08 16:05 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	mbroz@sourceware.org	2010-03-08 16:05:08

Modified files:
	.              : WHATS_NEW_DM 
	man            : dmsetup.8.in 
	tools          : dmsetup.c 

Log message:
	Add --help dmsetup option as the synonym for help command.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW_DM.diff?cvsroot=lvm2&r1=1.347&r2=1.348
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/man/dmsetup.8.in.diff?cvsroot=lvm2&r1=1.32&r2=1.33
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/dmsetup.c.diff?cvsroot=lvm2&r1=1.134&r2=1.135

--- LVM2/WHATS_NEW_DM	2010/03/08 16:04:32	1.347
+++ LVM2/WHATS_NEW_DM	2010/03/08 16:05:07	1.348
@@ -1,6 +1,7 @@
 Version 1.02.45 -
 ====================================
   Add --showkeys parameter description into dmsetup man page.
+  Add --help option as the synonym for help command.
 
 Version 1.02.44 - 15th February 2010
 ====================================
--- LVM2/man/dmsetup.8.in	2010/03/08 16:04:32	1.32
+++ LVM2/man/dmsetup.8.in	2010/03/08 16:05:08	1.33
@@ -112,6 +112,10 @@
 .IP \fB-c|-C|--columns
 .br
 Display output in columns rather than as Field: Value lines.
+.IP \fB-h|--help
+.br
+Outputs a summary of the commands available, optionally including
+the list of report fields (synonym with \fBhelp\fP command).
 .IP \fB--inactive
 .br
 When returning any table information from the kernel report on the 
--- LVM2/tools/dmsetup.c	2010/02/15 16:21:34	1.134
+++ LVM2/tools/dmsetup.c	2010/03/08 16:05:08	1.135
@@ -124,6 +124,7 @@
 	EXEC_ARG,
 	FORCE_ARG,
 	GID_ARG,
+	HELP_ARG,
 	INACTIVE_ARG,
 	MAJOR_ARG,
 	MINOR_ARG,
@@ -2720,7 +2721,8 @@
 	int i;
 
 	fprintf(out, "Usage:\n\n");
-	fprintf(out, "dmsetup [--version] [-v|--verbose [-v|--verbose ...]]\n"
+	fprintf(out, "dmsetup [--version] [-h|--help [-c|-C|--columns]]\n"
+		"        [-v|--verbose [-v|--verbose ...]]\n"
 		"        [-r|--readonly] [--noopencount] [--nolockfs] [--inactive]\n"
 		"        [--udevcookie] [--noudevrules] [--noudevsync] [-y|--yes]\n"
 		"        [--readahead [+]<sectors>|auto|none]\n"
@@ -3083,6 +3085,7 @@
 		{"exec", 1, &ind, EXEC_ARG},
 		{"force", 0, &ind, FORCE_ARG},
 		{"gid", 1, &ind, GID_ARG},
+		{"help", 0, &ind, HELP_ARG},
 		{"inactive", 0, &ind, INACTIVE_ARG},
 		{"major", 1, &ind, MAJOR_ARG},
 		{"minor", 1, &ind, MINOR_ARG},
@@ -3167,10 +3170,12 @@
 
 	optarg = 0;
 	optind = OPTIND_INIT;
-	while ((ind = -1, c = GETOPTLONG_FN(*argc, *argv, "cCfG:j:m:M:no:O:ru:U:vy",
+	while ((ind = -1, c = GETOPTLONG_FN(*argc, *argv, "cCfG:hj:m:M:no:O:ru:U:vy",
 					    long_options, NULL)) != -1) {
 		if (c == ':' || c == '?')
 			return 0;
+		if (c == 'h' || ind == HELP_ARG)
+			_switches[HELP_ARG]++;
 		if (c == 'c' || c == 'C' || ind == COLS_ARG)
 			_switches[COLS_ARG]++;
 		if (c == 'f' || ind == FORCE_ARG)
@@ -3329,6 +3334,11 @@
 		goto out;
 	}
 
+	if (_switches[HELP_ARG]) {
+		c = _find_command("help");
+		goto doit;
+	}
+
 	if (_switches[VERSION_ARG]) {
 		c = _find_command("version");
 		goto doit;


^ permalink raw reply	[flat|nested] 5+ messages in thread

* LVM2 ./WHATS_NEW_DM man/dmsetup.8.in tools/dms ...
@ 2010-01-07 19:45 prajnoha
  0 siblings, 0 replies; 5+ messages in thread
From: prajnoha @ 2010-01-07 19:45 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	prajnoha@sourceware.org	2010-01-07 19:45:12

Modified files:
	.              : WHATS_NEW_DM 
	man            : dmsetup.8.in 
	tools          : dmsetup.c 

Log message:
	Add --noudevrules option for dmsetup to disable /dev node management by udev.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW_DM.diff?cvsroot=lvm2&r1=1.324&r2=1.325
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/man/dmsetup.8.in.diff?cvsroot=lvm2&r1=1.29&r2=1.30
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/dmsetup.c.diff?cvsroot=lvm2&r1=1.130&r2=1.131

--- LVM2/WHATS_NEW_DM	2010/01/07 14:30:47	1.324
+++ LVM2/WHATS_NEW_DM	2010/01/07 19:45:12	1.325
@@ -1,5 +1,6 @@
 Version 1.02.41 -
 ====================================
+  Add --noudevrules option for dmsetup to disable /dev node management by udev.
   Update code to show all fields for 'dmsetup info -c -o all'.
   Return error from dm_tree_deactivate_children().
   Return error from dm_tree_suspend_children().
--- LVM2/man/dmsetup.8.in	2009/11/06 01:40:59	1.29
+++ LVM2/man/dmsetup.8.in	2010/01/07 19:45:12	1.30
@@ -127,6 +127,9 @@
 .IP \fB--notable
 .br
 When creating a device, don't load any table.
+.IP \fB--noudevrules
+Do not allow udev to manage nodes for devices in device-mapper directory.
+.br
 .IP \fB--noudevsync
 Do not synchronise with udev when creating, renaming or removing devices.
 .br
--- LVM2/tools/dmsetup.c	2009/12/11 13:16:39	1.130
+++ LVM2/tools/dmsetup.c	2010/01/07 19:45:12	1.131
@@ -127,6 +127,7 @@
 	NOLOCKFS_ARG,
 	NOOPENCOUNT_ARG,
 	NOTABLE_ARG,
+	NOUDEVRULES_ARG,
 	NOUDEVSYNC_ARG,
 	OPTIONS_ARG,
 	READAHEAD_ARG,
@@ -557,6 +558,7 @@
 	struct dm_task *dmt;
 	const char *file = NULL;
 	uint32_t cookie = 0;
+	uint16_t udev_flags = 0;
 
 	if (argc == 3)
 		file = argv[2];
@@ -605,7 +607,11 @@
 	if (_switches[NOTABLE_ARG])
 		dm_udev_set_sync_support(0);
 
-	if (!dm_task_set_cookie(dmt, &cookie, 0) ||
+	if (_switches[NOUDEVRULES_ARG])
+		udev_flags |= DM_UDEV_DISABLE_DM_RULES_FLAG |
+			      DM_UDEV_DISABLE_SUBSYSTEM_RULES_FLAG;
+
+	if (!dm_task_set_cookie(dmt, &cookie, udev_flags) ||
 	    !dm_task_run(dmt))
 		goto out;
 
@@ -626,6 +632,7 @@
 	int r = 0;
 	struct dm_task *dmt;
 	uint32_t cookie = 0;
+	uint16_t udev_flags = 0;
 
 	if (!(dmt = dm_task_create(DM_DEVICE_RENAME)))
 		return 0;
@@ -643,7 +650,11 @@
 	if (_switches[INACTIVE_ARG] && !dm_task_query_inactive_table(dmt))
 		goto out;
 
-	if (!dm_task_set_cookie(dmt, &cookie, 0) ||
+	if (_switches[NOUDEVRULES_ARG])
+		udev_flags |= DM_UDEV_DISABLE_DM_RULES_FLAG |
+			      DM_UDEV_DISABLE_SUBSYSTEM_RULES_FLAG;
+
+	if (!dm_task_set_cookie(dmt, &cookie, udev_flags) ||
 	    !dm_task_run(dmt))
 		goto out;
 
@@ -1011,6 +1022,7 @@
 static int _simple(int task, const char *name, uint32_t event_nr, int display)
 {
 	uint32_t cookie = 0;
+	uint16_t udev_flags = 0;
 	int udev_wait_flag = task == DM_DEVICE_RESUME ||
 			     task == DM_DEVICE_REMOVE;
 	int r = 0;
@@ -1043,7 +1055,11 @@
 				    _read_ahead_flags))
 		goto out;
 
-	if (udev_wait_flag && !dm_task_set_cookie(dmt, &cookie, 0))
+	if (_switches[NOUDEVRULES_ARG])
+		udev_flags |= DM_UDEV_DISABLE_DM_RULES_FLAG |
+			      DM_UDEV_DISABLE_SUBSYSTEM_RULES_FLAG;
+
+	if (udev_wait_flag && !dm_task_set_cookie(dmt, &cookie, udev_flags))
 		goto out;
 
 	r = dm_task_run(dmt);
@@ -2559,7 +2575,8 @@
 	fprintf(out, "Usage:\n\n");
 	fprintf(out, "dmsetup [--version] [-v|--verbose [-v|--verbose ...]]\n"
 		"        [-r|--readonly] [--noopencount] [--nolockfs] [--inactive]\n"
-		"        [--noudevsync] [-y|--yes] [--readahead [+]<sectors>|auto|none]\n"
+		"        [--noudevrules] [--noudevsync] [-y|--yes]\n"
+		"        [--readahead [+]<sectors>|auto|none]\n"
 		"        [-c|-C|--columns] [-o <fields>] [-O|--sort <sort_fields>]\n"
 		"        [--nameprefixes] [--noheadings] [--separator <separator>]\n\n");
 	for (i = 0; _commands[i].name; i++)
@@ -2927,6 +2944,7 @@
 		{"nolockfs", 0, &ind, NOLOCKFS_ARG},
 		{"noopencount", 0, &ind, NOOPENCOUNT_ARG},
 		{"notable", 0, &ind, NOTABLE_ARG},
+		{"noudevrules", 0, &ind, NOUDEVRULES_ARG},
 		{"noudevsync", 0, &ind, NOUDEVSYNC_ARG},
 		{"options", 1, &ind, OPTIONS_ARG},
 		{"readahead", 1, &ind, READAHEAD_ARG},
@@ -3039,6 +3057,8 @@
 		}
 		if (c == 'y' || ind == YES_ARG)
 			_switches[YES_ARG]++;
+		if (ind == NOUDEVRULES_ARG)
+			_switches[NOUDEVRULES_ARG]++;
 		if (ind == NOUDEVSYNC_ARG)
 			_switches[NOUDEVSYNC_ARG]++;
 		if (c == 'G' || ind == GID_ARG) {


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-01-18 18:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-11 12:46 LVM2 ./WHATS_NEW_DM man/dmsetup.8.in tools/dms prajnoha
  -- strict thread matches above, loose matches on Subject: below --
2012-01-18 18:52 agk
2011-09-22 17:12 prajnoha
2010-03-08 16:05 mbroz
2010-01-07 19:45 prajnoha

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).