Commit 26e6c910670171410577c7df2aebe94cef76e150

Authored by Al Viro
1 parent 5a37db302e

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: Ian Kent <raven@themaw.net>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Showing 3 changed files with 15 additions and 26 deletions Side-by-side Diff

fs/autofs4/autofs_i.h
... ... @@ -277,7 +277,8 @@
277 277 /* Initializing function */
278 278  
279 279 int autofs4_fill_super(struct super_block *, void *, int);
280   -struct autofs_info *autofs4_init_ino(struct autofs_info *, struct autofs_sb_info *sbi);
  280 +struct autofs_info *autofs4_new_ino(struct autofs_sb_info *);
  281 +void autofs4_clean_ino(struct autofs_info *);
281 282  
282 283 /* Queue management functions */
283 284  
... ... @@ -22,35 +22,23 @@
22 22 #include "autofs_i.h"
23 23 #include <linux/module.h>
24 24  
25   -struct autofs_info *autofs4_init_ino(struct autofs_info *ino,
26   - struct autofs_sb_info *sbi)
  25 +struct autofs_info *autofs4_new_ino(struct autofs_sb_info *sbi)
27 26 {
28   - int reinit = 1;
29   -
30   - if (ino == NULL) {
31   - reinit = 0;
32   - ino = kmalloc(sizeof(*ino), GFP_KERNEL);
33   - }
34   -
35   - if (ino == NULL)
36   - return NULL;
37   -
38   - if (!reinit) {
39   - ino->flags = 0;
40   - ino->dentry = NULL;
  27 + struct autofs_info *ino = kzalloc(sizeof(*ino), GFP_KERNEL);
  28 + if (ino) {
41 29 INIT_LIST_HEAD(&ino->active);
42   - ino->active_count = 0;
43 30 INIT_LIST_HEAD(&ino->expiring);
44   - atomic_set(&ino->count, 0);
  31 + ino->last_used = jiffies;
  32 + ino->sbi = sbi;
45 33 }
  34 + return ino;
  35 +}
46 36  
  37 +void autofs4_clean_ino(struct autofs_info *ino)
  38 +{
47 39 ino->uid = 0;
48 40 ino->gid = 0;
49 41 ino->last_used = jiffies;
50   -
51   - ino->sbi = sbi;
52   -
53   - return ino;
54 42 }
55 43  
56 44 void autofs4_free_ino(struct autofs_info *ino)
... ... @@ -256,7 +244,7 @@
256 244 /*
257 245 * Get the root inode and dentry, but defer checking for errors.
258 246 */
259   - ino = autofs4_init_ino(NULL, sbi);
  247 + ino = autofs4_new_ino(sbi);
260 248 if (!ino)
261 249 goto fail_free;
262 250 root_inode = autofs4_get_inode(s, S_IFDIR | 0755);
... ... @@ -508,7 +508,7 @@
508 508 if (autofs_type_indirect(sbi->type) && IS_ROOT(dentry->d_parent))
509 509 __managed_dentry_set_managed(dentry);
510 510  
511   - ino = autofs4_init_ino(NULL, sbi);
  511 + ino = autofs4_new_ino(sbi);
512 512 if (!ino)
513 513 return ERR_PTR(-ENOMEM);
514 514  
... ... @@ -541,7 +541,7 @@
541 541  
542 542 BUG_ON(!ino);
543 543  
544   - autofs4_init_ino(ino, sbi);
  544 + autofs4_clean_ino(ino);
545 545  
546 546 autofs4_del_active(dentry);
547 547  
... ... @@ -732,7 +732,7 @@
732 732  
733 733 BUG_ON(!ino);
734 734  
735   - autofs4_init_ino(ino, sbi);
  735 + autofs4_clean_ino(ino);
736 736  
737 737 autofs4_del_active(dentry);
738 738