Re: [PATCH] make iunique use a do/while loop rather than its obscure goto loop

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Apr 11, 2007 at 05:58:56PM -0400, Jeffrey Layton wrote:
> 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@xxxxxxxxxx>
> 
> diff --git a/fs/inode.c b/fs/inode.c
> index 23fc1fd..90e7587 100644
> --- a/fs/inode.c
> +++ b/fs/inode.c
> @@ -689,21 +689,18 @@ ino_t iunique(struct super_block *sb, ino_t max_reserved)
>  	struct inode *inode;
>  	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);
---end quoted text---
-
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux