All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Alexander E. Patrakov" <patrakov@ums.usu.ru>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: "H. Peter Anvin" <hpa@zytor.com>,
	Jan Engelhardt <jengelh@computergmbh.de>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Christophe Varoqui <christophe.varoqui@free.fr>
Subject: Re: [code] Unlimited partitions, a try
Date: Sat, 06 Oct 2007 14:36:43 +0600	[thread overview]
Message-ID: <4707491B.6060001@ums.usu.ru> (raw)
In-Reply-To: <20071006002919.0b32c8b9@the-village.bc.nu>

Alan Cox wrote:
> This was proposed ages ago. Al Viro vetoed sparse minors and it has been
> stuck this way ever since. If you have > 15 partitions use device mapper
> for it. I'd prefer it fixed but its arguable that device mapper is the
> right way to punt all our partitioning to userspace.
>   

Then please fix support for extended partitions in kpartx (part of 
multipath-tools). Debian has an incomplete patch that does the right 
thing on activation, but not on deactivation of partitions, and has an 
obvious off-by-one in the "kpartx -l /dev/sda" output.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Edited by Alexander E. Patrakov to fix incorrect output of "kpartx -l"
Signed-off-by: Alexander E. Patrakov <patrakov@ums.usu.ru>

--- a/kpartx/kpartx.c
+++ b/kpartx/kpartx.c
@@ -387,10 +387,10 @@ main(int argc, char **argv){
 					slices[j].minor = m++;
 
 					start = slices[j].start - slices[k].start;
-					printf("%s%s%d : 0 %lu /dev/dm-%d %lu\n",
+					printf("%s%s%d : 0 %lu %s%s%d %lu\n",
 					       mapname, delim, j+1,
 					       (unsigned long) slices[j].size,
-					       slices[k].minor, start);
+					       mapname, delim, k+1, start);
 					c--;
 				}
 				/* Terminate loop if nothing more to resolve */
@@ -431,7 +431,7 @@ main(int argc, char **argv){
 			break;
 
 		case ADD:
-			for (j=0, c = 0; j<n; j++) {
+			for (j = 0, c = 0; j < n; j++) {
 				if (slices[j].size == 0)
 					continue;
 
@@ -477,6 +477,7 @@ main(int argc, char **argv){
 			d = c;
 			while (c) {
 				for (j = 0; j < n; j++) {
+					unsigned long start;
 					int k = slices[j].container - 1;
 
 					if (slices[j].size == 0)
@@ -487,7 +488,7 @@ main(int argc, char **argv){
 						continue;
 
 					/* Skip all simple slices */
-					if (k < 0)
+					if (slices[j].container == 0)
 						continue;
 
 					/* Check container slice */
@@ -502,10 +503,11 @@ main(int argc, char **argv){
 					}
 					strip_slash(partname);
 
+					start = slices[j].start - slices[k].start;
 					if (safe_sprintf(params, "%d:%d %lu",
 							 slices[k].major,
 							 slices[k].minor,
-							 (unsigned long)slices[j].start)) {
+							 start)) {
 						fprintf(stderr, "params too small\n");
 						exit(1);
 					}
@@ -524,9 +526,12 @@ main(int argc, char **argv){
 						&slices[j].minor);
 
 					if (verbose)
-						printf("add map %s : 0 %lu %s %s\n",
-						       partname, slices[j].size,
-						       DM_TARGET, params);
+						printf("add map %s (%d:%d): 0 %lu %s\n",
+						       partname, 
+						       slices[j].major,
+						       slices[j].minor,
+						       slices[j].size,
+						       params);
 					c--;
 				}
 				/* Terminate loop */


-- 
Alexander E. Patrakov

      parent reply	other threads:[~2007-10-06  8:41 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-05 11:50 [code] Unlimited partitions, a try Jan Engelhardt
2007-10-05 22:11 ` H. Peter Anvin
2007-10-05 22:27   ` Jan Engelhardt
2007-10-05 22:57     ` H. Peter Anvin
2007-10-05 23:29   ` Alan Cox
2007-10-05 23:29     ` H. Peter Anvin
2007-10-06 19:33       ` Bill Davidsen
2007-10-09 18:15         ` Lennart Sorensen
2007-10-06  8:36     ` Alexander E. Patrakov [this message]

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=4707491B.6060001@ums.usu.ru \
    --to=patrakov@ums.usu.ru \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=christophe.varoqui@free.fr \
    --cc=hpa@zytor.com \
    --cc=jengelh@computergmbh.de \
    --cc=linux-kernel@vger.kernel.org \
    /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.