linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3]fs/inode: iunique() Optimize Performance
@ 2009-11-25 14:09 Liuweni
  2009-11-25 14:15 ` Matthew Wilcox
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Liuweni @ 2009-11-25 14:09 UTC (permalink / raw)
  To: linux-kernel
  Cc: strongzgy, xgr178, Liu Hui, viro, akpm, jack, npiggin,
	linux-fsdevel, linux-kernel

---
move the if condition out the while{}.
While the function executing, the if 
condition won't check again and again.
And this code won't change the function
of iunique().

---
Signed-off-by: Liuwenyi<qingshenlwy@gmail.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Jan Kara <jack@suse.cz>
Cc: Nick Piggin <npiggin@suse.de>
Cc: linux-fsdevel@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
diff --git a/fs/inode.c b/fs/inode.c
index 4d8e3be..8ff1e99 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -838,9 +838,10 @@ ino_t iunique(struct super_block *sb, ino_t max_reserved)
 	ino_t res;
 
 	spin_lock(&inode_lock);
+
+	if (counter <= max_reserved)
+		counter = max_reserved + 1;
 	do {
-		if (counter <= max_reserved)
-			counter = max_reserved + 1;
 		res = counter++;
 		head = inode_hashtable + hash(sb, res);
 		inode = find_inode_fast(sb, head, res);

 				
--------------
Best Regards,
Liuweni
2009-11-25

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

end of thread, other threads:[~2009-12-02  9:42 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-25 14:09 [PATCH 1/3]fs/inode: iunique() Optimize Performance Liuweni
2009-11-25 14:15 ` Matthew Wilcox
2009-11-25 19:20   ` Jérémy Cochoy
2009-11-25 19:52     ` Matthew Wilcox
2009-12-01  5:01       ` liu weni
2009-12-01 12:03         ` Matthew Wilcox
2009-12-01 13:21           ` Liuweni
2009-12-01 14:00             ` Matthew Wilcox
2009-12-02  9:42               ` Nick Piggin
2009-11-25 14:51 ` Liuweni
2009-11-25 14:54   ` Matthew Wilcox
2009-11-25 15:06 ` Andi Kleen

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).