Skip to content

Commit

Permalink
knfsd: exportfs: move acceptable check into find_acceptable_alias
Browse files Browse the repository at this point in the history
All callers of find_acceptable_alias check if the current dentry is acceptable
before looking for other acceptable aliases using find_acceptable_alias.  Move
the check into find_acceptable_alias to make the code a little more dense and
add a comment to find_acceptable_alias that documents its intent.

Signed-off-by: Christoph Hellwig <[email protected]>
Signed-off-by: Neil Brown <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Christoph Hellwig authored and Linus Torvalds committed Jul 17, 2007
1 parent d7dd618 commit fb66a19
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions fs/exportfs/expfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,19 @@ static int exportfs_get_name(struct dentry *dir, char *name,
return get_name(dir, name, child);
}

/*
* Check if the dentry or any of it's aliases is acceptable.
*/
static struct dentry *
find_acceptable_alias(struct dentry *result,
int (*acceptable)(void *context, struct dentry *dentry),
void *context)
{
struct dentry *dentry, *toput = NULL;

if (acceptable(context, result))
return result;

spin_lock(&dcache_lock);
list_for_each_entry(dentry, &result->d_inode->i_dentry, d_alias) {
dget_locked(dentry);
Expand Down Expand Up @@ -126,9 +132,6 @@ find_exported_dentry(struct super_block *sb, void *obj, void *parent,

target_dir = dget(result);
} else {
if (acceptable(context, result))
return result;

alias = find_acceptable_alias(result, acceptable, context);
if (alias)
return alias;
Expand Down Expand Up @@ -289,9 +292,6 @@ find_exported_dentry(struct super_block *sb, void *obj, void *parent,
}
}
dput(target_dir);
/* now result is properly connected, it is our best bet */
if (acceptable(context, result))
return result;

alias = find_acceptable_alias(result, acceptable, context);
if (alias)
Expand Down

0 comments on commit fb66a19

Please sign in to comment.