autofs4: keep symlink body in inode->i_private

gets rid of all ->free()/->u.symlink machinery in autofs; we simply
keep symlink bodies in inode->i_private and free them in ->evict_inode().

Acked-by: Ian Kent <raven@themaw.net>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Al Viro 292c5ee8 c0bcc9d5

+9 -28
-5
fs/autofs4/autofs_i.h
··· 91 91 92 92 mode_t mode; 93 93 size_t size; 94 - 95 - void (*free)(struct autofs_info *); 96 - union { 97 - const char *symlink; 98 - } u; 99 94 }; 100 95 101 96 #define AUTOFS_INF_EXPIRING (1<<0) /* dentry is in the process of expiring */
+7 -20
fs/autofs4/inode.c
··· 22 22 #include "autofs_i.h" 23 23 #include <linux/module.h> 24 24 25 - static void ino_lnkfree(struct autofs_info *ino) 26 - { 27 - if (ino->u.symlink) { 28 - kfree(ino->u.symlink); 29 - ino->u.symlink = NULL; 30 - } 31 - } 32 - 33 25 struct autofs_info *autofs4_init_ino(struct autofs_info *ino, 34 26 struct autofs_sb_info *sbi, mode_t mode) 35 27 { ··· 52 60 53 61 ino->sbi = sbi; 54 62 55 - if (reinit && ino->free) 56 - (ino->free)(ino); 57 - 58 - memset(&ino->u, 0, sizeof(ino->u)); 59 - 60 - ino->free = NULL; 61 - 62 - if (S_ISLNK(mode)) 63 - ino->free = ino_lnkfree; 64 - 65 63 return ino; 66 64 } 67 65 ··· 61 79 ino->dentry->d_fsdata = NULL; 62 80 ino->dentry = NULL; 63 81 } 64 - if (ino->free) 65 - (ino->free)(ino); 66 82 kfree(ino); 67 83 } 68 84 ··· 116 136 return 0; 117 137 } 118 138 139 + static void autofs4_evict_inode(struct inode *inode) 140 + { 141 + end_writeback(inode); 142 + kfree(inode->i_private); 143 + } 144 + 119 145 static const struct super_operations autofs4_sops = { 120 146 .statfs = simple_statfs, 121 147 .show_options = autofs4_show_options, 148 + .evict_inode = autofs4_evict_inode, 122 149 }; 123 150 124 151 enum {Opt_err, Opt_fd, Opt_uid, Opt_gid, Opt_pgrp, Opt_minproto, Opt_maxproto,
+1 -1
fs/autofs4/root.c
··· 561 561 kfree(ino); 562 562 return -ENOMEM; 563 563 } 564 + inode->i_private = cp; 564 565 d_add(dentry, inode); 565 566 566 567 dentry->d_fsdata = ino; ··· 571 570 if (p_ino && dentry->d_parent != dentry) 572 571 atomic_inc(&p_ino->count); 573 572 574 - ino->u.symlink = cp; 575 573 dir->i_mtime = CURRENT_TIME; 576 574 577 575 return 0;
+1 -2
fs/autofs4/symlink.c
··· 14 14 15 15 static void *autofs4_follow_link(struct dentry *dentry, struct nameidata *nd) 16 16 { 17 - struct autofs_info *ino = autofs4_dentry_ino(dentry); 18 - nd_set_link(nd, (char *)ino->u.symlink); 17 + nd_set_link(nd, dentry->d_inode->i_private); 19 18 return NULL; 20 19 } 21 20