linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: pmeda@akamai.com
To: akpm@osdl.org
Cc: jack@suse.cz, linux-mm@kvack.org
Subject: [patch] ext2: Apply Jack's ext3 speedups
Date: Wed, 26 Jan 2005 23:22:39 -0800	[thread overview]
Message-ID: <200501270722.XAA10830@allur.sanmateo.akamai.com> (raw)


Apply ext3 speedups added by Jan Kara to ext2.
Reference: http://linus.bkbits.net:8080/linux-2.5/gnupatch@41f127f2jwYahmKm0eWTJNpYcSyhPw

Signed-off-by: Prasanna Meda <pmeda@akamai.com>

--- a/fs/ext2/balloc.c	Wed Jan 26 23:04:10 2005
+++ b/fs/ext2/balloc.c	Wed Jan 26 23:04:28 2005
@@ -53,8 +53,8 @@ struct ext2_group_desc * ext2_get_group_
 		return NULL;
 	}
 	
-	group_desc = block_group / EXT2_DESC_PER_BLOCK(sb);
-	offset = block_group % EXT2_DESC_PER_BLOCK(sb);
+	group_desc = block_group >> EXT2_DESC_PER_BLOCK_BITS(sb);
+	offset = block_group & (EXT2_DESC_PER_BLOCK(sb) - 1);
 	if (!sbi->s_group_desc[group_desc]) {
 		ext2_error (sb, "ext2_get_group_desc",
 			    "Group descriptor not loaded - "
@@ -575,19 +575,17 @@ block_in_use(unsigned long block, struct
 
 static inline int test_root(int a, int b)
 {
-	if (a == 0)
-		return 1;
-	while (1) {
-		if (a == 1)
-			return 1;
-		if (a % b)
-			return 0;
-		a = a / b;
-	}
+	int num = b;
+
+	while (a > num)
+		num *= b;
+	return num == a;
 }
 
 static int ext2_group_sparse(int group)
 {
+	if (group <= 0)
+		return 1;
 	return (test_root(group, 3) || test_root(group, 5) ||
 		test_root(group, 7));
 }
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"aart@kvack.org"> aart@kvack.org </a>

             reply	other threads:[~2005-01-27  7:18 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-27  7:22 pmeda [this message]
2005-01-27 20:52 ` Theodore Ts'o
2005-01-27 21:11   ` Andrew Morton
2005-01-27 21:41     ` Theodore Ts'o
2005-01-29  1:56   ` Prasanna Meda
2005-01-29  2:00     ` Prasanna Meda
2005-01-29  3:11     ` test_root reorder(Re: [patch] ext2: Apply Jack's ext3 speedups) Prasanna Meda
2005-01-31  9:51       ` Jan Kara
2005-01-31 19:19         ` Prasanna Meda

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=200501270722.XAA10830@allur.sanmateo.akamai.com \
    --to=pmeda@akamai.com \
    --cc=akpm@osdl.org \
    --cc=jack@suse.cz \
    --cc=linux-mm@kvack.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