All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andre Noll <maan@systemlinux.org>
To: linux-raid@vger.kernel.org
Cc: neilb@suse.de, Andre Noll <maan@systemlinux.org>
Subject: [PATCH 5/6] md: linear.c: Make two local variables sector-based.
Date: Thu, 21 Aug 2008 15:35:34 +0200	[thread overview]
Message-ID: <1219325735-4111-6-git-send-email-maan@systemlinux.org> (raw)
In-Reply-To: <1219325735-4111-1-git-send-email-maan@systemlinux.org>

This is a preparation for representing also the remaining fields of struct
linear_private_data as sectors.

Signed-off-by: Andre Noll <maan@systemlinux.org>
---
 drivers/md/linear.c |   20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/md/linear.c b/drivers/md/linear.c
index f2d38e1..76a8a44 100644
--- a/drivers/md/linear.c
+++ b/drivers/md/linear.c
@@ -112,7 +112,7 @@ static linear_conf_t *linear_conf(mddev_t *mddev, int raid_disks)
 	dev_info_t **table;
 	mdk_rdev_t *rdev;
 	int i, nb_zone, cnt;
-	sector_t min_spacing;
+	sector_t min_sectors;
 	sector_t curr_sector;
 	struct list_head *tmp;
 
@@ -155,23 +155,23 @@ static linear_conf_t *linear_conf(mddev_t *mddev, int raid_disks)
 		goto out;
 	}
 
-	min_spacing = conf->array_sectors / 2;
-	sector_div(min_spacing, PAGE_SIZE/sizeof(struct dev_info *));
+	min_sectors = conf->array_sectors;
+	sector_div(min_sectors, PAGE_SIZE/sizeof(struct dev_info *));
 
-	/* min_spacing is the minimum spacing that will fit the hash
+	/* min_sectors is the minimum spacing that will fit the hash
 	 * table in one PAGE.  This may be much smaller than needed.
 	 * We find the smallest non-terminal set of consecutive devices
-	 * that is larger than min_spacing and use the size of that as
+	 * that is larger than min_sectors and use the size of that as
 	 * the actual spacing
 	 */
 	conf->hash_spacing = conf->array_sectors / 2;
 	for (i=0; i < cnt-1 ; i++) {
-		sector_t sz = 0;
+		sector_t tmp = 0;
 		int j;
-		for (j = i; j < cnt - 1 && sz < min_spacing; j++)
-			sz += conf->disks[j].num_sectors / 2;
-		if (sz >= min_spacing && sz < conf->hash_spacing)
-			conf->hash_spacing = sz;
+		for (j = i; j < cnt - 1 && tmp < min_sectors; j++)
+			tmp += conf->disks[j].num_sectors;
+		if (tmp >= min_sectors && tmp < conf->hash_spacing * 2)
+			conf->hash_spacing = tmp / 2;
 	}
 
 	/* hash_spacing may be too large for sector_div to work with,
-- 
1.5.3.8


  parent reply	other threads:[~2008-08-21 13:35 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-21 13:35 [PATCH 0/6] md: Make linear raid use sector_t for internal representations Andre Noll
2008-08-21 13:35 ` [PATCH 1/6] md: linear.c: Fix typo in comment Andre Noll
2008-08-21 13:35 ` [PATCH 2/6] md: linear.c: Remove pointless initialization of curr_offset Andre Noll
2008-08-21 13:35 ` [PATCH 3/6] md: linear.c: Remove broken debug code Andre Noll
2008-08-21 13:35 ` [PATCH 4/6] md: linear: Represent dev_info->size and dev_info->offset in sectors Andre Noll
2008-08-21 13:35 ` Andre Noll [this message]
2008-08-21 13:35 ` [PATCH 6/6] md: Convert remaining 1k representations in linear.c to sectors Andre Noll
  -- strict thread matches above, loose matches on Subject: below --
2008-07-25 15:27 [PATCH 0/6] md: Make linear raid use sector_t for internal representations Andre Noll
2008-07-25 15:27 ` [PATCH 5/6] md: linear.c: Make two local variables sector-based Andre Noll

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=1219325735-4111-6-git-send-email-maan@systemlinux.org \
    --to=maan@systemlinux.org \
    --cc=linux-raid@vger.kernel.org \
    --cc=neilb@suse.de \
    /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.