Re: [RFC][PATCH 5/14] Introduce union stack

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

 



On May 14 2007 13:23, Badari Pulavarty wrote:
>> +static inline void union_lock_fs(struct fs_struct *fs)
>> +{
>> +	int locked;
>> +
>> +	while (fs) {
>> +		locked = union_trylock(fs->root);
>> +		if (!locked)
>> +			goto loop1;
>> +		locked = union_trylock(fs->altroot);
>> +		if (!locked)
>> +			goto loop2;
>> +		locked = union_trylock(fs->pwd);
>> +		if (!locked)
>> +			goto loop3;
>> +		break;
                ^^^^^^
>> +	loop3:
>> +		union_unlock(fs->altroot);
>> +	loop2:
>> +		union_unlock(fs->root);
>> +	loop1:
>> +		read_unlock(&fs->lock);
>> +		UM_DEBUG_LOCK("Failed to get all semaphores in fs_struct!\n");
>> +		cpu_relax();
>> +		read_lock(&fs->lock);
>> +		continue;
>
>Nit.. why "continue" ?

There's your break. Oh right, the continue is superfluous.

At the risk of using yet another goto, the conditional jump
could be turned into an inconditional one, since 'fs' will
remain valid. (Compiler smart enough to figure out?)

>> +	while (fs) {
	loop0:
>> +		locked = union_trylock(fs->root);
>> +		if (!locked)
>> +			goto loop1;
>> +		locked = union_trylock(fs->altroot);
>> +		if (!locked)
>> +			goto loop2;
>> +		locked = union_trylock(fs->pwd);
>> +		if (!locked)
>> +			goto loop3;
>> +		break;
>> +	loop3:
>> +		union_unlock(fs->altroot);
>> +	loop2:
>> +		union_unlock(fs->root);
>> +	loop1:
>> +		read_unlock(&fs->lock);
>> +		UM_DEBUG_LOCK("Failed to get all semaphores in fs_struct!\n");
>> +		cpu_relax();
>> +		read_lock(&fs->lock);
		/* continue */
		goto loop0;
	}


	Jan
-- 
-
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