Skip to contentSkip to conversation

dcache: Translating dentry into pathname without taking rename_lock

PATCH George Spelvin 2 participants 2 messages Sep 5, 2013 VFS

lore
Share & tools
lore
#0 lore raw

As long as you're removing locks from prepend_name and complicating its innards, I notice that each and every call site follows it by prepending "/". How about moving that into prepend_name as well?

Also, if you happen to feel like it, you can delete the slash flag and replace it with "bptr != *buffer".

Another small tweak would be to the global_root part of the code. You could move the is_mounted(vfsmnt) test up, and combine the tail of that code path with the regular exit. All you have to do is change the !slash test to:

	if (error >= 0 && bptr == *buffer) {	/* Root directory */
		if (--blen < 0)
			error = -ENAMETOOLONG;
		else
			*--bptr = '/';
	}

This modified form is no more code than an inlined copy of prepend(), so we haven't actually slowed the fast path, but it avoids corrupting the return value of 0/1/2 if possible.

#1 lore raw
Quoted 19 lines · George Spelvin

As long as you're removing locks from prepend_name and complicating its innards, I notice that each and every call site follows it by prepending "/". How about moving that into prepend_name as well?

Also, if you happen to feel like it, you can delete the slash flag and replace it with "bptr != *buffer".

Another small tweak would be to the global_root part of the code. You could move the is_mounted(vfsmnt) test up, and combine the tail of that code path with the regular exit. All you have to do is change the !slash test to:

	if (error>= 0&&  bptr == *buffer) {	/* Root directory */
		if (--blen<  0)
			error = -ENAMETOOLONG;
		else
			*--bptr = '/';
	}
Quoted 3 lines

This modified form is no more code than an inlined copy of prepend(), so we haven't actually slowed the fast path, but it avoids corrupting the return value of 0/1/2 if possible.

Thank for the suggestions. I will implement them in my v2 patch.

-Longman