mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joe Thornber <thornber@sistina.com>
To: Joe Thornber <thornber@sistina.com>
Cc: Linus Torvalds <torvalds@transmeta.com>,
	Linux Mailing List <linux-kernel@vger.kernel.org>
Subject: [PATCH 4/7] dm: Lift dm_div_up()
Date: Mon, 9 Jun 2003 15:36:43 +0100	[thread overview]
Message-ID: <20030609143643.GE11331@fib011235813.fsnet.co.uk> (raw)
In-Reply-To: <20030609142946.GA11331@fib011235813.fsnet.co.uk>

Pull dm_div_up() out of dm-table.c into dm.h
--- diff/drivers/md/dm-table.c	2003-06-09 15:05:08.000000000 +0100
+++ source/drivers/md/dm-table.c	2003-06-09 15:05:13.000000000 +0100
@@ -56,14 +56,6 @@
 };
 
 /*
- * Ceiling(n / size)
- */
-static inline unsigned long div_up(unsigned long n, unsigned long size)
-{
-	return dm_round_up(n, size) / size;
-}
-
-/*
  * Similar to ceiling(log_size(n))
  */
 static unsigned int int_log(unsigned long n, unsigned long base)
@@ -71,7 +63,7 @@
 	int result = 0;
 
 	while (n > 1) {
-		n = div_up(n, base);
+		n = dm_div_up(n, base);
 		result++;
 	}
 
@@ -664,7 +656,7 @@
 
 	/* allocate the space for *all* the indexes */
 	for (i = t->depth - 2; i >= 0; i--) {
-		t->counts[i] = div_up(t->counts[i + 1], CHILDREN_PER_NODE);
+		t->counts[i] = dm_div_up(t->counts[i + 1], CHILDREN_PER_NODE);
 		total += t->counts[i];
 	}
 
@@ -691,7 +683,7 @@
 	unsigned int leaf_nodes;
 
 	/* how many indexes will the btree have ? */
-	leaf_nodes = div_up(t->num_targets, KEYS_PER_NODE);
+	leaf_nodes = dm_div_up(t->num_targets, KEYS_PER_NODE);
 	t->depth = 1 + int_log(leaf_nodes, CHILDREN_PER_NODE);
 
 	/* leaf layer has already been set up */
--- diff/drivers/md/dm.h	2003-06-09 15:05:08.000000000 +0100
+++ source/drivers/md/dm.h	2003-06-09 15:05:13.000000000 +0100
@@ -135,6 +135,14 @@
 }
 
 /*
+ * Ceiling(n / size)
+ */
+static inline unsigned long dm_div_up(unsigned long n, unsigned long size)
+{
+	return dm_round_up(n, size) / size;
+}
+
+/*
  * The device-mapper can be driven through one of two interfaces;
  * ioctl or filesystem, depending which patch you have applied.
  */

  parent reply	other threads:[~2003-06-09 14:25 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-06-09 14:29 device-mapper patchset against 2.5.70 Joe Thornber
2003-06-09 14:34 ` [PATCH 1/7] dm: Replace __HIGH() and __LOW() macros Joe Thornber
2003-06-17 23:10   ` Adrian Bunk
2003-06-09 14:35 ` [PATCH 2/7] dm: signed/unsigned audit Joe Thornber
2003-06-09 15:03   ` Kevin Corry
2003-06-09 15:33     ` [PATCH 2/7 (corrected)] " Joe Thornber
2003-06-09 15:34     ` [PATCH 2/7] " Linus Torvalds
2003-06-09 14:36 ` [PATCH 3/7] dm: new suspend/resume target methods Joe Thornber
2003-06-09 14:36 ` Joe Thornber [this message]
2003-06-09 14:37 ` [PATCH 5/7] dm: Fix memory leak in dm_register_target() Joe Thornber
2003-06-09 14:37 ` [PATCH 6/7] dm: Remove some debug messages Joe Thornber
2003-06-09 14:38 ` [PATCH 7/7] dm: Remove an old FIXME 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=20030609143643.GE11331@fib011235813.fsnet.co.uk \
    --to=thornber@sistina.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®