Commit 26e6c910 authored by Al Viro's avatar Al Viro

autofs4: split autofs4_init_ino()

split init_ino into new_ino and clean_ino; the former is
what used to be init_ino(NULL, sbi), the latter is for cases
where we passed non-NULL ino.  Lose unused arguments.
Acked-by: default avatarIan Kent <raven@themaw.net>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 5a37db30
...@@ -277,7 +277,8 @@ static inline void managed_dentry_clear_managed(struct dentry *dentry) ...@@ -277,7 +277,8 @@ static inline void managed_dentry_clear_managed(struct dentry *dentry)
/* Initializing function */ /* Initializing function */
int autofs4_fill_super(struct super_block *, void *, int); int autofs4_fill_super(struct super_block *, void *, int);
struct autofs_info *autofs4_init_ino(struct autofs_info *, struct autofs_sb_info *sbi); struct autofs_info *autofs4_new_ino(struct autofs_sb_info *);
void autofs4_clean_ino(struct autofs_info *);
/* Queue management functions */ /* Queue management functions */
......
...@@ -22,35 +22,23 @@ ...@@ -22,35 +22,23 @@
#include "autofs_i.h" #include "autofs_i.h"
#include <linux/module.h> #include <linux/module.h>
struct autofs_info *autofs4_init_ino(struct autofs_info *ino, struct autofs_info *autofs4_new_ino(struct autofs_sb_info *sbi)
struct autofs_sb_info *sbi)
{ {
int reinit = 1; struct autofs_info *ino = kzalloc(sizeof(*ino), GFP_KERNEL);
if (ino) {
if (ino == NULL) {
reinit = 0;
ino = kmalloc(sizeof(*ino), GFP_KERNEL);
}
if (ino == NULL)
return NULL;
if (!reinit) {
ino->flags = 0;
ino->dentry = NULL;
INIT_LIST_HEAD(&ino->active); INIT_LIST_HEAD(&ino->active);
ino->active_count = 0;
INIT_LIST_HEAD(&ino->expiring); INIT_LIST_HEAD(&ino->expiring);
atomic_set(&ino->count, 0); ino->last_used = jiffies;
ino->sbi = sbi;
} }
return ino;
}
void autofs4_clean_ino(struct autofs_info *ino)
{
ino->uid = 0; ino->uid = 0;
ino->gid = 0; ino->gid = 0;
ino->last_used = jiffies; ino->last_used = jiffies;
ino->sbi = sbi;
return ino;
} }
void autofs4_free_ino(struct autofs_info *ino) void autofs4_free_ino(struct autofs_info *ino)
...@@ -256,7 +244,7 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent) ...@@ -256,7 +244,7 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent)
/* /*
* Get the root inode and dentry, but defer checking for errors. * Get the root inode and dentry, but defer checking for errors.
*/ */
ino = autofs4_init_ino(NULL, sbi); ino = autofs4_new_ino(sbi);
if (!ino) if (!ino)
goto fail_free; goto fail_free;
root_inode = autofs4_get_inode(s, S_IFDIR | 0755); root_inode = autofs4_get_inode(s, S_IFDIR | 0755);
......
...@@ -508,7 +508,7 @@ static struct dentry *autofs4_lookup(struct inode *dir, struct dentry *dentry, s ...@@ -508,7 +508,7 @@ static struct dentry *autofs4_lookup(struct inode *dir, struct dentry *dentry, s
if (autofs_type_indirect(sbi->type) && IS_ROOT(dentry->d_parent)) if (autofs_type_indirect(sbi->type) && IS_ROOT(dentry->d_parent))
__managed_dentry_set_managed(dentry); __managed_dentry_set_managed(dentry);
ino = autofs4_init_ino(NULL, sbi); ino = autofs4_new_ino(sbi);
if (!ino) if (!ino)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
...@@ -541,7 +541,7 @@ static int autofs4_dir_symlink(struct inode *dir, ...@@ -541,7 +541,7 @@ static int autofs4_dir_symlink(struct inode *dir,
BUG_ON(!ino); BUG_ON(!ino);
autofs4_init_ino(ino, sbi); autofs4_clean_ino(ino);
autofs4_del_active(dentry); autofs4_del_active(dentry);
...@@ -732,7 +732,7 @@ static int autofs4_dir_mkdir(struct inode *dir, struct dentry *dentry, int mode) ...@@ -732,7 +732,7 @@ static int autofs4_dir_mkdir(struct inode *dir, struct dentry *dentry, int mode)
BUG_ON(!ino); BUG_ON(!ino);
autofs4_init_ino(ino, sbi); autofs4_clean_ino(ino);
autofs4_del_active(dentry); autofs4_del_active(dentry);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment