All of lore.kernel.org
 help / color / mirror / Atom feed
From: Benjamin Marzinski <bmarzins@redhat.com>
To: device-mapper development <dm-devel@redhat.com>
Subject: [PATCH] multipath: fix offset for containted slices.
Date: Thu, 25 Mar 2010 16:48:42 -0500	[thread overview]
Message-ID: <20100325214842.GH23952@ether.msp.redhat.com> (raw)

For contained slices, the offset of the new device should be from the start
of the containing device, which is what you are creating the new device on top
of.  It should not be the offset from the start of the entire disk.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
:100644 100644 b61a81f... 103ed0a... M	kpartx/kpartx.c
 kpartx/kpartx.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Index: multipath-tools-100322/kpartx/kpartx.c
===================================================================
--- multipath-tools-100322.orig/kpartx/kpartx.c
+++ multipath-tools-100322/kpartx/kpartx.c
@@ -488,6 +488,7 @@ main(int argc, char **argv){
 			d = c;
 			while (c) {
 				for (j = 0; j < n; j++) {
+					uint64_t start;
 					int k = slices[j].container - 1;
 
 					if (slices[j].size == 0)
@@ -498,7 +499,7 @@ main(int argc, char **argv){
 						continue;
 
 					/* Skip all simple slices */
-					if (k < 0)
+					if (slices[j].container == 0)
 						continue;
 
 					/* Check container slice */
@@ -513,10 +514,11 @@ main(int argc, char **argv){
 					}
 					strip_slash(partname);
 
+					start = slices[j].start - slices[k].start;
 					if (safe_sprintf(params, "%d:%d %" PRIu64,
 							 slices[k].major,
 							 slices[k].minor,
-							 slices[j].start)) {
+							 start)) {
 						fprintf(stderr, "params too small\n");
 						exit(1);
 					}

                 reply	other threads:[~2010-03-25 21:48 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20100325214842.GH23952@ether.msp.redhat.com \
    --to=bmarzins@redhat.com \
    --cc=dm-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.