Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=3361c7bebbf207f57f3dd1282cd87e1e37c082ac
Commit:     3361c7bebbf207f57f3dd1282cd87e1e37c082ac
Parent:     9d0633cfedde484d30eef869f749c04709ab3e42
Author:     Jeffrey Layton <[EMAIL PROTECTED]>
AuthorDate: Tue May 8 00:29:48 2007 -0700
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Tue May 8 11:15:10 2007 -0700

    make iunique use a do/while loop rather than its obscure goto loop
    
    A while back, Christoph mentioned that he thought that iunique ought to be
    cleaned up to use a more conventional loop construct. This patch does that,
    turning the strange goto loop into a do/while.
    
    Signed-off-by: Jeff Layton <[EMAIL PROTECTED]>
    Cc: Christoph Hellwig <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 fs/inode.c |   24 ++++++++++--------------
 1 files changed, 10 insertions(+), 14 deletions(-)

diff --git a/fs/inode.c b/fs/inode.c
index c030894..81508b0 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -685,25 +685,21 @@ ino_t iunique(struct super_block *sb, ino_t max_reserved)
 {
        static ino_t counter;
        struct inode *inode;
-       struct hlist_head * head;
+       struct hlist_head *head;
        ino_t res;
+
        spin_lock(&inode_lock);
-retry:
-       if (counter > max_reserved) {
-               head = inode_hashtable + hash(sb,counter);
+       do {
+               if (counter <= max_reserved)
+                       counter = max_reserved + 1;
                res = counter++;
+               head = inode_hashtable + hash(sb, res);
                inode = find_inode_fast(sb, head, res);
-               if (!inode) {
-                       spin_unlock(&inode_lock);
-                       return res;
-               }
-       } else {
-               counter = max_reserved + 1;
-       }
-       goto retry;
-       
-}
+       } while (inode != NULL);
+       spin_unlock(&inode_lock);
 
+       return res;
+}
 EXPORT_SYMBOL(iunique);
 
 struct inode *igrab(struct inode *inode)
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to