All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jim Rees <rees@umich.edu>
To: Benny Halevy <bhalevy@panasas.com>
Cc: linux-nfs@vger.kernel.org, peter honeyman <honey@citi.umich.edu>
Subject: [PATCH] nfs-utils: calculate stripe device size during process phase
Date: Mon, 14 Feb 2011 14:32:33 -0500	[thread overview]
Message-ID: <20110214193233.GA3555@merit.edu> (raw)

If a device has stripe device components, the total size will be wrong.
Calculate the stripe device size earlier, during the process phase, so that
later devices will have the correct size.

Signed-off-by: Jim Rees <rees@umich.edu>
---
 utils/blkmapd/device-process.c |    3 ++-
 utils/blkmapd/dm-device.c      |    2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/utils/blkmapd/device-process.c b/utils/blkmapd/device-process.c
index b709b48..9a78457 100644
--- a/utils/blkmapd/device-process.c
+++ b/utils/blkmapd/device-process.c
@@ -318,7 +318,8 @@ decode_blk_volume(uint32_t **pp, uint32_t *end, struct bl_volume *vols, int voln
 			}
 		}
 		/* Truncate size to a stripe unit boundary */
-		vol->bv_size = vol->bv_vols[0]->bv_size & ~(chunksize - 1);
+		vol->bv_size = vol->bv_vols[0]->bv_size * vol->bv_vol_n;
+		vol->bv_size &= ~(chunksize - 1);
 		break;
 	case BLOCK_VOLUME_CONCAT:
 		BLK_READBUF(p, end, 4);
diff --git a/utils/blkmapd/dm-device.c b/utils/blkmapd/dm-device.c
index 2e87db8..c4fe4e9 100644
--- a/utils/blkmapd/dm-device.c
+++ b/utils/blkmapd/dm-device.c
@@ -418,7 +418,7 @@ uint64_t dm_device_create(struct bl_volume *vols, int num_vols)
 			stripe_size = stripe_unit * node->bv_vol_n;
 			nstripes = node->bv_size * node->bv_vol_n / stripe_size;
 			/* Make sure total size is a multiple of stripe size */
-			size = node->bv_size * node->bv_vol_n;
+			size = node->bv_size;
 			if (size % stripe_size != 0) {
 				/* XXX Should this be an error? */
 				BL_LOG_WARNING(
-- 
1.7.1

             reply	other threads:[~2011-02-14 19:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-14 19:32 Jim Rees [this message]
     [not found] ` <20110214193233.GA3555-8f4Pc2RrbJmHXe+LvDLADg@public.gmane.org>
2011-02-14 20:45   ` [PATCH] nfs-utils: calculate stripe device size during process phase Benny Halevy

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=20110214193233.GA3555@merit.edu \
    --to=rees@umich.edu \
    --cc=bhalevy@panasas.com \
    --cc=honey@citi.umich.edu \
    --cc=linux-nfs@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.