aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2011-01-17 00:47:38 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2011-01-18 01:21:27 -0500
commit292c5ee802e9b969b84ee671a5e3001d94230f5b (patch)
tree616b0a583d17c50aedbb87082943248333d63c2b /fs
parentc0bcc9d55252012805300ca01b9b7a143b4daf85 (diff)
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>
Diffstat (limited to 'fs')
-rw-r--r--fs/autofs4/autofs_i.h5
-rw-r--r--fs/autofs4/inode.c27
-rw-r--r--fs/autofs4/root.c2
-rw-r--r--fs/autofs4/symlink.c3
4 files changed, 9 insertions, 28 deletions
diff --git a/fs/autofs4/autofs_i.h b/fs/autofs4/autofs_i.h
index 1f016bfb42d5..99a4af8d9c83 100644
--- a/fs/autofs4/autofs_i.h
+++ b/fs/autofs4/autofs_i.h
@@ -91,11 +91,6 @@ struct autofs_info {
91 91
92 mode_t mode; 92 mode_t mode;
93 size_t size; 93 size_t size;
94
95 void (*free)(struct autofs_info *);
96 union {
97 const char *symlink;
98 } u;
99}; 94};
100 95
101#define AUTOFS_INF_EXPIRING (1<<0) /* dentry is in the process of expiring */ 96#define AUTOFS_INF_EXPIRING (1<<0) /* dentry is in the process of expiring */
diff --git a/fs/autofs4/inode.c b/fs/autofs4/inode.c
index 9e1a9dad23e1..cf8abc793d50 100644
--- a/fs/autofs4/inode.c
+++ b/fs/autofs4/inode.c
@@ -22,14 +22,6 @@
22#include "autofs_i.h" 22#include "autofs_i.h"
23#include <linux/module.h> 23#include <linux/module.h>
24 24
25static 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
33struct autofs_info *autofs4_init_ino(struct autofs_info *ino, 25struct autofs_info *autofs4_init_ino(struct autofs_info *ino,
34 struct autofs_sb_info *sbi, mode_t mode) 26 struct autofs_sb_info *sbi, mode_t mode)
35{ 27{
@@ -60,16 +52,6 @@ struct autofs_info *autofs4_init_ino(struct autofs_info *ino,
60 52
61 ino->sbi = sbi; 53 ino->sbi = sbi;
62 54
63 if (reinit && ino->free)
64 (ino->free)(ino);
65
66 memset(&ino->u, 0, sizeof(ino->u));
67
68 ino->free = NULL;
69
70 if (S_ISLNK(mode))
71 ino->free = ino_lnkfree;
72
73 return ino; 55 return ino;
74} 56}
75 57
@@ -79,8 +61,6 @@ void autofs4_free_ino(struct autofs_info *ino)
79 ino->dentry->d_fsdata = NULL; 61 ino->dentry->d_fsdata = NULL;
80 ino->dentry = NULL; 62 ino->dentry = NULL;
81 } 63 }
82 if (ino->free)
83 (ino->free)(ino);
84 kfree(ino); 64 kfree(ino);
85} 65}
86 66
@@ -136,9 +116,16 @@ static int autofs4_show_options(struct seq_file *m, struct vfsmount *mnt)
136 return 0; 116 return 0;
137} 117}
138 118
119static void autofs4_evict_inode(struct inode *inode)
120{
121 end_writeback(inode);
122 kfree(inode->i_private);
123}
124
139static const struct super_operations autofs4_sops = { 125static const struct super_operations autofs4_sops = {
140 .statfs = simple_statfs, 126 .statfs = simple_statfs,
141 .show_options = autofs4_show_options, 127 .show_options = autofs4_show_options,
128 .evict_inode = autofs4_evict_inode,
142}; 129};
143 130
144enum {Opt_err, Opt_fd, Opt_uid, Opt_gid, Opt_pgrp, Opt_minproto, Opt_maxproto, 131enum {Opt_err, Opt_fd, Opt_uid, Opt_gid, Opt_pgrp, Opt_minproto, Opt_maxproto,
diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c
index 427129ab5292..f47aceabf58f 100644
--- a/fs/autofs4/root.c
+++ b/fs/autofs4/root.c
@@ -561,6 +561,7 @@ static int autofs4_dir_symlink(struct inode *dir,
561 kfree(ino); 561 kfree(ino);
562 return -ENOMEM; 562 return -ENOMEM;
563 } 563 }
564 inode->i_private = cp;
564 d_add(dentry, inode); 565 d_add(dentry, inode);
565 566
566 dentry->d_fsdata = ino; 567 dentry->d_fsdata = ino;
@@ -570,7 +571,6 @@ static int autofs4_dir_symlink(struct inode *dir,
570 if (p_ino && dentry->d_parent != dentry) 571 if (p_ino && dentry->d_parent != dentry)
571 atomic_inc(&p_ino->count); 572 atomic_inc(&p_ino->count);
572 573
573 ino->u.symlink = cp;
574 dir->i_mtime = CURRENT_TIME; 574 dir->i_mtime = CURRENT_TIME;
575 575
576 return 0; 576 return 0;
diff --git a/fs/autofs4/symlink.c b/fs/autofs4/symlink.c
index b4ea82934d2e..f27c094a1919 100644
--- a/fs/autofs4/symlink.c
+++ b/fs/autofs4/symlink.c
@@ -14,8 +14,7 @@
14 14
15static void *autofs4_follow_link(struct dentry *dentry, struct nameidata *nd) 15static void *autofs4_follow_link(struct dentry *dentry, struct nameidata *nd)
16{ 16{
17 struct autofs_info *ino = autofs4_dentry_ino(dentry); 17 nd_set_link(nd, dentry->d_inode->i_private);
18 nd_set_link(nd, (char *)ino->u.symlink);
19 return NULL; 18 return NULL;
20} 19}
21 20