From: Ian Kent Date: Wed, 16 Dec 2009 00:45:44 +0000 (-0800) Subject: autofs4: use helper function for need mount check X-Git-Tag: upstream/snapshot3+hdmi~16132^2~165 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=36b6413ef301d30f60037e497ecb902897895473;p=platform%2Fadaptation%2Frenesas_rcar%2Frenesas_kernel.git autofs4: use helper function for need mount check Define simple helper function for checking if we need to trigger a mount. Signed-off-by: Ian Kent Cc: Sage Weil Cc: Al Viro Cc: Andreas Dilger Cc: Christoph Hellwig Cc: Yehuda Saheh Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c index 2954ac5..f6e8ca9 100644 --- a/fs/autofs4/root.c +++ b/fs/autofs4/root.c @@ -104,6 +104,14 @@ static void autofs4_del_active(struct dentry *dentry) return; } +static unsigned int autofs4_need_mount(unsigned int flags) +{ + unsigned int res = 0; + if (flags & (TRIGGER_FLAGS | TRIGGER_INTENTS)) + res = 1; + return res; +} + static int autofs4_dir_open(struct inode *inode, struct file *file) { struct dentry *dentry = file->f_path.dentry; @@ -168,7 +176,7 @@ static int try_to_fill_dentry(struct dentry *dentry, int flags) } /* Trigger mount for path component or follow link */ } else if (dentry->d_flags & DCACHE_AUTOFS_PENDING || - flags & (TRIGGER_FLAGS | TRIGGER_INTENTS) || + autofs4_need_mount(flags) || current->link_count) { DPRINTK("waiting for mount name=%.*s", dentry->d_name.len, dentry->d_name.name); @@ -234,7 +242,7 @@ static void *autofs4_follow_link(struct dentry *dentry, struct nameidata *nd) autofs4_expire_wait(dentry); /* We trigger a mount for almost all flags */ - lookup_type = nd->flags & (TRIGGER_FLAGS | TRIGGER_INTENTS); + lookup_type = autofs4_need_mount(nd->flags); if (!(lookup_type || dentry->d_flags & DCACHE_AUTOFS_PENDING)) goto follow;