diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2013-07-14 08:43:54 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2013-07-14 09:02:28 -0400 |
commit | a95e691f9c4a6e24fdeab6d7feae6d5411fe8a69 (patch) | |
tree | ebe142c51935b977861e9d911a505bc63ef8ee29 | |
parent | e9a17bd73a29e5323c37ec5ffe50fc0e825d3d03 (diff) |
rpc_create_*_dir: don't bother with qstr
just pass the name
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r-- | include/linux/sunrpc/rpc_pipe_fs.h | 4 | ||||
-rw-r--r-- | net/sunrpc/cache.c | 18 | ||||
-rw-r--r-- | net/sunrpc/clnt.c | 20 | ||||
-rw-r--r-- | net/sunrpc/rpc_pipe.c | 14 |
4 files changed, 23 insertions, 33 deletions
diff --git a/include/linux/sunrpc/rpc_pipe_fs.h b/include/linux/sunrpc/rpc_pipe_fs.h index a7b422b33eda..aa5b582cc471 100644 --- a/include/linux/sunrpc/rpc_pipe_fs.h +++ b/include/linux/sunrpc/rpc_pipe_fs.h | |||
@@ -73,12 +73,12 @@ extern ssize_t rpc_pipe_generic_upcall(struct file *, struct rpc_pipe_msg *, | |||
73 | extern int rpc_queue_upcall(struct rpc_pipe *, struct rpc_pipe_msg *); | 73 | extern int rpc_queue_upcall(struct rpc_pipe *, struct rpc_pipe_msg *); |
74 | 74 | ||
75 | struct rpc_clnt; | 75 | struct rpc_clnt; |
76 | extern struct dentry *rpc_create_client_dir(struct dentry *, struct qstr *, struct rpc_clnt *); | 76 | extern struct dentry *rpc_create_client_dir(struct dentry *, const char *, struct rpc_clnt *); |
77 | extern int rpc_remove_client_dir(struct dentry *); | 77 | extern int rpc_remove_client_dir(struct dentry *); |
78 | 78 | ||
79 | struct cache_detail; | 79 | struct cache_detail; |
80 | extern struct dentry *rpc_create_cache_dir(struct dentry *, | 80 | extern struct dentry *rpc_create_cache_dir(struct dentry *, |
81 | struct qstr *, | 81 | const char *, |
82 | umode_t umode, | 82 | umode_t umode, |
83 | struct cache_detail *); | 83 | struct cache_detail *); |
84 | extern void rpc_remove_cache_dir(struct dentry *); | 84 | extern void rpc_remove_cache_dir(struct dentry *); |
diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c index 80fe5c86efd1..b40f9567e628 100644 --- a/net/sunrpc/cache.c +++ b/net/sunrpc/cache.c | |||
@@ -1812,19 +1812,11 @@ int sunrpc_cache_register_pipefs(struct dentry *parent, | |||
1812 | const char *name, umode_t umode, | 1812 | const char *name, umode_t umode, |
1813 | struct cache_detail *cd) | 1813 | struct cache_detail *cd) |
1814 | { | 1814 | { |
1815 | struct qstr q; | 1815 | struct dentry *dir = rpc_create_cache_dir(parent, name, umode, cd); |
1816 | struct dentry *dir; | 1816 | if (IS_ERR(dir)) |
1817 | int ret = 0; | 1817 | return PTR_ERR(dir); |
1818 | 1818 | cd->u.pipefs.dir = dir; | |
1819 | q.name = name; | 1819 | return 0; |
1820 | q.len = strlen(name); | ||
1821 | q.hash = full_name_hash(q.name, q.len); | ||
1822 | dir = rpc_create_cache_dir(parent, &q, umode, cd); | ||
1823 | if (!IS_ERR(dir)) | ||
1824 | cd->u.pipefs.dir = dir; | ||
1825 | else | ||
1826 | ret = PTR_ERR(dir); | ||
1827 | return ret; | ||
1828 | } | 1820 | } |
1829 | EXPORT_SYMBOL_GPL(sunrpc_cache_register_pipefs); | 1821 | EXPORT_SYMBOL_GPL(sunrpc_cache_register_pipefs); |
1830 | 1822 | ||
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index 5a750b9c3640..26456274b24e 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c | |||
@@ -128,9 +128,7 @@ static struct dentry *rpc_setup_pipedir_sb(struct super_block *sb, | |||
128 | { | 128 | { |
129 | static uint32_t clntid; | 129 | static uint32_t clntid; |
130 | char name[15]; | 130 | char name[15]; |
131 | struct qstr q = { .name = name }; | ||
132 | struct dentry *dir, *dentry; | 131 | struct dentry *dir, *dentry; |
133 | int error; | ||
134 | 132 | ||
135 | dir = rpc_d_lookup_sb(sb, dir_name); | 133 | dir = rpc_d_lookup_sb(sb, dir_name); |
136 | if (dir == NULL) { | 134 | if (dir == NULL) { |
@@ -138,19 +136,17 @@ static struct dentry *rpc_setup_pipedir_sb(struct super_block *sb, | |||
138 | return dir; | 136 | return dir; |
139 | } | 137 | } |
140 | for (;;) { | 138 | for (;;) { |
141 | q.len = snprintf(name, sizeof(name), "clnt%x", (unsigned int)clntid++); | 139 | snprintf(name, sizeof(name), "clnt%x", (unsigned int)clntid++); |
142 | name[sizeof(name) - 1] = '\0'; | 140 | name[sizeof(name) - 1] = '\0'; |
143 | q.hash = full_name_hash(q.name, q.len); | 141 | dentry = rpc_create_client_dir(dir, name, clnt); |
144 | dentry = rpc_create_client_dir(dir, &q, clnt); | ||
145 | if (!IS_ERR(dentry)) | 142 | if (!IS_ERR(dentry)) |
146 | break; | 143 | break; |
147 | error = PTR_ERR(dentry); | 144 | if (dentry == ERR_PTR(-EEXIST)) |
148 | if (error != -EEXIST) { | 145 | continue; |
149 | printk(KERN_INFO "RPC: Couldn't create pipefs entry" | 146 | printk(KERN_INFO "RPC: Couldn't create pipefs entry" |
150 | " %s/%s, error %d\n", | 147 | " %s/%s, error %ld\n", |
151 | dir_name, name, error); | 148 | dir_name, name, PTR_ERR(dentry)); |
152 | break; | 149 | break; |
153 | } | ||
154 | } | 150 | } |
155 | dput(dir); | 151 | dput(dir); |
156 | return dentry; | 152 | return dentry; |
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c index e7ce4b3eb0bd..63364cb5d11a 100644 --- a/net/sunrpc/rpc_pipe.c +++ b/net/sunrpc/rpc_pipe.c | |||
@@ -770,15 +770,17 @@ out_bad: | |||
770 | } | 770 | } |
771 | 771 | ||
772 | static struct dentry *rpc_mkdir_populate(struct dentry *parent, | 772 | static struct dentry *rpc_mkdir_populate(struct dentry *parent, |
773 | struct qstr *name, umode_t mode, void *private, | 773 | const char *name, umode_t mode, void *private, |
774 | int (*populate)(struct dentry *, void *), void *args_populate) | 774 | int (*populate)(struct dentry *, void *), void *args_populate) |
775 | { | 775 | { |
776 | struct dentry *dentry; | 776 | struct dentry *dentry; |
777 | struct qstr q = QSTR_INIT(name, strlen(name)); | ||
777 | struct inode *dir = parent->d_inode; | 778 | struct inode *dir = parent->d_inode; |
778 | int error; | 779 | int error; |
779 | 780 | ||
781 | q.hash = full_name_hash(q.name, q.len); | ||
780 | mutex_lock_nested(&dir->i_mutex, I_MUTEX_PARENT); | 782 | mutex_lock_nested(&dir->i_mutex, I_MUTEX_PARENT); |
781 | dentry = __rpc_lookup_create_exclusive(parent, name); | 783 | dentry = __rpc_lookup_create_exclusive(parent, &q); |
782 | if (IS_ERR(dentry)) | 784 | if (IS_ERR(dentry)) |
783 | goto out; | 785 | goto out; |
784 | error = __rpc_mkdir(dir, dentry, mode, NULL, private); | 786 | error = __rpc_mkdir(dir, dentry, mode, NULL, private); |
@@ -925,8 +927,8 @@ static void rpc_clntdir_depopulate(struct dentry *dentry) | |||
925 | 927 | ||
926 | /** | 928 | /** |
927 | * rpc_create_client_dir - Create a new rpc_client directory in rpc_pipefs | 929 | * rpc_create_client_dir - Create a new rpc_client directory in rpc_pipefs |
928 | * @dentry: dentry from the rpc_pipefs root to the new directory | 930 | * @dentry: the parent of new directory |
929 | * @name: &struct qstr for the name | 931 | * @name: the name of new directory |
930 | * @rpc_client: rpc client to associate with this directory | 932 | * @rpc_client: rpc client to associate with this directory |
931 | * | 933 | * |
932 | * This creates a directory at the given @path associated with | 934 | * This creates a directory at the given @path associated with |
@@ -935,7 +937,7 @@ static void rpc_clntdir_depopulate(struct dentry *dentry) | |||
935 | * later be created using rpc_mkpipe(). | 937 | * later be created using rpc_mkpipe(). |
936 | */ | 938 | */ |
937 | struct dentry *rpc_create_client_dir(struct dentry *dentry, | 939 | struct dentry *rpc_create_client_dir(struct dentry *dentry, |
938 | struct qstr *name, | 940 | const char *name, |
939 | struct rpc_clnt *rpc_client) | 941 | struct rpc_clnt *rpc_client) |
940 | { | 942 | { |
941 | return rpc_mkdir_populate(dentry, name, S_IRUGO | S_IXUGO, NULL, | 943 | return rpc_mkdir_populate(dentry, name, S_IRUGO | S_IXUGO, NULL, |
@@ -981,7 +983,7 @@ static void rpc_cachedir_depopulate(struct dentry *dentry) | |||
981 | rpc_depopulate(dentry, cache_pipefs_files, 0, 3); | 983 | rpc_depopulate(dentry, cache_pipefs_files, 0, 3); |
982 | } | 984 | } |
983 | 985 | ||
984 | struct dentry *rpc_create_cache_dir(struct dentry *parent, struct qstr *name, | 986 | struct dentry *rpc_create_cache_dir(struct dentry *parent, const char *name, |
985 | umode_t umode, struct cache_detail *cd) | 987 | umode_t umode, struct cache_detail *cd) |
986 | { | 988 | { |
987 | return rpc_mkdir_populate(parent, name, umode, NULL, | 989 | return rpc_mkdir_populate(parent, name, umode, NULL, |