linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [patch] ext2: Apply Jack's ext3 speedups
@ 2005-01-27  7:22 pmeda
  2005-01-27 20:52 ` Theodore Ts'o
  0 siblings, 1 reply; 9+ messages in thread
From: pmeda @ 2005-01-27  7:22 UTC (permalink / raw)
  To: akpm; +Cc: jack, linux-mm


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>

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2005-01-31 19:15 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-27  7:22 [patch] ext2: Apply Jack's ext3 speedups pmeda
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox