linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joe Thornber <thornber@sistina.com>
To: Joe Thornber <thornber@sistina.com>
Cc: Linus Torvalds <torvalds@osdl.org>,
	Andrew Morton <akpm@zip.com.au>,
	Linux Mailing List <linux-kernel@vger.kernel.org>
Subject: [Patch 6/6] dm: use sector_div()
Date: Thu, 31 Jul 2003 11:51:43 +0100	[thread overview]
Message-ID: <20030731105143.GJ394@fib011235813.fsnet.co.uk> (raw)
In-Reply-To: <20030731104517.GD394@fib011235813.fsnet.co.uk>

Use sector_div() rather than defining own version.  [Christophe Saout]
--- diff/drivers/md/dm-stripe.c	2003-06-30 10:07:21.000000000 +0100
+++ source/drivers/md/dm-stripe.c	2003-07-31 11:31:48.000000000 +0100
@@ -64,30 +64,6 @@
 }
 
 /*
- * FIXME: Nasty function, only present because we can't link
- * against __moddi3 and __divdi3.
- *
- * returns a == b * n
- */
-static int multiple(sector_t a, sector_t b, sector_t *n)
-{
-	sector_t acc, prev, i;
-
-	*n = 0;
-	while (a >= b) {
-		for (acc = b, prev = 0, i = 1;
-		     acc <= a;
-		     prev = acc, acc <<= 1, i <<= 1)
-			;
-
-		a -= prev;
-		*n += i >> 1;
-	}
-
-	return a == 0;
-}
-
-/*
  * Construct a striped mapping.
  * <number of stripes> <chunk size (2^^n)> [<dev_path> <offset>]+
  */
@@ -126,7 +102,8 @@
 		return -EINVAL;
 	}
 
-	if (!multiple(ti->len, stripes, &width)) {
+	width = ti->len;
+	if (sector_div(width, stripes)) {
 		ti->error = "dm-stripe: Target length not divisable by "
 		    "number of stripes";
 		return -EINVAL;

  parent reply	other threads:[~2003-07-31 10:54 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-31 10:45 2.6.0-test2 device mapper patchset Joe Thornber
2003-07-31 10:48 ` [Patch 1/6] dm: don't use MODULE_PARM Joe Thornber
2003-07-31 10:49 ` [Patch 2/6] dm: remove blk.h include Joe Thornber
2003-07-31 10:49 ` [Patch 3/6] dm: decimal device num sscanf Joe Thornber
2003-07-31 15:04   ` Christoph Hellwig
2003-07-31 15:13     ` Joe Thornber
2003-07-31 15:20       ` Christoph Hellwig
2003-07-31 15:24         ` Joe Thornber
2003-07-31 16:14           ` Christoph Hellwig
2003-07-31 16:27             ` Joe Thornber
2003-08-02 16:54               ` Christoph Hellwig
2003-07-31 16:13       ` Christophe Saout
2003-07-31 10:50 ` [Patch 4/6] dm: 64 bit ioctl fixes Joe Thornber
2003-07-31 10:51 ` [Patch 5/6] dm: missing #include Joe Thornber
2003-07-31 10:51 ` Joe Thornber [this message]
2003-07-31 10:57 ` [Patch 7/6 (so I can't count)] dm: resume() name clash Joe Thornber

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=20030731105143.GJ394@fib011235813.fsnet.co.uk \
    --to=thornber@sistina.com \
    --cc=akpm@zip.com.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.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 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 NNTP newsgroup(s).