aboutsummaryrefslogtreecommitdiffstats
path: root/fs/inode.c
diff options
context:
space:
mode:
authorJeffrey Layton <jlayton@redhat.com>2007-05-08 03:29:48 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-08 14:15:10 -0400
commit3361c7bebbf207f57f3dd1282cd87e1e37c082ac (patch)
tree53c5ee74c70ed9727964996f3cf2fa4a0ff368ea /fs/inode.c
parent9d0633cfedde484d30eef869f749c04709ab3e42 (diff)
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 <jlayton@redhat.com> Cc: Christoph Hellwig <hch@lst.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/inode.c')
-rw-r--r--fs/inode.c24
1 files changed, 10 insertions, 14 deletions
diff --git a/fs/inode.c b/fs/inode.c
index c03089421b6f..81508b0a3a70 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -685,25 +685,21 @@ ino_t iunique(struct super_block *sb, ino_t max_reserved)
685{ 685{
686 static ino_t counter; 686 static ino_t counter;
687 struct inode *inode; 687 struct inode *inode;
688 struct hlist_head * head; 688 struct hlist_head *head;
689 ino_t res; 689 ino_t res;
690
690 spin_lock(&inode_lock); 691 spin_lock(&inode_lock);
691retry: 692 do {
692 if (counter > max_reserved) { 693 if (counter <= max_reserved)
693 head = inode_hashtable + hash(sb,counter); 694 counter = max_reserved + 1;
694 res = counter++; 695 res = counter++;
696 head = inode_hashtable + hash(sb, res);
695 inode = find_inode_fast(sb, head, res); 697 inode = find_inode_fast(sb, head, res);
696 if (!inode) { 698 } while (inode != NULL);
697 spin_unlock(&inode_lock); 699 spin_unlock(&inode_lock);
698 return res;
699 }
700 } else {
701 counter = max_reserved + 1;
702 }
703 goto retry;
704
705}
706 700
701 return res;
702}
707EXPORT_SYMBOL(iunique); 703EXPORT_SYMBOL(iunique);
708 704
709struct inode *igrab(struct inode *inode) 705struct inode *igrab(struct inode *inode)