aboutsummaryrefslogtreecommitdiffstats
path: root/fs/exportfs/expfs.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2007-07-17 07:04:32 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-17 13:23:06 -0400
commitfb66a1989c8abc3015aa334f617658b277e5fe98 (patch)
treee4216b8aa64bfb0376fa91f890fb03ae19803ac4 /fs/exportfs/expfs.c
parentd7dd618a5901ce0b44ef518208b35f728775db74 (diff)
knfsd: exportfs: move acceptable check into find_acceptable_alias
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 <hch@lst.de> Signed-off-by: Neil Brown <neilb@suse.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/exportfs/expfs.c')
-rw-r--r--fs/exportfs/expfs.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/fs/exportfs/expfs.c b/fs/exportfs/expfs.c
index abf0a316aa1a..085d6c547f44 100644
--- a/fs/exportfs/expfs.c
+++ b/fs/exportfs/expfs.c
@@ -37,6 +37,9 @@ static int exportfs_get_name(struct dentry *dir, char *name,
37 return get_name(dir, name, child); 37 return get_name(dir, name, child);
38} 38}
39 39
40/*
41 * Check if the dentry or any of it's aliases is acceptable.
42 */
40static struct dentry * 43static struct dentry *
41find_acceptable_alias(struct dentry *result, 44find_acceptable_alias(struct dentry *result,
42 int (*acceptable)(void *context, struct dentry *dentry), 45 int (*acceptable)(void *context, struct dentry *dentry),
@@ -44,6 +47,9 @@ find_acceptable_alias(struct dentry *result,
44{ 47{
45 struct dentry *dentry, *toput = NULL; 48 struct dentry *dentry, *toput = NULL;
46 49
50 if (acceptable(context, result))
51 return result;
52
47 spin_lock(&dcache_lock); 53 spin_lock(&dcache_lock);
48 list_for_each_entry(dentry, &result->d_inode->i_dentry, d_alias) { 54 list_for_each_entry(dentry, &result->d_inode->i_dentry, d_alias) {
49 dget_locked(dentry); 55 dget_locked(dentry);
@@ -126,9 +132,6 @@ find_exported_dentry(struct super_block *sb, void *obj, void *parent,
126 132
127 target_dir = dget(result); 133 target_dir = dget(result);
128 } else { 134 } else {
129 if (acceptable(context, result))
130 return result;
131
132 alias = find_acceptable_alias(result, acceptable, context); 135 alias = find_acceptable_alias(result, acceptable, context);
133 if (alias) 136 if (alias)
134 return alias; 137 return alias;
@@ -289,9 +292,6 @@ find_exported_dentry(struct super_block *sb, void *obj, void *parent,
289 } 292 }
290 } 293 }
291 dput(target_dir); 294 dput(target_dir);
292 /* now result is properly connected, it is our best bet */
293 if (acceptable(context, result))
294 return result;
295 295
296 alias = find_acceptable_alias(result, acceptable, context); 296 alias = find_acceptable_alias(result, acceptable, context);
297 if (alias) 297 if (alias)