aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2011-11-28 13:40:46 -0500
committerEric Van Hensbergen <ericvh@gmail.com>2012-01-05 11:51:44 -0500
commit5d3851530d6d68564e4e0ce04d0547d4d106fc72 (patch)
treed47065fcc1f93f00070afe597a98ab185fd13859
parenta0ea787b027b79cf2e01c6758e5246db06520158 (diff)
9p: Reduce object size with CONFIG_NET_9P_DEBUG
Reduce object size by deduplicating formats. Use vsprintf extension %pV. Rename P9_DPRINTK uses to p9_debug, align arguments. Add function for _p9_debug and macro to add __func__. Add missing "\n"s to p9_debug uses. Remove embedded function names as p9_debug adds it. Remove P9_EPRINTK macro and convert use to pr_<level>. Add and use pr_fmt and pr_<level>. $ size fs/9p/built-in.o* text data bss dec hex filename 62133 984 16000 79117 1350d fs/9p/built-in.o.new 67342 984 16928 85254 14d06 fs/9p/built-in.o.old $ size net/9p/built-in.o* text data bss dec hex filename 88792 4148 22024 114964 1c114 net/9p/built-in.o.new 94072 4148 23232 121452 1da6c net/9p/built-in.o.old Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
-rw-r--r--fs/9p/cache.c64
-rw-r--r--fs/9p/fid.c8
-rw-r--r--fs/9p/v9fs.c59
-rw-r--r--fs/9p/vfs_addr.c13
-rw-r--r--fs/9p/vfs_dentry.c12
-rw-r--r--fs/9p/vfs_dir.c13
-rw-r--r--fs/9p/vfs_file.c31
-rw-r--r--fs/9p/vfs_inode.c86
-rw-r--r--fs/9p/vfs_inode_dotl.c85
-rw-r--r--fs/9p/vfs_super.c12
-rw-r--r--fs/9p/xattr.c16
-rw-r--r--include/net/9p/9p.h28
-rw-r--r--net/9p/client.c242
-rw-r--r--net/9p/error.c6
-rw-r--r--net/9p/mod.c31
-rw-r--r--net/9p/protocol.c8
-rw-r--r--net/9p/trans_fd.c113
-rw-r--r--net/9p/trans_rdma.c26
-rw-r--r--net/9p/trans_virtio.c34
-rw-r--r--net/9p/util.c4
20 files changed, 452 insertions, 439 deletions
diff --git a/fs/9p/cache.c b/fs/9p/cache.c
index 945aa5f02f9b..a9ea73d6dcf3 100644
--- a/fs/9p/cache.c
+++ b/fs/9p/cache.c
@@ -62,8 +62,8 @@ static uint16_t v9fs_cache_session_get_key(const void *cookie_netfs_data,
62 uint16_t klen = 0; 62 uint16_t klen = 0;
63 63
64 v9ses = (struct v9fs_session_info *)cookie_netfs_data; 64 v9ses = (struct v9fs_session_info *)cookie_netfs_data;
65 P9_DPRINTK(P9_DEBUG_FSC, "session %p buf %p size %u", v9ses, 65 p9_debug(P9_DEBUG_FSC, "session %p buf %p size %u\n",
66 buffer, bufmax); 66 v9ses, buffer, bufmax);
67 67
68 if (v9ses->cachetag) 68 if (v9ses->cachetag)
69 klen = strlen(v9ses->cachetag); 69 klen = strlen(v9ses->cachetag);
@@ -72,7 +72,7 @@ static uint16_t v9fs_cache_session_get_key(const void *cookie_netfs_data,
72 return 0; 72 return 0;
73 73
74 memcpy(buffer, v9ses->cachetag, klen); 74 memcpy(buffer, v9ses->cachetag, klen);
75 P9_DPRINTK(P9_DEBUG_FSC, "cache session tag %s", v9ses->cachetag); 75 p9_debug(P9_DEBUG_FSC, "cache session tag %s\n", v9ses->cachetag);
76 return klen; 76 return klen;
77} 77}
78 78
@@ -91,14 +91,14 @@ void v9fs_cache_session_get_cookie(struct v9fs_session_info *v9ses)
91 v9ses->fscache = fscache_acquire_cookie(v9fs_cache_netfs.primary_index, 91 v9ses->fscache = fscache_acquire_cookie(v9fs_cache_netfs.primary_index,
92 &v9fs_cache_session_index_def, 92 &v9fs_cache_session_index_def,
93 v9ses); 93 v9ses);
94 P9_DPRINTK(P9_DEBUG_FSC, "session %p get cookie %p", v9ses, 94 p9_debug(P9_DEBUG_FSC, "session %p get cookie %p\n",
95 v9ses->fscache); 95 v9ses, v9ses->fscache);
96} 96}
97 97
98void v9fs_cache_session_put_cookie(struct v9fs_session_info *v9ses) 98void v9fs_cache_session_put_cookie(struct v9fs_session_info *v9ses)
99{ 99{
100 P9_DPRINTK(P9_DEBUG_FSC, "session %p put cookie %p", v9ses, 100 p9_debug(P9_DEBUG_FSC, "session %p put cookie %p\n",
101 v9ses->fscache); 101 v9ses, v9ses->fscache);
102 fscache_relinquish_cookie(v9ses->fscache, 0); 102 fscache_relinquish_cookie(v9ses->fscache, 0);
103 v9ses->fscache = NULL; 103 v9ses->fscache = NULL;
104} 104}
@@ -109,8 +109,8 @@ static uint16_t v9fs_cache_inode_get_key(const void *cookie_netfs_data,
109{ 109{
110 const struct v9fs_inode *v9inode = cookie_netfs_data; 110 const struct v9fs_inode *v9inode = cookie_netfs_data;
111 memcpy(buffer, &v9inode->qid.path, sizeof(v9inode->qid.path)); 111 memcpy(buffer, &v9inode->qid.path, sizeof(v9inode->qid.path));
112 P9_DPRINTK(P9_DEBUG_FSC, "inode %p get key %llu", &v9inode->vfs_inode, 112 p9_debug(P9_DEBUG_FSC, "inode %p get key %llu\n",
113 v9inode->qid.path); 113 &v9inode->vfs_inode, v9inode->qid.path);
114 return sizeof(v9inode->qid.path); 114 return sizeof(v9inode->qid.path);
115} 115}
116 116
@@ -120,8 +120,8 @@ static void v9fs_cache_inode_get_attr(const void *cookie_netfs_data,
120 const struct v9fs_inode *v9inode = cookie_netfs_data; 120 const struct v9fs_inode *v9inode = cookie_netfs_data;
121 *size = i_size_read(&v9inode->vfs_inode); 121 *size = i_size_read(&v9inode->vfs_inode);
122 122
123 P9_DPRINTK(P9_DEBUG_FSC, "inode %p get attr %llu", &v9inode->vfs_inode, 123 p9_debug(P9_DEBUG_FSC, "inode %p get attr %llu\n",
124 *size); 124 &v9inode->vfs_inode, *size);
125} 125}
126 126
127static uint16_t v9fs_cache_inode_get_aux(const void *cookie_netfs_data, 127static uint16_t v9fs_cache_inode_get_aux(const void *cookie_netfs_data,
@@ -129,8 +129,8 @@ static uint16_t v9fs_cache_inode_get_aux(const void *cookie_netfs_data,
129{ 129{
130 const struct v9fs_inode *v9inode = cookie_netfs_data; 130 const struct v9fs_inode *v9inode = cookie_netfs_data;
131 memcpy(buffer, &v9inode->qid.version, sizeof(v9inode->qid.version)); 131 memcpy(buffer, &v9inode->qid.version, sizeof(v9inode->qid.version));
132 P9_DPRINTK(P9_DEBUG_FSC, "inode %p get aux %u", &v9inode->vfs_inode, 132 p9_debug(P9_DEBUG_FSC, "inode %p get aux %u\n",
133 v9inode->qid.version); 133 &v9inode->vfs_inode, v9inode->qid.version);
134 return sizeof(v9inode->qid.version); 134 return sizeof(v9inode->qid.version);
135} 135}
136 136
@@ -206,8 +206,8 @@ void v9fs_cache_inode_get_cookie(struct inode *inode)
206 &v9fs_cache_inode_index_def, 206 &v9fs_cache_inode_index_def,
207 v9inode); 207 v9inode);
208 208
209 P9_DPRINTK(P9_DEBUG_FSC, "inode %p get cookie %p", inode, 209 p9_debug(P9_DEBUG_FSC, "inode %p get cookie %p\n",
210 v9inode->fscache); 210 inode, v9inode->fscache);
211} 211}
212 212
213void v9fs_cache_inode_put_cookie(struct inode *inode) 213void v9fs_cache_inode_put_cookie(struct inode *inode)
@@ -216,8 +216,8 @@ void v9fs_cache_inode_put_cookie(struct inode *inode)
216 216
217 if (!v9inode->fscache) 217 if (!v9inode->fscache)
218 return; 218 return;
219 P9_DPRINTK(P9_DEBUG_FSC, "inode %p put cookie %p", inode, 219 p9_debug(P9_DEBUG_FSC, "inode %p put cookie %p\n",
220 v9inode->fscache); 220 inode, v9inode->fscache);
221 221
222 fscache_relinquish_cookie(v9inode->fscache, 0); 222 fscache_relinquish_cookie(v9inode->fscache, 0);
223 v9inode->fscache = NULL; 223 v9inode->fscache = NULL;
@@ -229,8 +229,8 @@ void v9fs_cache_inode_flush_cookie(struct inode *inode)
229 229
230 if (!v9inode->fscache) 230 if (!v9inode->fscache)
231 return; 231 return;
232 P9_DPRINTK(P9_DEBUG_FSC, "inode %p flush cookie %p", inode, 232 p9_debug(P9_DEBUG_FSC, "inode %p flush cookie %p\n",
233 v9inode->fscache); 233 inode, v9inode->fscache);
234 234
235 fscache_relinquish_cookie(v9inode->fscache, 1); 235 fscache_relinquish_cookie(v9inode->fscache, 1);
236 v9inode->fscache = NULL; 236 v9inode->fscache = NULL;
@@ -272,8 +272,8 @@ void v9fs_cache_inode_reset_cookie(struct inode *inode)
272 v9inode->fscache = fscache_acquire_cookie(v9ses->fscache, 272 v9inode->fscache = fscache_acquire_cookie(v9ses->fscache,
273 &v9fs_cache_inode_index_def, 273 &v9fs_cache_inode_index_def,
274 v9inode); 274 v9inode);
275 P9_DPRINTK(P9_DEBUG_FSC, "inode %p revalidating cookie old %p new %p", 275 p9_debug(P9_DEBUG_FSC, "inode %p revalidating cookie old %p new %p\n",
276 inode, old, v9inode->fscache); 276 inode, old, v9inode->fscache);
277 277
278 spin_unlock(&v9inode->fscache_lock); 278 spin_unlock(&v9inode->fscache_lock);
279} 279}
@@ -323,7 +323,7 @@ int __v9fs_readpage_from_fscache(struct inode *inode, struct page *page)
323 int ret; 323 int ret;
324 const struct v9fs_inode *v9inode = V9FS_I(inode); 324 const struct v9fs_inode *v9inode = V9FS_I(inode);
325 325
326 P9_DPRINTK(P9_DEBUG_FSC, "inode %p page %p", inode, page); 326 p9_debug(P9_DEBUG_FSC, "inode %p page %p\n", inode, page);
327 if (!v9inode->fscache) 327 if (!v9inode->fscache)
328 return -ENOBUFS; 328 return -ENOBUFS;
329 329
@@ -335,13 +335,13 @@ int __v9fs_readpage_from_fscache(struct inode *inode, struct page *page)
335 switch (ret) { 335 switch (ret) {
336 case -ENOBUFS: 336 case -ENOBUFS:
337 case -ENODATA: 337 case -ENODATA:
338 P9_DPRINTK(P9_DEBUG_FSC, "page/inode not in cache %d", ret); 338 p9_debug(P9_DEBUG_FSC, "page/inode not in cache %d\n", ret);
339 return 1; 339 return 1;
340 case 0: 340 case 0:
341 P9_DPRINTK(P9_DEBUG_FSC, "BIO submitted"); 341 p9_debug(P9_DEBUG_FSC, "BIO submitted\n");
342 return ret; 342 return ret;
343 default: 343 default:
344 P9_DPRINTK(P9_DEBUG_FSC, "ret %d", ret); 344 p9_debug(P9_DEBUG_FSC, "ret %d\n", ret);
345 return ret; 345 return ret;
346 } 346 }
347} 347}
@@ -361,7 +361,7 @@ int __v9fs_readpages_from_fscache(struct inode *inode,
361 int ret; 361 int ret;
362 const struct v9fs_inode *v9inode = V9FS_I(inode); 362 const struct v9fs_inode *v9inode = V9FS_I(inode);
363 363
364 P9_DPRINTK(P9_DEBUG_FSC, "inode %p pages %u", inode, *nr_pages); 364 p9_debug(P9_DEBUG_FSC, "inode %p pages %u\n", inode, *nr_pages);
365 if (!v9inode->fscache) 365 if (!v9inode->fscache)
366 return -ENOBUFS; 366 return -ENOBUFS;
367 367
@@ -373,15 +373,15 @@ int __v9fs_readpages_from_fscache(struct inode *inode,
373 switch (ret) { 373 switch (ret) {
374 case -ENOBUFS: 374 case -ENOBUFS:
375 case -ENODATA: 375 case -ENODATA:
376 P9_DPRINTK(P9_DEBUG_FSC, "pages/inodes not in cache %d", ret); 376 p9_debug(P9_DEBUG_FSC, "pages/inodes not in cache %d\n", ret);
377 return 1; 377 return 1;
378 case 0: 378 case 0:
379 BUG_ON(!list_empty(pages)); 379 BUG_ON(!list_empty(pages));
380 BUG_ON(*nr_pages != 0); 380 BUG_ON(*nr_pages != 0);
381 P9_DPRINTK(P9_DEBUG_FSC, "BIO submitted"); 381 p9_debug(P9_DEBUG_FSC, "BIO submitted\n");
382 return ret; 382 return ret;
383 default: 383 default:
384 P9_DPRINTK(P9_DEBUG_FSC, "ret %d", ret); 384 p9_debug(P9_DEBUG_FSC, "ret %d\n", ret);
385 return ret; 385 return ret;
386 } 386 }
387} 387}
@@ -396,9 +396,9 @@ void __v9fs_readpage_to_fscache(struct inode *inode, struct page *page)
396 int ret; 396 int ret;
397 const struct v9fs_inode *v9inode = V9FS_I(inode); 397 const struct v9fs_inode *v9inode = V9FS_I(inode);
398 398
399 P9_DPRINTK(P9_DEBUG_FSC, "inode %p page %p", inode, page); 399 p9_debug(P9_DEBUG_FSC, "inode %p page %p\n", inode, page);
400 ret = fscache_write_page(v9inode->fscache, page, GFP_KERNEL); 400 ret = fscache_write_page(v9inode->fscache, page, GFP_KERNEL);
401 P9_DPRINTK(P9_DEBUG_FSC, "ret = %d", ret); 401 p9_debug(P9_DEBUG_FSC, "ret = %d\n", ret);
402 if (ret != 0) 402 if (ret != 0)
403 v9fs_uncache_page(inode, page); 403 v9fs_uncache_page(inode, page);
404} 404}
@@ -409,7 +409,7 @@ void __v9fs_readpage_to_fscache(struct inode *inode, struct page *page)
409void __v9fs_fscache_wait_on_page_write(struct inode *inode, struct page *page) 409void __v9fs_fscache_wait_on_page_write(struct inode *inode, struct page *page)
410{ 410{
411 const struct v9fs_inode *v9inode = V9FS_I(inode); 411 const struct v9fs_inode *v9inode = V9FS_I(inode);
412 P9_DPRINTK(P9_DEBUG_FSC, "inode %p page %p", inode, page); 412 p9_debug(P9_DEBUG_FSC, "inode %p page %p\n", inode, page);
413 if (PageFsCache(page)) 413 if (PageFsCache(page))
414 fscache_wait_on_page_write(v9inode->fscache, page); 414 fscache_wait_on_page_write(v9inode->fscache, page);
415} 415}
diff --git a/fs/9p/fid.c b/fs/9p/fid.c
index 85b67ffa2a43..da8eefbe830d 100644
--- a/fs/9p/fid.c
+++ b/fs/9p/fid.c
@@ -45,8 +45,8 @@ int v9fs_fid_add(struct dentry *dentry, struct p9_fid *fid)
45{ 45{
46 struct v9fs_dentry *dent; 46 struct v9fs_dentry *dent;
47 47
48 P9_DPRINTK(P9_DEBUG_VFS, "fid %d dentry %s\n", 48 p9_debug(P9_DEBUG_VFS, "fid %d dentry %s\n",
49 fid->fid, dentry->d_name.name); 49 fid->fid, dentry->d_name.name);
50 50
51 dent = dentry->d_fsdata; 51 dent = dentry->d_fsdata;
52 if (!dent) { 52 if (!dent) {
@@ -79,8 +79,8 @@ static struct p9_fid *v9fs_fid_find(struct dentry *dentry, u32 uid, int any)
79 struct v9fs_dentry *dent; 79 struct v9fs_dentry *dent;
80 struct p9_fid *fid, *ret; 80 struct p9_fid *fid, *ret;
81 81
82 P9_DPRINTK(P9_DEBUG_VFS, " dentry: %s (%p) uid %d any %d\n", 82 p9_debug(P9_DEBUG_VFS, " dentry: %s (%p) uid %d any %d\n",
83 dentry->d_name.name, dentry, uid, any); 83 dentry->d_name.name, dentry, uid, any);
84 dent = (struct v9fs_dentry *) dentry->d_fsdata; 84 dent = (struct v9fs_dentry *) dentry->d_fsdata;
85 ret = NULL; 85 ret = NULL;
86 if (dent) { 86 if (dent) {
diff --git a/fs/9p/v9fs.c b/fs/9p/v9fs.c
index 2b78014a124a..1964f98e74be 100644
--- a/fs/9p/v9fs.c
+++ b/fs/9p/v9fs.c
@@ -23,6 +23,8 @@
23 * 23 *
24 */ 24 */
25 25
26#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
27
26#include <linux/module.h> 28#include <linux/module.h>
27#include <linux/errno.h> 29#include <linux/errno.h>
28#include <linux/fs.h> 30#include <linux/fs.h>
@@ -85,15 +87,15 @@ static int get_cache_mode(char *s)
85 87
86 if (!strcmp(s, "loose")) { 88 if (!strcmp(s, "loose")) {
87 version = CACHE_LOOSE; 89 version = CACHE_LOOSE;
88 P9_DPRINTK(P9_DEBUG_9P, "Cache mode: loose\n"); 90 p9_debug(P9_DEBUG_9P, "Cache mode: loose\n");
89 } else if (!strcmp(s, "fscache")) { 91 } else if (!strcmp(s, "fscache")) {
90 version = CACHE_FSCACHE; 92 version = CACHE_FSCACHE;
91 P9_DPRINTK(P9_DEBUG_9P, "Cache mode: fscache\n"); 93 p9_debug(P9_DEBUG_9P, "Cache mode: fscache\n");
92 } else if (!strcmp(s, "none")) { 94 } else if (!strcmp(s, "none")) {
93 version = CACHE_NONE; 95 version = CACHE_NONE;
94 P9_DPRINTK(P9_DEBUG_9P, "Cache mode: none\n"); 96 p9_debug(P9_DEBUG_9P, "Cache mode: none\n");
95 } else 97 } else
96 printk(KERN_INFO "9p: Unknown Cache mode %s.\n", s); 98 pr_info("Unknown Cache mode %s\n", s);
97 return version; 99 return version;
98} 100}
99 101
@@ -140,8 +142,8 @@ static int v9fs_parse_options(struct v9fs_session_info *v9ses, char *opts)
140 case Opt_debug: 142 case Opt_debug:
141 r = match_int(&args[0], &option); 143 r = match_int(&args[0], &option);
142 if (r < 0) { 144 if (r < 0) {
143 P9_DPRINTK(P9_DEBUG_ERROR, 145 p9_debug(P9_DEBUG_ERROR,
144 "integer field, but no integer?\n"); 146 "integer field, but no integer?\n");
145 ret = r; 147 ret = r;
146 continue; 148 continue;
147 } 149 }
@@ -154,8 +156,8 @@ static int v9fs_parse_options(struct v9fs_session_info *v9ses, char *opts)
154 case Opt_dfltuid: 156 case Opt_dfltuid:
155 r = match_int(&args[0], &option); 157 r = match_int(&args[0], &option);
156 if (r < 0) { 158 if (r < 0) {
157 P9_DPRINTK(P9_DEBUG_ERROR, 159 p9_debug(P9_DEBUG_ERROR,
158 "integer field, but no integer?\n"); 160 "integer field, but no integer?\n");
159 ret = r; 161 ret = r;
160 continue; 162 continue;
161 } 163 }
@@ -164,8 +166,8 @@ static int v9fs_parse_options(struct v9fs_session_info *v9ses, char *opts)
164 case Opt_dfltgid: 166 case Opt_dfltgid:
165 r = match_int(&args[0], &option); 167 r = match_int(&args[0], &option);
166 if (r < 0) { 168 if (r < 0) {
167 P9_DPRINTK(P9_DEBUG_ERROR, 169 p9_debug(P9_DEBUG_ERROR,
168 "integer field, but no integer?\n"); 170 "integer field, but no integer?\n");
169 ret = r; 171 ret = r;
170 continue; 172 continue;
171 } 173 }
@@ -174,8 +176,8 @@ static int v9fs_parse_options(struct v9fs_session_info *v9ses, char *opts)
174 case Opt_afid: 176 case Opt_afid:
175 r = match_int(&args[0], &option); 177 r = match_int(&args[0], &option);
176 if (r < 0) { 178 if (r < 0) {
177 P9_DPRINTK(P9_DEBUG_ERROR, 179 p9_debug(P9_DEBUG_ERROR,
178 "integer field, but no integer?\n"); 180 "integer field, but no integer?\n");
179 ret = r; 181 ret = r;
180 continue; 182 continue;
181 } 183 }
@@ -205,8 +207,8 @@ static int v9fs_parse_options(struct v9fs_session_info *v9ses, char *opts)
205 s = match_strdup(&args[0]); 207 s = match_strdup(&args[0]);
206 if (!s) { 208 if (!s) {
207 ret = -ENOMEM; 209 ret = -ENOMEM;
208 P9_DPRINTK(P9_DEBUG_ERROR, 210 p9_debug(P9_DEBUG_ERROR,
209 "problem allocating copy of cache arg\n"); 211 "problem allocating copy of cache arg\n");
210 goto free_and_return; 212 goto free_and_return;
211 } 213 }
212 ret = get_cache_mode(s); 214 ret = get_cache_mode(s);
@@ -223,8 +225,8 @@ static int v9fs_parse_options(struct v9fs_session_info *v9ses, char *opts)
223 s = match_strdup(&args[0]); 225 s = match_strdup(&args[0]);
224 if (!s) { 226 if (!s) {
225 ret = -ENOMEM; 227 ret = -ENOMEM;
226 P9_DPRINTK(P9_DEBUG_ERROR, 228 p9_debug(P9_DEBUG_ERROR,
227 "problem allocating copy of access arg\n"); 229 "problem allocating copy of access arg\n");
228 goto free_and_return; 230 goto free_and_return;
229 } 231 }
230 232
@@ -240,8 +242,8 @@ static int v9fs_parse_options(struct v9fs_session_info *v9ses, char *opts)
240 v9ses->uid = simple_strtoul(s, &e, 10); 242 v9ses->uid = simple_strtoul(s, &e, 10);
241 if (*e != '\0') { 243 if (*e != '\0') {
242 ret = -EINVAL; 244 ret = -EINVAL;
243 printk(KERN_INFO "9p: Unknown access " 245 pr_info("Unknown access argument %s\n",
244 "argument %s.\n", s); 246 s);
245 kfree(s); 247 kfree(s);
246 goto free_and_return; 248 goto free_and_return;
247 } 249 }
@@ -254,9 +256,8 @@ static int v9fs_parse_options(struct v9fs_session_info *v9ses, char *opts)
254#ifdef CONFIG_9P_FS_POSIX_ACL 256#ifdef CONFIG_9P_FS_POSIX_ACL
255 v9ses->flags |= V9FS_POSIX_ACL; 257 v9ses->flags |= V9FS_POSIX_ACL;
256#else 258#else
257 P9_DPRINTK(P9_DEBUG_ERROR, 259 p9_debug(P9_DEBUG_ERROR,
258 "Not defined CONFIG_9P_FS_POSIX_ACL. " 260 "Not defined CONFIG_9P_FS_POSIX_ACL. Ignoring posixacl option\n");
259 "Ignoring posixacl option\n");
260#endif 261#endif
261 break; 262 break;
262 263
@@ -318,7 +319,7 @@ struct p9_fid *v9fs_session_init(struct v9fs_session_info *v9ses,
318 if (IS_ERR(v9ses->clnt)) { 319 if (IS_ERR(v9ses->clnt)) {
319 retval = PTR_ERR(v9ses->clnt); 320 retval = PTR_ERR(v9ses->clnt);
320 v9ses->clnt = NULL; 321 v9ses->clnt = NULL;
321 P9_DPRINTK(P9_DEBUG_ERROR, "problem initializing 9p client\n"); 322 p9_debug(P9_DEBUG_ERROR, "problem initializing 9p client\n");
322 goto error; 323 goto error;
323 } 324 }
324 325
@@ -371,7 +372,7 @@ struct p9_fid *v9fs_session_init(struct v9fs_session_info *v9ses,
371 if (IS_ERR(fid)) { 372 if (IS_ERR(fid)) {
372 retval = PTR_ERR(fid); 373 retval = PTR_ERR(fid);
373 fid = NULL; 374 fid = NULL;
374 P9_DPRINTK(P9_DEBUG_ERROR, "cannot attach\n"); 375 p9_debug(P9_DEBUG_ERROR, "cannot attach\n");
375 goto error; 376 goto error;
376 } 377 }
377 378
@@ -429,7 +430,7 @@ void v9fs_session_close(struct v9fs_session_info *v9ses)
429 */ 430 */
430 431
431void v9fs_session_cancel(struct v9fs_session_info *v9ses) { 432void v9fs_session_cancel(struct v9fs_session_info *v9ses) {
432 P9_DPRINTK(P9_DEBUG_ERROR, "cancel session %p\n", v9ses); 433 p9_debug(P9_DEBUG_ERROR, "cancel session %p\n", v9ses);
433 p9_client_disconnect(v9ses->clnt); 434 p9_client_disconnect(v9ses->clnt);
434} 435}
435 436
@@ -442,7 +443,7 @@ void v9fs_session_cancel(struct v9fs_session_info *v9ses) {
442 443
443void v9fs_session_begin_cancel(struct v9fs_session_info *v9ses) 444void v9fs_session_begin_cancel(struct v9fs_session_info *v9ses)
444{ 445{
445 P9_DPRINTK(P9_DEBUG_ERROR, "begin cancel session %p\n", v9ses); 446 p9_debug(P9_DEBUG_ERROR, "begin cancel session %p\n", v9ses);
446 p9_client_begin_disconnect(v9ses->clnt); 447 p9_client_begin_disconnect(v9ses->clnt);
447} 448}
448 449
@@ -591,23 +592,23 @@ static void v9fs_cache_unregister(void)
591static int __init init_v9fs(void) 592static int __init init_v9fs(void)
592{ 593{
593 int err; 594 int err;
594 printk(KERN_INFO "Installing v9fs 9p2000 file system support\n"); 595 pr_info("Installing v9fs 9p2000 file system support\n");
595 /* TODO: Setup list of registered trasnport modules */ 596 /* TODO: Setup list of registered trasnport modules */
596 err = register_filesystem(&v9fs_fs_type); 597 err = register_filesystem(&v9fs_fs_type);
597 if (err < 0) { 598 if (err < 0) {
598 printk(KERN_ERR "Failed to register filesystem\n"); 599 pr_err("Failed to register filesystem\n");
599 return err; 600 return err;
600 } 601 }
601 602
602 err = v9fs_cache_register(); 603 err = v9fs_cache_register();
603 if (err < 0) { 604 if (err < 0) {
604 printk(KERN_ERR "Failed to register v9fs for caching\n"); 605 pr_err("Failed to register v9fs for caching\n");
605 goto out_fs_unreg; 606 goto out_fs_unreg;
606 } 607 }
607 608
608 err = v9fs_sysfs_init(); 609 err = v9fs_sysfs_init();
609 if (err < 0) { 610 if (err < 0) {
610 printk(KERN_ERR "Failed to register with sysfs\n"); 611 pr_err("Failed to register with sysfs\n");
611 goto out_sysfs_cleanup; 612 goto out_sysfs_cleanup;
612 } 613 }
613 614
diff --git a/fs/9p/vfs_addr.c b/fs/9p/vfs_addr.c
index 2524e4cbb8ea..0ad61c6a65a5 100644
--- a/fs/9p/vfs_addr.c
+++ b/fs/9p/vfs_addr.c
@@ -56,7 +56,7 @@ static int v9fs_fid_readpage(struct p9_fid *fid, struct page *page)
56 struct inode *inode; 56 struct inode *inode;
57 57
58 inode = page->mapping->host; 58 inode = page->mapping->host;
59 P9_DPRINTK(P9_DEBUG_VFS, "\n"); 59 p9_debug(P9_DEBUG_VFS, "\n");
60 60
61 BUG_ON(!PageLocked(page)); 61 BUG_ON(!PageLocked(page));
62 62
@@ -116,14 +116,14 @@ static int v9fs_vfs_readpages(struct file *filp, struct address_space *mapping,
116 struct inode *inode; 116 struct inode *inode;
117 117
118 inode = mapping->host; 118 inode = mapping->host;
119 P9_DPRINTK(P9_DEBUG_VFS, "inode: %p file: %p\n", inode, filp); 119 p9_debug(P9_DEBUG_VFS, "inode: %p file: %p\n", inode, filp);
120 120
121 ret = v9fs_readpages_from_fscache(inode, mapping, pages, &nr_pages); 121 ret = v9fs_readpages_from_fscache(inode, mapping, pages, &nr_pages);
122 if (ret == 0) 122 if (ret == 0)
123 return ret; 123 return ret;
124 124
125 ret = read_cache_pages(mapping, pages, (void *)v9fs_vfs_readpage, filp); 125 ret = read_cache_pages(mapping, pages, (void *)v9fs_vfs_readpage, filp);
126 P9_DPRINTK(P9_DEBUG_VFS, " = %d\n", ret); 126 p9_debug(P9_DEBUG_VFS, " = %d\n", ret);
127 return ret; 127 return ret;
128} 128}
129 129
@@ -263,10 +263,9 @@ v9fs_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov,
263 * Now that we do caching with cache mode enabled, We need 263 * Now that we do caching with cache mode enabled, We need
264 * to support direct IO 264 * to support direct IO
265 */ 265 */
266 P9_DPRINTK(P9_DEBUG_VFS, "v9fs_direct_IO: v9fs_direct_IO (%s) " 266 p9_debug(P9_DEBUG_VFS, "v9fs_direct_IO: v9fs_direct_IO (%s) off/no(%lld/%lu) EINVAL\n",
267 "off/no(%lld/%lu) EINVAL\n", 267 iocb->ki_filp->f_path.dentry->d_name.name,
268 iocb->ki_filp->f_path.dentry->d_name.name, 268 (long long)pos, nr_segs);
269 (long long) pos, nr_segs);
270 269
271 return -EINVAL; 270 return -EINVAL;
272} 271}
diff --git a/fs/9p/vfs_dentry.c b/fs/9p/vfs_dentry.c
index e022890c6f40..d529437ff442 100644
--- a/fs/9p/vfs_dentry.c
+++ b/fs/9p/vfs_dentry.c
@@ -53,8 +53,8 @@
53 53
54static int v9fs_dentry_delete(const struct dentry *dentry) 54static int v9fs_dentry_delete(const struct dentry *dentry)
55{ 55{
56 P9_DPRINTK(P9_DEBUG_VFS, " dentry: %s (%p)\n", dentry->d_name.name, 56 p9_debug(P9_DEBUG_VFS, " dentry: %s (%p)\n",
57 dentry); 57 dentry->d_name.name, dentry);
58 58
59 return 1; 59 return 1;
60} 60}
@@ -66,8 +66,8 @@ static int v9fs_dentry_delete(const struct dentry *dentry)
66 */ 66 */
67static int v9fs_cached_dentry_delete(const struct dentry *dentry) 67static int v9fs_cached_dentry_delete(const struct dentry *dentry)
68{ 68{
69 P9_DPRINTK(P9_DEBUG_VFS, " dentry: %s (%p)\n", 69 p9_debug(P9_DEBUG_VFS, " dentry: %s (%p)\n",
70 dentry->d_name.name, dentry); 70 dentry->d_name.name, dentry);
71 71
72 /* Don't cache negative dentries */ 72 /* Don't cache negative dentries */
73 if (!dentry->d_inode) 73 if (!dentry->d_inode)
@@ -86,8 +86,8 @@ static void v9fs_dentry_release(struct dentry *dentry)
86 struct v9fs_dentry *dent; 86 struct v9fs_dentry *dent;
87 struct p9_fid *temp, *current_fid; 87 struct p9_fid *temp, *current_fid;
88 88
89 P9_DPRINTK(P9_DEBUG_VFS, " dentry: %s (%p)\n", dentry->d_name.name, 89 p9_debug(P9_DEBUG_VFS, " dentry: %s (%p)\n",
90 dentry); 90 dentry->d_name.name, dentry);
91 dent = dentry->d_fsdata; 91 dent = dentry->d_fsdata;
92 if (dent) { 92 if (dent) {
93 list_for_each_entry_safe(current_fid, temp, &dent->fidlist, 93 list_for_each_entry_safe(current_fid, temp, &dent->fidlist,
diff --git a/fs/9p/vfs_dir.c b/fs/9p/vfs_dir.c
index 598fff1a54e5..ff911e779651 100644
--- a/fs/9p/vfs_dir.c
+++ b/fs/9p/vfs_dir.c
@@ -140,7 +140,7 @@ static int v9fs_dir_readdir(struct file *filp, void *dirent, filldir_t filldir)
140 int reclen = 0; 140 int reclen = 0;
141 struct p9_rdir *rdir; 141 struct p9_rdir *rdir;
142 142
143 P9_DPRINTK(P9_DEBUG_VFS, "name %s\n", filp->f_path.dentry->d_name.name); 143 p9_debug(P9_DEBUG_VFS, "name %s\n", filp->f_path.dentry->d_name.name);
144 fid = filp->private_data; 144 fid = filp->private_data;
145 145
146 buflen = fid->clnt->msize - P9_IOHDRSZ; 146 buflen = fid->clnt->msize - P9_IOHDRSZ;
@@ -168,7 +168,7 @@ static int v9fs_dir_readdir(struct file *filp, void *dirent, filldir_t filldir)
168 err = p9stat_read(fid->clnt, rdir->buf + rdir->head, 168 err = p9stat_read(fid->clnt, rdir->buf + rdir->head,
169 rdir->tail - rdir->head, &st); 169 rdir->tail - rdir->head, &st);
170 if (err) { 170 if (err) {
171 P9_DPRINTK(P9_DEBUG_VFS, "returned %d\n", err); 171 p9_debug(P9_DEBUG_VFS, "returned %d\n", err);
172 err = -EIO; 172 err = -EIO;
173 p9stat_free(&st); 173 p9stat_free(&st);
174 goto unlock_and_exit; 174 goto unlock_and_exit;
@@ -213,7 +213,7 @@ static int v9fs_dir_readdir_dotl(struct file *filp, void *dirent,
213 struct p9_dirent curdirent; 213 struct p9_dirent curdirent;
214 u64 oldoffset = 0; 214 u64 oldoffset = 0;
215 215
216 P9_DPRINTK(P9_DEBUG_VFS, "name %s\n", filp->f_path.dentry->d_name.name); 216 p9_debug(P9_DEBUG_VFS, "name %s\n", filp->f_path.dentry->d_name.name);
217 fid = filp->private_data; 217 fid = filp->private_data;
218 218
219 buflen = fid->clnt->msize - P9_READDIRHDRSZ; 219 buflen = fid->clnt->msize - P9_READDIRHDRSZ;
@@ -244,7 +244,7 @@ static int v9fs_dir_readdir_dotl(struct file *filp, void *dirent,
244 rdir->tail - rdir->head, 244 rdir->tail - rdir->head,
245 &curdirent); 245 &curdirent);
246 if (err < 0) { 246 if (err < 0) {
247 P9_DPRINTK(P9_DEBUG_VFS, "returned %d\n", err); 247 p9_debug(P9_DEBUG_VFS, "returned %d\n", err);
248 err = -EIO; 248 err = -EIO;
249 goto unlock_and_exit; 249 goto unlock_and_exit;
250 } 250 }
@@ -290,9 +290,8 @@ int v9fs_dir_release(struct inode *inode, struct file *filp)
290 struct p9_fid *fid; 290 struct p9_fid *fid;
291 291
292 fid = filp->private_data; 292 fid = filp->private_data;
293 P9_DPRINTK(P9_DEBUG_VFS, 293 p9_debug(P9_DEBUG_VFS, "inode: %p filp: %p fid: %d\n",
294 "v9fs_dir_release: inode: %p filp: %p fid: %d\n", 294 inode, filp, fid ? fid->fid : -1);
295 inode, filp, fid ? fid->fid : -1);
296 if (fid) 295 if (fid)
297 p9_client_clunk(fid); 296 p9_client_clunk(fid);
298 return 0; 297 return 0;
diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c
index a7ac45d5bd2c..fc06fd27065e 100644
--- a/fs/9p/vfs_file.c
+++ b/fs/9p/vfs_file.c
@@ -61,7 +61,7 @@ int v9fs_file_open(struct inode *inode, struct file *file)
61 struct p9_fid *fid; 61 struct p9_fid *fid;
62 int omode; 62 int omode;
63 63
64 P9_DPRINTK(P9_DEBUG_VFS, "inode: %p file: %p\n", inode, file); 64 p9_debug(P9_DEBUG_VFS, "inode: %p file: %p\n", inode, file);
65 v9inode = V9FS_I(inode); 65 v9inode = V9FS_I(inode);
66 v9ses = v9fs_inode2v9ses(inode); 66 v9ses = v9fs_inode2v9ses(inode);
67 if (v9fs_proto_dotl(v9ses)) 67 if (v9fs_proto_dotl(v9ses))
@@ -135,7 +135,7 @@ static int v9fs_file_lock(struct file *filp, int cmd, struct file_lock *fl)
135 int res = 0; 135 int res = 0;
136 struct inode *inode = filp->f_path.dentry->d_inode; 136 struct inode *inode = filp->f_path.dentry->d_inode;
137 137
138 P9_DPRINTK(P9_DEBUG_VFS, "filp: %p lock: %p\n", filp, fl); 138 p9_debug(P9_DEBUG_VFS, "filp: %p lock: %p\n", filp, fl);
139 139
140 /* No mandatory locks */ 140 /* No mandatory locks */
141 if (__mandatory_lock(inode) && fl->fl_type != F_UNLCK) 141 if (__mandatory_lock(inode) && fl->fl_type != F_UNLCK)
@@ -305,8 +305,8 @@ static int v9fs_file_lock_dotl(struct file *filp, int cmd, struct file_lock *fl)
305 struct inode *inode = filp->f_path.dentry->d_inode; 305 struct inode *inode = filp->f_path.dentry->d_inode;
306 int ret = -ENOLCK; 306 int ret = -ENOLCK;
307 307
308 P9_DPRINTK(P9_DEBUG_VFS, "filp: %p cmd:%d lock: %p name: %s\n", filp, 308 p9_debug(P9_DEBUG_VFS, "filp: %p cmd:%d lock: %p name: %s\n",
309 cmd, fl, filp->f_path.dentry->d_name.name); 309 filp, cmd, fl, filp->f_path.dentry->d_name.name);
310 310
311 /* No mandatory locks */ 311 /* No mandatory locks */
312 if (__mandatory_lock(inode) && fl->fl_type != F_UNLCK) 312 if (__mandatory_lock(inode) && fl->fl_type != F_UNLCK)
@@ -341,8 +341,8 @@ static int v9fs_file_flock_dotl(struct file *filp, int cmd,
341 struct inode *inode = filp->f_path.dentry->d_inode; 341 struct inode *inode = filp->f_path.dentry->d_inode;
342 int ret = -ENOLCK; 342 int ret = -ENOLCK;
343 343
344 P9_DPRINTK(P9_DEBUG_VFS, "filp: %p cmd:%d lock: %p name: %s\n", filp, 344 p9_debug(P9_DEBUG_VFS, "filp: %p cmd:%d lock: %p name: %s\n",
345 cmd, fl, filp->f_path.dentry->d_name.name); 345 filp, cmd, fl, filp->f_path.dentry->d_name.name);
346 346
347 /* No mandatory locks */ 347 /* No mandatory locks */
348 if (__mandatory_lock(inode) && fl->fl_type != F_UNLCK) 348 if (__mandatory_lock(inode) && fl->fl_type != F_UNLCK)
@@ -385,8 +385,8 @@ v9fs_fid_readn(struct p9_fid *fid, char *data, char __user *udata, u32 count,
385{ 385{
386 int n, total, size; 386 int n, total, size;
387 387
388 P9_DPRINTK(P9_DEBUG_VFS, "fid %d offset %llu count %d\n", fid->fid, 388 p9_debug(P9_DEBUG_VFS, "fid %d offset %llu count %d\n",
389 (long long unsigned) offset, count); 389 fid->fid, (long long unsigned)offset, count);
390 n = 0; 390 n = 0;
391 total = 0; 391 total = 0;
392 size = fid->iounit ? fid->iounit : fid->clnt->msize - P9_IOHDRSZ; 392 size = fid->iounit ? fid->iounit : fid->clnt->msize - P9_IOHDRSZ;
@@ -444,7 +444,7 @@ v9fs_file_read(struct file *filp, char __user *udata, size_t count,
444 struct p9_fid *fid; 444 struct p9_fid *fid;
445 size_t size; 445 size_t size;
446 446
447 P9_DPRINTK(P9_DEBUG_VFS, "count %zu offset %lld\n", count, *offset); 447 p9_debug(P9_DEBUG_VFS, "count %zu offset %lld\n", count, *offset);
448 fid = filp->private_data; 448 fid = filp->private_data;
449 449
450 size = fid->iounit ? fid->iounit : fid->clnt->msize - P9_IOHDRSZ; 450 size = fid->iounit ? fid->iounit : fid->clnt->msize - P9_IOHDRSZ;
@@ -471,8 +471,8 @@ v9fs_file_write_internal(struct inode *inode, struct p9_fid *fid,
471 loff_t origin = *offset; 471 loff_t origin = *offset;
472 unsigned long pg_start, pg_end; 472 unsigned long pg_start, pg_end;
473 473
474 P9_DPRINTK(P9_DEBUG_VFS, "data %p count %d offset %x\n", data, 474 p9_debug(P9_DEBUG_VFS, "data %p count %d offset %x\n",
475 (int)count, (int)*offset); 475 data, (int)count, (int)*offset);
476 476
477 clnt = fid->clnt; 477 clnt = fid->clnt;
478 do { 478 do {
@@ -553,7 +553,7 @@ static int v9fs_file_fsync(struct file *filp, loff_t start, loff_t end,
553 return retval; 553 return retval;
554 554
555 mutex_lock(&inode->i_mutex); 555 mutex_lock(&inode->i_mutex);
556 P9_DPRINTK(P9_DEBUG_VFS, "filp %p datasync %x\n", filp, datasync); 556 p9_debug(P9_DEBUG_VFS, "filp %p datasync %x\n", filp, datasync);
557 557
558 fid = filp->private_data; 558 fid = filp->private_data;
559 v9fs_blank_wstat(&wstat); 559 v9fs_blank_wstat(&wstat);
@@ -576,8 +576,7 @@ int v9fs_file_fsync_dotl(struct file *filp, loff_t start, loff_t end,
576 return retval; 576 return retval;
577 577
578 mutex_lock(&inode->i_mutex); 578 mutex_lock(&inode->i_mutex);
579 P9_DPRINTK(P9_DEBUG_VFS, "v9fs_file_fsync_dotl: filp %p datasync %x\n", 579 p9_debug(P9_DEBUG_VFS, "filp %p datasync %x\n", filp, datasync);
580 filp, datasync);
581 580
582 fid = filp->private_data; 581 fid = filp->private_data;
583 582
@@ -608,8 +607,8 @@ v9fs_vm_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
608 struct inode *inode = filp->f_path.dentry->d_inode; 607 struct inode *inode = filp->f_path.dentry->d_inode;
609 608
610 609
611 P9_DPRINTK(P9_DEBUG_VFS, "page %p fid %lx\n", 610 p9_debug(P9_DEBUG_VFS, "page %p fid %lx\n",
612 page, (unsigned long)filp->private_data); 611 page, (unsigned long)filp->private_data);
613 612
614 v9inode = V9FS_I(inode); 613 v9inode = V9FS_I(inode);
615 /* make sure the cache has finished storing the page */ 614 /* make sure the cache has finished storing the page */
diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c
index 879ed8851737..85c29733d8b8 100644
--- a/fs/9p/vfs_inode.c
+++ b/fs/9p/vfs_inode.c
@@ -23,6 +23,8 @@
23 * 23 *
24 */ 24 */
25 25
26#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
27
26#include <linux/module.h> 28#include <linux/module.h>
27#include <linux/errno.h> 29#include <linux/errno.h>
28#include <linux/fs.h> 30#include <linux/fs.h>
@@ -133,9 +135,8 @@ static int p9mode2unixmode(struct v9fs_session_info *v9ses,
133 res |= S_IFBLK; 135 res |= S_IFBLK;
134 break; 136 break;
135 default: 137 default:
136 P9_DPRINTK(P9_DEBUG_ERROR, 138 p9_debug(P9_DEBUG_ERROR, "Unknown special type %c %s\n",
137 "Unknown special type %c %s\n", type, 139 type, stat->extension);
138 stat->extension);
139 }; 140 };
140 *rdev = MKDEV(major, minor); 141 *rdev = MKDEV(major, minor);
141 } else 142 } else
@@ -281,8 +282,8 @@ int v9fs_init_inode(struct v9fs_session_info *v9ses,
281 } else if (v9fs_proto_dotu(v9ses)) { 282 } else if (v9fs_proto_dotu(v9ses)) {
282 inode->i_op = &v9fs_file_inode_operations; 283 inode->i_op = &v9fs_file_inode_operations;
283 } else { 284 } else {
284 P9_DPRINTK(P9_DEBUG_ERROR, 285 p9_debug(P9_DEBUG_ERROR,
285 "special files without extended mode\n"); 286 "special files without extended mode\n");
286 err = -EINVAL; 287 err = -EINVAL;
287 goto error; 288 goto error;
288 } 289 }
@@ -307,8 +308,8 @@ int v9fs_init_inode(struct v9fs_session_info *v9ses,
307 break; 308 break;
308 case S_IFLNK: 309 case S_IFLNK:
309 if (!v9fs_proto_dotu(v9ses) && !v9fs_proto_dotl(v9ses)) { 310 if (!v9fs_proto_dotu(v9ses) && !v9fs_proto_dotl(v9ses)) {
310 P9_DPRINTK(P9_DEBUG_ERROR, "extended modes used with " 311 p9_debug(P9_DEBUG_ERROR,
311 "legacy protocol.\n"); 312 "extended modes used with legacy protocol\n");
312 err = -EINVAL; 313 err = -EINVAL;
313 goto error; 314 goto error;
314 } 315 }
@@ -335,8 +336,8 @@ int v9fs_init_inode(struct v9fs_session_info *v9ses,
335 336
336 break; 337 break;
337 default: 338 default:
338 P9_DPRINTK(P9_DEBUG_ERROR, "BAD mode 0x%x S_IFMT 0x%x\n", 339 p9_debug(P9_DEBUG_ERROR, "BAD mode 0x%x S_IFMT 0x%x\n",
339 mode, mode & S_IFMT); 340 mode, mode & S_IFMT);
340 err = -EINVAL; 341 err = -EINVAL;
341 goto error; 342 goto error;
342 } 343 }
@@ -358,11 +359,12 @@ struct inode *v9fs_get_inode(struct super_block *sb, int mode, dev_t rdev)
358 struct inode *inode; 359 struct inode *inode;
359 struct v9fs_session_info *v9ses = sb->s_fs_info; 360 struct v9fs_session_info *v9ses = sb->s_fs_info;
360 361
361 P9_DPRINTK(P9_DEBUG_VFS, "super block: %p mode: %o\n", sb, mode); 362 p9_debug(P9_DEBUG_VFS, "super block: %p mode: %o\n", sb, mode);
362 363
363 inode = new_inode(sb); 364 inode = new_inode(sb);
364 if (!inode) { 365 if (!inode) {
365 P9_EPRINTK(KERN_WARNING, "Problem allocating inode\n"); 366 pr_warn("%s (%d): Problem allocating inode\n",
367 __func__, task_pid_nr(current));
366 return ERR_PTR(-ENOMEM); 368 return ERR_PTR(-ENOMEM);
367 } 369 }
368 err = v9fs_init_inode(v9ses, inode, mode, rdev); 370 err = v9fs_init_inode(v9ses, inode, mode, rdev);
@@ -578,15 +580,15 @@ static int v9fs_remove(struct inode *dir, struct dentry *dentry, int flags)
578 struct p9_fid *v9fid, *dfid; 580 struct p9_fid *v9fid, *dfid;
579 struct v9fs_session_info *v9ses; 581 struct v9fs_session_info *v9ses;
580 582
581 P9_DPRINTK(P9_DEBUG_VFS, "inode: %p dentry: %p rmdir: %x\n", 583 p9_debug(P9_DEBUG_VFS, "inode: %p dentry: %p rmdir: %x\n",
582 dir, dentry, flags); 584 dir, dentry, flags);
583 585
584 v9ses = v9fs_inode2v9ses(dir); 586 v9ses = v9fs_inode2v9ses(dir);
585 inode = dentry->d_inode; 587 inode = dentry->d_inode;
586 dfid = v9fs_fid_lookup(dentry->d_parent); 588 dfid = v9fs_fid_lookup(dentry->d_parent);
587 if (IS_ERR(dfid)) { 589 if (IS_ERR(dfid)) {
588 retval = PTR_ERR(dfid); 590 retval = PTR_ERR(dfid);
589 P9_DPRINTK(P9_DEBUG_VFS, "fid lookup failed %d\n", retval); 591 p9_debug(P9_DEBUG_VFS, "fid lookup failed %d\n", retval);
590 return retval; 592 return retval;
591 } 593 }
592 if (v9fs_proto_dotl(v9ses)) 594 if (v9fs_proto_dotl(v9ses))
@@ -635,7 +637,7 @@ v9fs_create(struct v9fs_session_info *v9ses, struct inode *dir,
635 struct p9_fid *dfid, *ofid, *fid; 637 struct p9_fid *dfid, *ofid, *fid;
636 struct inode *inode; 638 struct inode *inode;
637 639
638 P9_DPRINTK(P9_DEBUG_VFS, "name %s\n", dentry->d_name.name); 640 p9_debug(P9_DEBUG_VFS, "name %s\n", dentry->d_name.name);
639 641
640 err = 0; 642 err = 0;
641 ofid = NULL; 643 ofid = NULL;
@@ -644,7 +646,7 @@ v9fs_create(struct v9fs_session_info *v9ses, struct inode *dir,
644 dfid = v9fs_fid_lookup(dentry->d_parent); 646 dfid = v9fs_fid_lookup(dentry->d_parent);
645 if (IS_ERR(dfid)) { 647 if (IS_ERR(dfid)) {
646 err = PTR_ERR(dfid); 648 err = PTR_ERR(dfid);
647 P9_DPRINTK(P9_DEBUG_VFS, "fid lookup failed %d\n", err); 649 p9_debug(P9_DEBUG_VFS, "fid lookup failed %d\n", err);
648 return ERR_PTR(err); 650 return ERR_PTR(err);
649 } 651 }
650 652
@@ -652,13 +654,13 @@ v9fs_create(struct v9fs_session_info *v9ses, struct inode *dir,
652 ofid = p9_client_walk(dfid, 0, NULL, 1); 654 ofid = p9_client_walk(dfid, 0, NULL, 1);
653 if (IS_ERR(ofid)) { 655 if (IS_ERR(ofid)) {
654 err = PTR_ERR(ofid); 656 err = PTR_ERR(ofid);
655 P9_DPRINTK(P9_DEBUG_VFS, "p9_client_walk failed %d\n", err); 657 p9_debug(P9_DEBUG_VFS, "p9_client_walk failed %d\n", err);
656 return ERR_PTR(err); 658 return ERR_PTR(err);
657 } 659 }
658 660
659 err = p9_client_fcreate(ofid, name, perm, mode, extension); 661 err = p9_client_fcreate(ofid, name, perm, mode, extension);
660 if (err < 0) { 662 if (err < 0) {
661 P9_DPRINTK(P9_DEBUG_VFS, "p9_client_fcreate failed %d\n", err); 663 p9_debug(P9_DEBUG_VFS, "p9_client_fcreate failed %d\n", err);
662 goto error; 664 goto error;
663 } 665 }
664 666
@@ -666,7 +668,7 @@ v9fs_create(struct v9fs_session_info *v9ses, struct inode *dir,
666 fid = p9_client_walk(dfid, 1, &name, 1); 668 fid = p9_client_walk(dfid, 1, &name, 1);
667 if (IS_ERR(fid)) { 669 if (IS_ERR(fid)) {
668 err = PTR_ERR(fid); 670 err = PTR_ERR(fid);
669 P9_DPRINTK(P9_DEBUG_VFS, "p9_client_walk failed %d\n", err); 671 p9_debug(P9_DEBUG_VFS, "p9_client_walk failed %d\n", err);
670 fid = NULL; 672 fid = NULL;
671 goto error; 673 goto error;
672 } 674 }
@@ -675,7 +677,7 @@ v9fs_create(struct v9fs_session_info *v9ses, struct inode *dir,
675 inode = v9fs_get_new_inode_from_fid(v9ses, fid, dir->i_sb); 677 inode = v9fs_get_new_inode_from_fid(v9ses, fid, dir->i_sb);
676 if (IS_ERR(inode)) { 678 if (IS_ERR(inode)) {
677 err = PTR_ERR(inode); 679 err = PTR_ERR(inode);
678 P9_DPRINTK(P9_DEBUG_VFS, "inode creation failed %d\n", err); 680 p9_debug(P9_DEBUG_VFS, "inode creation failed %d\n", err);
679 goto error; 681 goto error;
680 } 682 }
681 err = v9fs_fid_add(dentry, fid); 683 err = v9fs_fid_add(dentry, fid);
@@ -793,7 +795,7 @@ static int v9fs_vfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
793 struct p9_fid *fid; 795 struct p9_fid *fid;
794 struct v9fs_session_info *v9ses; 796 struct v9fs_session_info *v9ses;
795 797
796 P9_DPRINTK(P9_DEBUG_VFS, "name %s\n", dentry->d_name.name); 798 p9_debug(P9_DEBUG_VFS, "name %s\n", dentry->d_name.name);
797 err = 0; 799 err = 0;
798 v9ses = v9fs_inode2v9ses(dir); 800 v9ses = v9fs_inode2v9ses(dir);
799 perm = unixmode2p9mode(v9ses, mode | S_IFDIR); 801 perm = unixmode2p9mode(v9ses, mode | S_IFDIR);
@@ -831,8 +833,8 @@ struct dentry *v9fs_vfs_lookup(struct inode *dir, struct dentry *dentry,
831 char *name; 833 char *name;
832 int result = 0; 834 int result = 0;
833 835
834 P9_DPRINTK(P9_DEBUG_VFS, "dir: %p dentry: (%s) %p nameidata: %p\n", 836 p9_debug(P9_DEBUG_VFS, "dir: %p dentry: (%s) %p nameidata: %p\n",
835 dir, dentry->d_name.name, dentry, nameidata); 837 dir, dentry->d_name.name, dentry, nameidata);
836 838
837 if (dentry->d_name.len > NAME_MAX) 839 if (dentry->d_name.len > NAME_MAX)
838 return ERR_PTR(-ENAMETOOLONG); 840 return ERR_PTR(-ENAMETOOLONG);
@@ -938,7 +940,7 @@ v9fs_vfs_rename(struct inode *old_dir, struct dentry *old_dentry,
938 struct p9_fid *newdirfid; 940 struct p9_fid *newdirfid;
939 struct p9_wstat wstat; 941 struct p9_wstat wstat;
940 942
941 P9_DPRINTK(P9_DEBUG_VFS, "\n"); 943 p9_debug(P9_DEBUG_VFS, "\n");
942 retval = 0; 944 retval = 0;
943 old_inode = old_dentry->d_inode; 945 old_inode = old_dentry->d_inode;
944 new_inode = new_dentry->d_inode; 946 new_inode = new_dentry->d_inode;
@@ -974,8 +976,7 @@ v9fs_vfs_rename(struct inode *old_dir, struct dentry *old_dentry,
974 * 9P .u can only handle file rename in the same directory 976 * 9P .u can only handle file rename in the same directory
975 */ 977 */
976 978
977 P9_DPRINTK(P9_DEBUG_ERROR, 979 p9_debug(P9_DEBUG_ERROR, "old dir and new dir are different\n");
978 "old dir and new dir are different\n");
979 retval = -EXDEV; 980 retval = -EXDEV;
980 goto clunk_newdir; 981 goto clunk_newdir;
981 } 982 }
@@ -1031,7 +1032,7 @@ v9fs_vfs_getattr(struct vfsmount *mnt, struct dentry *dentry,
1031 struct p9_fid *fid; 1032 struct p9_fid *fid;
1032 struct p9_wstat *st; 1033 struct p9_wstat *st;
1033 1034
1034 P9_DPRINTK(P9_DEBUG_VFS, "dentry: %p\n", dentry); 1035 p9_debug(P9_DEBUG_VFS, "dentry: %p\n", dentry);
1035 err = -EPERM; 1036 err = -EPERM;
1036 v9ses = v9fs_dentry2v9ses(dentry); 1037 v9ses = v9fs_dentry2v9ses(dentry);
1037 if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) { 1038 if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) {
@@ -1068,7 +1069,7 @@ static int v9fs_vfs_setattr(struct dentry *dentry, struct iattr *iattr)
1068 struct p9_fid *fid; 1069 struct p9_fid *fid;
1069 struct p9_wstat wstat; 1070 struct p9_wstat wstat;
1070 1071
1071 P9_DPRINTK(P9_DEBUG_VFS, "\n"); 1072 p9_debug(P9_DEBUG_VFS, "\n");
1072 retval = inode_change_ok(dentry->d_inode, iattr); 1073 retval = inode_change_ok(dentry->d_inode, iattr);
1073 if (retval) 1074 if (retval)
1074 return retval; 1075 return retval;
@@ -1213,7 +1214,7 @@ static int v9fs_readlink(struct dentry *dentry, char *buffer, int buflen)
1213 struct p9_fid *fid; 1214 struct p9_fid *fid;
1214 struct p9_wstat *st; 1215 struct p9_wstat *st;
1215 1216
1216 P9_DPRINTK(P9_DEBUG_VFS, " %s\n", dentry->d_name.name); 1217 p9_debug(P9_DEBUG_VFS, " %s\n", dentry->d_name.name);
1217 retval = -EPERM; 1218 retval = -EPERM;
1218 v9ses = v9fs_dentry2v9ses(dentry); 1219 v9ses = v9fs_dentry2v9ses(dentry);
1219 fid = v9fs_fid_lookup(dentry); 1220 fid = v9fs_fid_lookup(dentry);
@@ -1235,8 +1236,8 @@ static int v9fs_readlink(struct dentry *dentry, char *buffer, int buflen)
1235 /* copy extension buffer into buffer */ 1236 /* copy extension buffer into buffer */
1236 strncpy(buffer, st->extension, buflen); 1237 strncpy(buffer, st->extension, buflen);
1237 1238
1238 P9_DPRINTK(P9_DEBUG_VFS, 1239 p9_debug(P9_DEBUG_VFS, "%s -> %s (%s)\n",
1239 "%s -> %s (%s)\n", dentry->d_name.name, st->extension, buffer); 1240 dentry->d_name.name, st->extension, buffer);
1240 1241
1241 retval = strnlen(buffer, buflen); 1242 retval = strnlen(buffer, buflen);
1242done: 1243done:
@@ -1257,7 +1258,7 @@ static void *v9fs_vfs_follow_link(struct dentry *dentry, struct nameidata *nd)
1257 int len = 0; 1258 int len = 0;
1258 char *link = __getname(); 1259 char *link = __getname();
1259 1260
1260 P9_DPRINTK(P9_DEBUG_VFS, "%s n", dentry->d_name.name); 1261 p9_debug(P9_DEBUG_VFS, "%s\n", dentry->d_name.name);
1261 1262
1262 if (!link) 1263 if (!link)
1263 link = ERR_PTR(-ENOMEM); 1264 link = ERR_PTR(-ENOMEM);
@@ -1288,8 +1289,8 @@ v9fs_vfs_put_link(struct dentry *dentry, struct nameidata *nd, void *p)
1288{ 1289{
1289 char *s = nd_get_link(nd); 1290 char *s = nd_get_link(nd);
1290 1291
1291 P9_DPRINTK(P9_DEBUG_VFS, " %s %s\n", dentry->d_name.name, 1292 p9_debug(P9_DEBUG_VFS, " %s %s\n",
1292 IS_ERR(s) ? "<error>" : s); 1293 dentry->d_name.name, IS_ERR(s) ? "<error>" : s);
1293 if (!IS_ERR(s)) 1294 if (!IS_ERR(s))
1294 __putname(s); 1295 __putname(s);
1295} 1296}
@@ -1312,7 +1313,7 @@ static int v9fs_vfs_mkspecial(struct inode *dir, struct dentry *dentry,
1312 1313
1313 v9ses = v9fs_inode2v9ses(dir); 1314 v9ses = v9fs_inode2v9ses(dir);
1314 if (!v9fs_proto_dotu(v9ses)) { 1315 if (!v9fs_proto_dotu(v9ses)) {
1315 P9_DPRINTK(P9_DEBUG_ERROR, "not extended\n"); 1316 p9_debug(P9_DEBUG_ERROR, "not extended\n");
1316 return -EPERM; 1317 return -EPERM;
1317 } 1318 }
1318 1319
@@ -1340,8 +1341,8 @@ static int v9fs_vfs_mkspecial(struct inode *dir, struct dentry *dentry,
1340static int 1341static int
1341v9fs_vfs_symlink(struct inode *dir, struct dentry *dentry, const char *symname) 1342v9fs_vfs_symlink(struct inode *dir, struct dentry *dentry, const char *symname)
1342{ 1343{
1343 P9_DPRINTK(P9_DEBUG_VFS, " %lu,%s,%s\n", dir->i_ino, 1344 p9_debug(P9_DEBUG_VFS, " %lu,%s,%s\n",
1344 dentry->d_name.name, symname); 1345 dir->i_ino, dentry->d_name.name, symname);
1345 1346
1346 return v9fs_vfs_mkspecial(dir, dentry, S_IFLNK, symname); 1347 return v9fs_vfs_mkspecial(dir, dentry, S_IFLNK, symname);
1347} 1348}
@@ -1362,9 +1363,8 @@ v9fs_vfs_link(struct dentry *old_dentry, struct inode *dir,
1362 char *name; 1363 char *name;
1363 struct p9_fid *oldfid; 1364 struct p9_fid *oldfid;
1364 1365
1365 P9_DPRINTK(P9_DEBUG_VFS, 1366 p9_debug(P9_DEBUG_VFS, " %lu,%s,%s\n",
1366 " %lu,%s,%s\n", dir->i_ino, dentry->d_name.name, 1367 dir->i_ino, dentry->d_name.name, old_dentry->d_name.name);
1367 old_dentry->d_name.name);
1368 1368
1369 oldfid = v9fs_fid_clone(old_dentry); 1369 oldfid = v9fs_fid_clone(old_dentry);
1370 if (IS_ERR(oldfid)) 1370 if (IS_ERR(oldfid))
@@ -1403,9 +1403,9 @@ v9fs_vfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t rdev)
1403 int retval; 1403 int retval;
1404 char *name; 1404 char *name;
1405 1405
1406 P9_DPRINTK(P9_DEBUG_VFS, 1406 p9_debug(P9_DEBUG_VFS, " %lu,%s mode: %x MAJOR: %u MINOR: %u\n",
1407 " %lu,%s mode: %x MAJOR: %u MINOR: %u\n", dir->i_ino, 1407 dir->i_ino, dentry->d_name.name, mode,
1408 dentry->d_name.name, mode, MAJOR(rdev), MINOR(rdev)); 1408 MAJOR(rdev), MINOR(rdev));
1409 1409
1410 if (!new_valid_dev(rdev)) 1410 if (!new_valid_dev(rdev))
1411 return -EINVAL; 1411 return -EINVAL;
diff --git a/fs/9p/vfs_inode_dotl.c b/fs/9p/vfs_inode_dotl.c
index 0b5745e21946..73488fb69d38 100644
--- a/fs/9p/vfs_inode_dotl.c
+++ b/fs/9p/vfs_inode_dotl.c
@@ -283,13 +283,13 @@ v9fs_vfs_create_dotl(struct inode *dir, struct dentry *dentry, int omode,
283 } 283 }
284 284
285 name = (char *) dentry->d_name.name; 285 name = (char *) dentry->d_name.name;
286 P9_DPRINTK(P9_DEBUG_VFS, "v9fs_vfs_create_dotl: name:%s flags:0x%x " 286 p9_debug(P9_DEBUG_VFS, "name:%s flags:0x%x mode:0x%x\n",
287 "mode:0x%x\n", name, flags, omode); 287 name, flags, omode);
288 288
289 dfid = v9fs_fid_lookup(dentry->d_parent); 289 dfid = v9fs_fid_lookup(dentry->d_parent);
290 if (IS_ERR(dfid)) { 290 if (IS_ERR(dfid)) {
291 err = PTR_ERR(dfid); 291 err = PTR_ERR(dfid);
292 P9_DPRINTK(P9_DEBUG_VFS, "fid lookup failed %d\n", err); 292 p9_debug(P9_DEBUG_VFS, "fid lookup failed %d\n", err);
293 return err; 293 return err;
294 } 294 }
295 295
@@ -297,7 +297,7 @@ v9fs_vfs_create_dotl(struct inode *dir, struct dentry *dentry, int omode,
297 ofid = p9_client_walk(dfid, 0, NULL, 1); 297 ofid = p9_client_walk(dfid, 0, NULL, 1);
298 if (IS_ERR(ofid)) { 298 if (IS_ERR(ofid)) {
299 err = PTR_ERR(ofid); 299 err = PTR_ERR(ofid);
300 P9_DPRINTK(P9_DEBUG_VFS, "p9_client_walk failed %d\n", err); 300 p9_debug(P9_DEBUG_VFS, "p9_client_walk failed %d\n", err);
301 return err; 301 return err;
302 } 302 }
303 303
@@ -307,16 +307,15 @@ v9fs_vfs_create_dotl(struct inode *dir, struct dentry *dentry, int omode,
307 /* Update mode based on ACL value */ 307 /* Update mode based on ACL value */
308 err = v9fs_acl_mode(dir, &mode, &dacl, &pacl); 308 err = v9fs_acl_mode(dir, &mode, &dacl, &pacl);
309 if (err) { 309 if (err) {
310 P9_DPRINTK(P9_DEBUG_VFS, 310 p9_debug(P9_DEBUG_VFS, "Failed to get acl values in creat %d\n",
311 "Failed to get acl values in creat %d\n", err); 311 err);
312 goto error; 312 goto error;
313 } 313 }
314 err = p9_client_create_dotl(ofid, name, v9fs_open_to_dotl_flags(flags), 314 err = p9_client_create_dotl(ofid, name, v9fs_open_to_dotl_flags(flags),
315 mode, gid, &qid); 315 mode, gid, &qid);
316 if (err < 0) { 316 if (err < 0) {
317 P9_DPRINTK(P9_DEBUG_VFS, 317 p9_debug(P9_DEBUG_VFS, "p9_client_open_dotl failed in creat %d\n",
318 "p9_client_open_dotl failed in creat %d\n", 318 err);
319 err);
320 goto error; 319 goto error;
321 } 320 }
322 v9fs_invalidate_inode_attr(dir); 321 v9fs_invalidate_inode_attr(dir);
@@ -325,14 +324,14 @@ v9fs_vfs_create_dotl(struct inode *dir, struct dentry *dentry, int omode,
325 fid = p9_client_walk(dfid, 1, &name, 1); 324 fid = p9_client_walk(dfid, 1, &name, 1);
326 if (IS_ERR(fid)) { 325 if (IS_ERR(fid)) {
327 err = PTR_ERR(fid); 326 err = PTR_ERR(fid);
328 P9_DPRINTK(P9_DEBUG_VFS, "p9_client_walk failed %d\n", err); 327 p9_debug(P9_DEBUG_VFS, "p9_client_walk failed %d\n", err);
329 fid = NULL; 328 fid = NULL;
330 goto error; 329 goto error;
331 } 330 }
332 inode = v9fs_get_new_inode_from_fid(v9ses, fid, dir->i_sb); 331 inode = v9fs_get_new_inode_from_fid(v9ses, fid, dir->i_sb);
333 if (IS_ERR(inode)) { 332 if (IS_ERR(inode)) {
334 err = PTR_ERR(inode); 333 err = PTR_ERR(inode);
335 P9_DPRINTK(P9_DEBUG_VFS, "inode creation failed %d\n", err); 334 p9_debug(P9_DEBUG_VFS, "inode creation failed %d\n", err);
336 goto error; 335 goto error;
337 } 336 }
338 err = v9fs_fid_add(dentry, fid); 337 err = v9fs_fid_add(dentry, fid);
@@ -408,7 +407,7 @@ static int v9fs_vfs_mkdir_dotl(struct inode *dir,
408 struct dentry *dir_dentry; 407 struct dentry *dir_dentry;
409 struct posix_acl *dacl = NULL, *pacl = NULL; 408 struct posix_acl *dacl = NULL, *pacl = NULL;
410 409
411 P9_DPRINTK(P9_DEBUG_VFS, "name %s\n", dentry->d_name.name); 410 p9_debug(P9_DEBUG_VFS, "name %s\n", dentry->d_name.name);
412 err = 0; 411 err = 0;
413 v9ses = v9fs_inode2v9ses(dir); 412 v9ses = v9fs_inode2v9ses(dir);
414 413
@@ -420,7 +419,7 @@ static int v9fs_vfs_mkdir_dotl(struct inode *dir,
420 dfid = v9fs_fid_lookup(dir_dentry); 419 dfid = v9fs_fid_lookup(dir_dentry);
421 if (IS_ERR(dfid)) { 420 if (IS_ERR(dfid)) {
422 err = PTR_ERR(dfid); 421 err = PTR_ERR(dfid);
423 P9_DPRINTK(P9_DEBUG_VFS, "fid lookup failed %d\n", err); 422 p9_debug(P9_DEBUG_VFS, "fid lookup failed %d\n", err);
424 dfid = NULL; 423 dfid = NULL;
425 goto error; 424 goto error;
426 } 425 }
@@ -430,8 +429,8 @@ static int v9fs_vfs_mkdir_dotl(struct inode *dir,
430 /* Update mode based on ACL value */ 429 /* Update mode based on ACL value */
431 err = v9fs_acl_mode(dir, &mode, &dacl, &pacl); 430 err = v9fs_acl_mode(dir, &mode, &dacl, &pacl);
432 if (err) { 431 if (err) {
433 P9_DPRINTK(P9_DEBUG_VFS, 432 p9_debug(P9_DEBUG_VFS, "Failed to get acl values in mkdir %d\n",
434 "Failed to get acl values in mkdir %d\n", err); 433 err);
435 goto error; 434 goto error;
436 } 435 }
437 name = (char *) dentry->d_name.name; 436 name = (char *) dentry->d_name.name;
@@ -444,8 +443,8 @@ static int v9fs_vfs_mkdir_dotl(struct inode *dir,
444 fid = p9_client_walk(dfid, 1, &name, 1); 443 fid = p9_client_walk(dfid, 1, &name, 1);
445 if (IS_ERR(fid)) { 444 if (IS_ERR(fid)) {
446 err = PTR_ERR(fid); 445 err = PTR_ERR(fid);
447 P9_DPRINTK(P9_DEBUG_VFS, "p9_client_walk failed %d\n", 446 p9_debug(P9_DEBUG_VFS, "p9_client_walk failed %d\n",
448 err); 447 err);
449 fid = NULL; 448 fid = NULL;
450 goto error; 449 goto error;
451 } 450 }
@@ -453,8 +452,8 @@ static int v9fs_vfs_mkdir_dotl(struct inode *dir,
453 inode = v9fs_get_new_inode_from_fid(v9ses, fid, dir->i_sb); 452 inode = v9fs_get_new_inode_from_fid(v9ses, fid, dir->i_sb);
454 if (IS_ERR(inode)) { 453 if (IS_ERR(inode)) {
455 err = PTR_ERR(inode); 454 err = PTR_ERR(inode);
456 P9_DPRINTK(P9_DEBUG_VFS, "inode creation failed %d\n", 455 p9_debug(P9_DEBUG_VFS, "inode creation failed %d\n",
457 err); 456 err);
458 goto error; 457 goto error;
459 } 458 }
460 err = v9fs_fid_add(dentry, fid); 459 err = v9fs_fid_add(dentry, fid);
@@ -495,7 +494,7 @@ v9fs_vfs_getattr_dotl(struct vfsmount *mnt, struct dentry *dentry,
495 struct p9_fid *fid; 494 struct p9_fid *fid;
496 struct p9_stat_dotl *st; 495 struct p9_stat_dotl *st;
497 496
498 P9_DPRINTK(P9_DEBUG_VFS, "dentry: %p\n", dentry); 497 p9_debug(P9_DEBUG_VFS, "dentry: %p\n", dentry);
499 err = -EPERM; 498 err = -EPERM;
500 v9ses = v9fs_dentry2v9ses(dentry); 499 v9ses = v9fs_dentry2v9ses(dentry);
501 if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) { 500 if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) {
@@ -537,7 +536,7 @@ int v9fs_vfs_setattr_dotl(struct dentry *dentry, struct iattr *iattr)
537 struct p9_fid *fid; 536 struct p9_fid *fid;
538 struct p9_iattr_dotl p9attr; 537 struct p9_iattr_dotl p9attr;
539 538
540 P9_DPRINTK(P9_DEBUG_VFS, "\n"); 539 p9_debug(P9_DEBUG_VFS, "\n");
541 540
542 retval = inode_change_ok(dentry->d_inode, iattr); 541 retval = inode_change_ok(dentry->d_inode, iattr);
543 if (retval) 542 if (retval)
@@ -670,14 +669,13 @@ v9fs_vfs_symlink_dotl(struct inode *dir, struct dentry *dentry,
670 struct v9fs_session_info *v9ses; 669 struct v9fs_session_info *v9ses;
671 670
672 name = (char *) dentry->d_name.name; 671 name = (char *) dentry->d_name.name;
673 P9_DPRINTK(P9_DEBUG_VFS, "v9fs_vfs_symlink_dotl : %lu,%s,%s\n", 672 p9_debug(P9_DEBUG_VFS, "%lu,%s,%s\n", dir->i_ino, name, symname);
674 dir->i_ino, name, symname);
675 v9ses = v9fs_inode2v9ses(dir); 673 v9ses = v9fs_inode2v9ses(dir);
676 674
677 dfid = v9fs_fid_lookup(dentry->d_parent); 675 dfid = v9fs_fid_lookup(dentry->d_parent);
678 if (IS_ERR(dfid)) { 676 if (IS_ERR(dfid)) {
679 err = PTR_ERR(dfid); 677 err = PTR_ERR(dfid);
680 P9_DPRINTK(P9_DEBUG_VFS, "fid lookup failed %d\n", err); 678 p9_debug(P9_DEBUG_VFS, "fid lookup failed %d\n", err);
681 return err; 679 return err;
682 } 680 }
683 681
@@ -687,7 +685,7 @@ v9fs_vfs_symlink_dotl(struct inode *dir, struct dentry *dentry,
687 err = p9_client_symlink(dfid, name, (char *)symname, gid, &qid); 685 err = p9_client_symlink(dfid, name, (char *)symname, gid, &qid);
688 686
689 if (err < 0) { 687 if (err < 0) {
690 P9_DPRINTK(P9_DEBUG_VFS, "p9_client_symlink failed %d\n", err); 688 p9_debug(P9_DEBUG_VFS, "p9_client_symlink failed %d\n", err);
691 goto error; 689 goto error;
692 } 690 }
693 691
@@ -697,8 +695,8 @@ v9fs_vfs_symlink_dotl(struct inode *dir, struct dentry *dentry,
697 fid = p9_client_walk(dfid, 1, &name, 1); 695 fid = p9_client_walk(dfid, 1, &name, 1);
698 if (IS_ERR(fid)) { 696 if (IS_ERR(fid)) {
699 err = PTR_ERR(fid); 697 err = PTR_ERR(fid);
700 P9_DPRINTK(P9_DEBUG_VFS, "p9_client_walk failed %d\n", 698 p9_debug(P9_DEBUG_VFS, "p9_client_walk failed %d\n",
701 err); 699 err);
702 fid = NULL; 700 fid = NULL;
703 goto error; 701 goto error;
704 } 702 }
@@ -707,8 +705,8 @@ v9fs_vfs_symlink_dotl(struct inode *dir, struct dentry *dentry,
707 inode = v9fs_get_new_inode_from_fid(v9ses, fid, dir->i_sb); 705 inode = v9fs_get_new_inode_from_fid(v9ses, fid, dir->i_sb);
708 if (IS_ERR(inode)) { 706 if (IS_ERR(inode)) {
709 err = PTR_ERR(inode); 707 err = PTR_ERR(inode);
710 P9_DPRINTK(P9_DEBUG_VFS, "inode creation failed %d\n", 708 p9_debug(P9_DEBUG_VFS, "inode creation failed %d\n",
711 err); 709 err);
712 goto error; 710 goto error;
713 } 711 }
714 err = v9fs_fid_add(dentry, fid); 712 err = v9fs_fid_add(dentry, fid);
@@ -751,9 +749,8 @@ v9fs_vfs_link_dotl(struct dentry *old_dentry, struct inode *dir,
751 struct p9_fid *dfid, *oldfid; 749 struct p9_fid *dfid, *oldfid;
752 struct v9fs_session_info *v9ses; 750 struct v9fs_session_info *v9ses;
753 751
754 P9_DPRINTK(P9_DEBUG_VFS, "dir ino: %lu, old_name: %s, new_name: %s\n", 752 p9_debug(P9_DEBUG_VFS, "dir ino: %lu, old_name: %s, new_name: %s\n",
755 dir->i_ino, old_dentry->d_name.name, 753 dir->i_ino, old_dentry->d_name.name, dentry->d_name.name);
756 dentry->d_name.name);
757 754
758 v9ses = v9fs_inode2v9ses(dir); 755 v9ses = v9fs_inode2v9ses(dir);
759 dir_dentry = v9fs_dentry_from_dir_inode(dir); 756 dir_dentry = v9fs_dentry_from_dir_inode(dir);
@@ -770,7 +767,7 @@ v9fs_vfs_link_dotl(struct dentry *old_dentry, struct inode *dir,
770 err = p9_client_link(dfid, oldfid, (char *)dentry->d_name.name); 767 err = p9_client_link(dfid, oldfid, (char *)dentry->d_name.name);
771 768
772 if (err < 0) { 769 if (err < 0) {
773 P9_DPRINTK(P9_DEBUG_VFS, "p9_client_link failed %d\n", err); 770 p9_debug(P9_DEBUG_VFS, "p9_client_link failed %d\n", err);
774 return err; 771 return err;
775 } 772 }
776 773
@@ -813,9 +810,9 @@ v9fs_vfs_mknod_dotl(struct inode *dir, struct dentry *dentry, int omode,
813 struct dentry *dir_dentry; 810 struct dentry *dir_dentry;
814 struct posix_acl *dacl = NULL, *pacl = NULL; 811 struct posix_acl *dacl = NULL, *pacl = NULL;
815 812
816 P9_DPRINTK(P9_DEBUG_VFS, 813 p9_debug(P9_DEBUG_VFS, " %lu,%s mode: %x MAJOR: %u MINOR: %u\n",
817 " %lu,%s mode: %x MAJOR: %u MINOR: %u\n", dir->i_ino, 814 dir->i_ino, dentry->d_name.name, omode,
818 dentry->d_name.name, omode, MAJOR(rdev), MINOR(rdev)); 815 MAJOR(rdev), MINOR(rdev));
819 816
820 if (!new_valid_dev(rdev)) 817 if (!new_valid_dev(rdev))
821 return -EINVAL; 818 return -EINVAL;
@@ -825,7 +822,7 @@ v9fs_vfs_mknod_dotl(struct inode *dir, struct dentry *dentry, int omode,
825 dfid = v9fs_fid_lookup(dir_dentry); 822 dfid = v9fs_fid_lookup(dir_dentry);
826 if (IS_ERR(dfid)) { 823 if (IS_ERR(dfid)) {
827 err = PTR_ERR(dfid); 824 err = PTR_ERR(dfid);
828 P9_DPRINTK(P9_DEBUG_VFS, "fid lookup failed %d\n", err); 825 p9_debug(P9_DEBUG_VFS, "fid lookup failed %d\n", err);
829 dfid = NULL; 826 dfid = NULL;
830 goto error; 827 goto error;
831 } 828 }
@@ -835,8 +832,8 @@ v9fs_vfs_mknod_dotl(struct inode *dir, struct dentry *dentry, int omode,
835 /* Update mode based on ACL value */ 832 /* Update mode based on ACL value */
836 err = v9fs_acl_mode(dir, &mode, &dacl, &pacl); 833 err = v9fs_acl_mode(dir, &mode, &dacl, &pacl);
837 if (err) { 834 if (err) {
838 P9_DPRINTK(P9_DEBUG_VFS, 835 p9_debug(P9_DEBUG_VFS, "Failed to get acl values in mknod %d\n",
839 "Failed to get acl values in mknod %d\n", err); 836 err);
840 goto error; 837 goto error;
841 } 838 }
842 name = (char *) dentry->d_name.name; 839 name = (char *) dentry->d_name.name;
@@ -851,8 +848,8 @@ v9fs_vfs_mknod_dotl(struct inode *dir, struct dentry *dentry, int omode,
851 fid = p9_client_walk(dfid, 1, &name, 1); 848 fid = p9_client_walk(dfid, 1, &name, 1);
852 if (IS_ERR(fid)) { 849 if (IS_ERR(fid)) {
853 err = PTR_ERR(fid); 850 err = PTR_ERR(fid);
854 P9_DPRINTK(P9_DEBUG_VFS, "p9_client_walk failed %d\n", 851 p9_debug(P9_DEBUG_VFS, "p9_client_walk failed %d\n",
855 err); 852 err);
856 fid = NULL; 853 fid = NULL;
857 goto error; 854 goto error;
858 } 855 }
@@ -860,8 +857,8 @@ v9fs_vfs_mknod_dotl(struct inode *dir, struct dentry *dentry, int omode,
860 inode = v9fs_get_new_inode_from_fid(v9ses, fid, dir->i_sb); 857 inode = v9fs_get_new_inode_from_fid(v9ses, fid, dir->i_sb);
861 if (IS_ERR(inode)) { 858 if (IS_ERR(inode)) {
862 err = PTR_ERR(inode); 859 err = PTR_ERR(inode);
863 P9_DPRINTK(P9_DEBUG_VFS, "inode creation failed %d\n", 860 p9_debug(P9_DEBUG_VFS, "inode creation failed %d\n",
864 err); 861 err);
865 goto error; 862 goto error;
866 } 863 }
867 err = v9fs_fid_add(dentry, fid); 864 err = v9fs_fid_add(dentry, fid);
@@ -905,7 +902,7 @@ v9fs_vfs_follow_link_dotl(struct dentry *dentry, struct nameidata *nd)
905 char *link = __getname(); 902 char *link = __getname();
906 char *target; 903 char *target;
907 904
908 P9_DPRINTK(P9_DEBUG_VFS, "%s\n", dentry->d_name.name); 905 p9_debug(P9_DEBUG_VFS, "%s\n", dentry->d_name.name);
909 906
910 if (!link) { 907 if (!link) {
911 link = ERR_PTR(-ENOMEM); 908 link = ERR_PTR(-ENOMEM);
diff --git a/fs/9p/vfs_super.c b/fs/9p/vfs_super.c
index c70251d47ed1..06d1973598a2 100644
--- a/fs/9p/vfs_super.c
+++ b/fs/9p/vfs_super.c
@@ -121,7 +121,7 @@ static struct dentry *v9fs_mount(struct file_system_type *fs_type, int flags,
121 struct p9_fid *fid; 121 struct p9_fid *fid;
122 int retval = 0; 122 int retval = 0;
123 123
124 P9_DPRINTK(P9_DEBUG_VFS, " \n"); 124 p9_debug(P9_DEBUG_VFS, "\n");
125 125
126 v9ses = kzalloc(sizeof(struct v9fs_session_info), GFP_KERNEL); 126 v9ses = kzalloc(sizeof(struct v9fs_session_info), GFP_KERNEL);
127 if (!v9ses) 127 if (!v9ses)
@@ -191,7 +191,7 @@ static struct dentry *v9fs_mount(struct file_system_type *fs_type, int flags,
191 goto release_sb; 191 goto release_sb;
192 v9fs_fid_add(root, fid); 192 v9fs_fid_add(root, fid);
193 193
194 P9_DPRINTK(P9_DEBUG_VFS, " simple set mount, return 0\n"); 194 p9_debug(P9_DEBUG_VFS, " simple set mount, return 0\n");
195 return dget(sb->s_root); 195 return dget(sb->s_root);
196 196
197clunk_fid: 197clunk_fid:
@@ -223,7 +223,7 @@ static void v9fs_kill_super(struct super_block *s)
223{ 223{
224 struct v9fs_session_info *v9ses = s->s_fs_info; 224 struct v9fs_session_info *v9ses = s->s_fs_info;
225 225
226 P9_DPRINTK(P9_DEBUG_VFS, " %p\n", s); 226 p9_debug(P9_DEBUG_VFS, " %p\n", s);
227 227
228 kill_anon_super(s); 228 kill_anon_super(s);
229 229
@@ -231,7 +231,7 @@ static void v9fs_kill_super(struct super_block *s)
231 v9fs_session_close(v9ses); 231 v9fs_session_close(v9ses);
232 kfree(v9ses); 232 kfree(v9ses);
233 s->s_fs_info = NULL; 233 s->s_fs_info = NULL;
234 P9_DPRINTK(P9_DEBUG_VFS, "exiting kill_super\n"); 234 p9_debug(P9_DEBUG_VFS, "exiting kill_super\n");
235} 235}
236 236
237static void 237static void
@@ -303,7 +303,7 @@ static int v9fs_write_inode(struct inode *inode,
303 * send an fsync request to server irrespective of 303 * send an fsync request to server irrespective of
304 * wbc->sync_mode. 304 * wbc->sync_mode.
305 */ 305 */
306 P9_DPRINTK(P9_DEBUG_VFS, "%s: inode %p\n", __func__, inode); 306 p9_debug(P9_DEBUG_VFS, "%s: inode %p\n", __func__, inode);
307 v9inode = V9FS_I(inode); 307 v9inode = V9FS_I(inode);
308 if (!v9inode->writeback_fid) 308 if (!v9inode->writeback_fid)
309 return 0; 309 return 0;
@@ -326,7 +326,7 @@ static int v9fs_write_inode_dotl(struct inode *inode,
326 * send an fsync request to server irrespective of 326 * send an fsync request to server irrespective of
327 * wbc->sync_mode. 327 * wbc->sync_mode.
328 */ 328 */
329 P9_DPRINTK(P9_DEBUG_VFS, "%s: inode %p\n", __func__, inode); 329 p9_debug(P9_DEBUG_VFS, "%s: inode %p\n", __func__, inode);
330 v9inode = V9FS_I(inode); 330 v9inode = V9FS_I(inode);
331 if (!v9inode->writeback_fid) 331 if (!v9inode->writeback_fid)
332 return 0; 332 return 0;
diff --git a/fs/9p/xattr.c b/fs/9p/xattr.c
index d288773871b3..29653b70a9c3 100644
--- a/fs/9p/xattr.c
+++ b/fs/9p/xattr.c
@@ -32,8 +32,8 @@ ssize_t v9fs_fid_xattr_get(struct p9_fid *fid, const char *name,
32 attr_fid = p9_client_xattrwalk(fid, name, &attr_size); 32 attr_fid = p9_client_xattrwalk(fid, name, &attr_size);
33 if (IS_ERR(attr_fid)) { 33 if (IS_ERR(attr_fid)) {
34 retval = PTR_ERR(attr_fid); 34 retval = PTR_ERR(attr_fid);
35 P9_DPRINTK(P9_DEBUG_VFS, 35 p9_debug(P9_DEBUG_VFS, "p9_client_attrwalk failed %zd\n",
36 "p9_client_attrwalk failed %zd\n", retval); 36 retval);
37 attr_fid = NULL; 37 attr_fid = NULL;
38 goto error; 38 goto error;
39 } 39 }
@@ -87,8 +87,8 @@ ssize_t v9fs_xattr_get(struct dentry *dentry, const char *name,
87{ 87{
88 struct p9_fid *fid; 88 struct p9_fid *fid;
89 89
90 P9_DPRINTK(P9_DEBUG_VFS, "%s: name = %s value_len = %zu\n", 90 p9_debug(P9_DEBUG_VFS, "name = %s value_len = %zu\n",
91 __func__, name, buffer_size); 91 name, buffer_size);
92 fid = v9fs_fid_lookup(dentry); 92 fid = v9fs_fid_lookup(dentry);
93 if (IS_ERR(fid)) 93 if (IS_ERR(fid))
94 return PTR_ERR(fid); 94 return PTR_ERR(fid);
@@ -115,8 +115,8 @@ int v9fs_xattr_set(struct dentry *dentry, const char *name,
115 int retval, msize, write_count; 115 int retval, msize, write_count;
116 struct p9_fid *fid = NULL; 116 struct p9_fid *fid = NULL;
117 117
118 P9_DPRINTK(P9_DEBUG_VFS, "%s: name = %s value_len = %zu flags = %d\n", 118 p9_debug(P9_DEBUG_VFS, "name = %s value_len = %zu flags = %d\n",
119 __func__, name, value_len, flags); 119 name, value_len, flags);
120 120
121 fid = v9fs_fid_clone(dentry); 121 fid = v9fs_fid_clone(dentry);
122 if (IS_ERR(fid)) { 122 if (IS_ERR(fid)) {
@@ -129,8 +129,8 @@ int v9fs_xattr_set(struct dentry *dentry, const char *name,
129 */ 129 */
130 retval = p9_client_xattrcreate(fid, name, value_len, flags); 130 retval = p9_client_xattrcreate(fid, name, value_len, flags);
131 if (retval < 0) { 131 if (retval < 0) {
132 P9_DPRINTK(P9_DEBUG_VFS, 132 p9_debug(P9_DEBUG_VFS, "p9_client_xattrcreate failed %d\n",
133 "p9_client_xattrcreate failed %d\n", retval); 133 retval);
134 goto error; 134 goto error;
135 } 135 }
136 msize = fid->clnt->msize; 136 msize = fid->clnt->msize;
diff --git a/include/net/9p/9p.h b/include/net/9p/9p.h
index 2d70b95b3b55..7184853ca360 100644
--- a/include/net/9p/9p.h
+++ b/include/net/9p/9p.h
@@ -63,30 +63,16 @@ enum p9_debug_flags {
63 63
64#ifdef CONFIG_NET_9P_DEBUG 64#ifdef CONFIG_NET_9P_DEBUG
65extern unsigned int p9_debug_level; 65extern unsigned int p9_debug_level;
66 66__printf(3, 4)
67#define P9_DPRINTK(level, format, arg...) \ 67void _p9_debug(enum p9_debug_flags level, const char *func,
68do { \ 68 const char *fmt, ...);
69 if ((p9_debug_level & level) == level) {\ 69#define p9_debug(level, fmt, ...) \
70 if (level == P9_DEBUG_9P) \ 70 _p9_debug(level, __func__, fmt, ##__VA_ARGS__)
71 printk(KERN_NOTICE "(%8.8d) " \
72 format , task_pid_nr(current) , ## arg); \
73 else \
74 printk(KERN_NOTICE "-- %s (%d): " \
75 format , __func__, task_pid_nr(current) , ## arg); \
76 } \
77} while (0)
78
79#else 71#else
80#define P9_DPRINTK(level, format, arg...) do { } while (0) 72#define p9_debug(level, fmt, ...) \
73 no_printk(fmt, ##__VA_ARGS__)
81#endif 74#endif
82 75
83
84#define P9_EPRINTK(level, format, arg...) \
85do { \
86 printk(level "9p: %s (%d): " \
87 format , __func__, task_pid_nr(current), ## arg); \
88} while (0)
89
90/** 76/**
91 * enum p9_msg_t - 9P message types 77 * enum p9_msg_t - 9P message types
92 * @P9_TLERROR: not used 78 * @P9_TLERROR: not used
diff --git a/net/9p/client.c b/net/9p/client.c
index 854ca7a911c4..776618cd2be5 100644
--- a/net/9p/client.c
+++ b/net/9p/client.c
@@ -23,6 +23,8 @@
23 * 23 *
24 */ 24 */
25 25
26#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
27
26#include <linux/module.h> 28#include <linux/module.h>
27#include <linux/errno.h> 29#include <linux/errno.h>
28#include <linux/fs.h> 30#include <linux/fs.h>
@@ -81,15 +83,15 @@ static int get_protocol_version(char *s)
81 83
82 if (!strcmp(s, "9p2000")) { 84 if (!strcmp(s, "9p2000")) {
83 version = p9_proto_legacy; 85 version = p9_proto_legacy;
84 P9_DPRINTK(P9_DEBUG_9P, "Protocol version: Legacy\n"); 86 p9_debug(P9_DEBUG_9P, "Protocol version: Legacy\n");
85 } else if (!strcmp(s, "9p2000.u")) { 87 } else if (!strcmp(s, "9p2000.u")) {
86 version = p9_proto_2000u; 88 version = p9_proto_2000u;
87 P9_DPRINTK(P9_DEBUG_9P, "Protocol version: 9P2000.u\n"); 89 p9_debug(P9_DEBUG_9P, "Protocol version: 9P2000.u\n");
88 } else if (!strcmp(s, "9p2000.L")) { 90 } else if (!strcmp(s, "9p2000.L")) {
89 version = p9_proto_2000L; 91 version = p9_proto_2000L;
90 P9_DPRINTK(P9_DEBUG_9P, "Protocol version: 9P2000.L\n"); 92 p9_debug(P9_DEBUG_9P, "Protocol version: 9P2000.L\n");
91 } else 93 } else
92 printk(KERN_INFO "9p: Unknown protocol version %s.\n", s); 94 pr_info("Unknown protocol version %s\n", s);
93 95
94 return version; 96 return version;
95} 97}
@@ -119,8 +121,8 @@ static int parse_opts(char *opts, struct p9_client *clnt)
119 121
120 tmp_options = kstrdup(opts, GFP_KERNEL); 122 tmp_options = kstrdup(opts, GFP_KERNEL);
121 if (!tmp_options) { 123 if (!tmp_options) {
122 P9_DPRINTK(P9_DEBUG_ERROR, 124 p9_debug(P9_DEBUG_ERROR,
123 "failed to allocate copy of option string\n"); 125 "failed to allocate copy of option string\n");
124 return -ENOMEM; 126 return -ENOMEM;
125 } 127 }
126 options = tmp_options; 128 options = tmp_options;
@@ -134,8 +136,8 @@ static int parse_opts(char *opts, struct p9_client *clnt)
134 case Opt_msize: 136 case Opt_msize:
135 r = match_int(&args[0], &option); 137 r = match_int(&args[0], &option);
136 if (r < 0) { 138 if (r < 0) {
137 P9_DPRINTK(P9_DEBUG_ERROR, 139 p9_debug(P9_DEBUG_ERROR,
138 "integer field, but no integer?\n"); 140 "integer field, but no integer?\n");
139 ret = r; 141 ret = r;
140 continue; 142 continue;
141 } 143 }
@@ -145,15 +147,14 @@ static int parse_opts(char *opts, struct p9_client *clnt)
145 s = match_strdup(&args[0]); 147 s = match_strdup(&args[0]);
146 if (!s) { 148 if (!s) {
147 ret = -ENOMEM; 149 ret = -ENOMEM;
148 P9_DPRINTK(P9_DEBUG_ERROR, 150 p9_debug(P9_DEBUG_ERROR,
149 "problem allocating copy of trans arg\n"); 151 "problem allocating copy of trans arg\n");
150 goto free_and_return; 152 goto free_and_return;
151 } 153 }
152 clnt->trans_mod = v9fs_get_trans_by_name(s); 154 clnt->trans_mod = v9fs_get_trans_by_name(s);
153 if (clnt->trans_mod == NULL) { 155 if (clnt->trans_mod == NULL) {
154 printk(KERN_INFO 156 pr_info("Could not find request transport: %s\n",
155 "9p: Could not find " 157 s);
156 "request transport: %s\n", s);
157 ret = -EINVAL; 158 ret = -EINVAL;
158 kfree(s); 159 kfree(s);
159 goto free_and_return; 160 goto free_and_return;
@@ -167,8 +168,8 @@ static int parse_opts(char *opts, struct p9_client *clnt)
167 s = match_strdup(&args[0]); 168 s = match_strdup(&args[0]);
168 if (!s) { 169 if (!s) {
169 ret = -ENOMEM; 170 ret = -ENOMEM;
170 P9_DPRINTK(P9_DEBUG_ERROR, 171 p9_debug(P9_DEBUG_ERROR,
171 "problem allocating copy of version arg\n"); 172 "problem allocating copy of version arg\n");
172 goto free_and_return; 173 goto free_and_return;
173 } 174 }
174 ret = get_protocol_version(s); 175 ret = get_protocol_version(s);
@@ -225,7 +226,7 @@ p9_tag_alloc(struct p9_client *c, u16 tag, unsigned int max_size)
225 sizeof(struct p9_req_t), GFP_ATOMIC); 226 sizeof(struct p9_req_t), GFP_ATOMIC);
226 227
227 if (!c->reqs[row]) { 228 if (!c->reqs[row]) {
228 printk(KERN_ERR "Couldn't grow tag array\n"); 229 pr_err("Couldn't grow tag array\n");
229 spin_unlock_irqrestore(&c->lock, flags); 230 spin_unlock_irqrestore(&c->lock, flags);
230 return ERR_PTR(-ENOMEM); 231 return ERR_PTR(-ENOMEM);
231 } 232 }
@@ -244,7 +245,7 @@ p9_tag_alloc(struct p9_client *c, u16 tag, unsigned int max_size)
244 if (!req->tc) { 245 if (!req->tc) {
245 req->wq = kmalloc(sizeof(wait_queue_head_t), GFP_NOFS); 246 req->wq = kmalloc(sizeof(wait_queue_head_t), GFP_NOFS);
246 if (!req->wq) { 247 if (!req->wq) {
247 printk(KERN_ERR "Couldn't grow tag array\n"); 248 pr_err("Couldn't grow tag array\n");
248 return ERR_PTR(-ENOMEM); 249 return ERR_PTR(-ENOMEM);
249 } 250 }
250 init_waitqueue_head(req->wq); 251 init_waitqueue_head(req->wq);
@@ -253,7 +254,7 @@ p9_tag_alloc(struct p9_client *c, u16 tag, unsigned int max_size)
253 req->rc = kmalloc(sizeof(struct p9_fcall) + alloc_msize, 254 req->rc = kmalloc(sizeof(struct p9_fcall) + alloc_msize,
254 GFP_NOFS); 255 GFP_NOFS);
255 if ((!req->tc) || (!req->rc)) { 256 if ((!req->tc) || (!req->rc)) {
256 printk(KERN_ERR "Couldn't grow tag array\n"); 257 pr_err("Couldn't grow tag array\n");
257 kfree(req->tc); 258 kfree(req->tc);
258 kfree(req->rc); 259 kfree(req->rc);
259 kfree(req->wq); 260 kfree(req->wq);
@@ -343,9 +344,9 @@ static void p9_tag_cleanup(struct p9_client *c)
343 for (row = 0; row < (c->max_tag/P9_ROW_MAXTAG); row++) { 344 for (row = 0; row < (c->max_tag/P9_ROW_MAXTAG); row++) {
344 for (col = 0; col < P9_ROW_MAXTAG; col++) { 345 for (col = 0; col < P9_ROW_MAXTAG; col++) {
345 if (c->reqs[row][col].status != REQ_STATUS_IDLE) { 346 if (c->reqs[row][col].status != REQ_STATUS_IDLE) {
346 P9_DPRINTK(P9_DEBUG_MUX, 347 p9_debug(P9_DEBUG_MUX,
347 "Attempting to cleanup non-free tag %d,%d\n", 348 "Attempting to cleanup non-free tag %d,%d\n",
348 row, col); 349 row, col);
349 /* TODO: delay execution of cleanup */ 350 /* TODO: delay execution of cleanup */
350 return; 351 return;
351 } 352 }
@@ -379,7 +380,7 @@ static void p9_tag_cleanup(struct p9_client *c)
379static void p9_free_req(struct p9_client *c, struct p9_req_t *r) 380static void p9_free_req(struct p9_client *c, struct p9_req_t *r)
380{ 381{
381 int tag = r->tc->tag; 382 int tag = r->tc->tag;
382 P9_DPRINTK(P9_DEBUG_MUX, "clnt %p req %p tag: %d\n", c, r, tag); 383 p9_debug(P9_DEBUG_MUX, "clnt %p req %p tag: %d\n", c, r, tag);
383 384
384 r->status = REQ_STATUS_IDLE; 385 r->status = REQ_STATUS_IDLE;
385 if (tag != P9_NOTAG && p9_idpool_check(tag, c->tagpool)) 386 if (tag != P9_NOTAG && p9_idpool_check(tag, c->tagpool))
@@ -394,9 +395,9 @@ static void p9_free_req(struct p9_client *c, struct p9_req_t *r)
394 */ 395 */
395void p9_client_cb(struct p9_client *c, struct p9_req_t *req) 396void p9_client_cb(struct p9_client *c, struct p9_req_t *req)
396{ 397{
397 P9_DPRINTK(P9_DEBUG_MUX, " tag %d\n", req->tc->tag); 398 p9_debug(P9_DEBUG_MUX, " tag %d\n", req->tc->tag);
398 wake_up(req->wq); 399 wake_up(req->wq);
399 P9_DPRINTK(P9_DEBUG_MUX, "wakeup: %d\n", req->tc->tag); 400 p9_debug(P9_DEBUG_MUX, "wakeup: %d\n", req->tc->tag);
400} 401}
401EXPORT_SYMBOL(p9_client_cb); 402EXPORT_SYMBOL(p9_client_cb);
402 403
@@ -431,8 +432,8 @@ p9_parse_header(struct p9_fcall *pdu, int32_t *size, int8_t *type, int16_t *tag,
431 pdu->id = r_type; 432 pdu->id = r_type;
432 pdu->tag = r_tag; 433 pdu->tag = r_tag;
433 434
434 P9_DPRINTK(P9_DEBUG_9P, "<<< size=%d type: %d tag: %d\n", pdu->size, 435 p9_debug(P9_DEBUG_9P, "<<< size=%d type: %d tag: %d\n",
435 pdu->id, pdu->tag); 436 pdu->size, pdu->id, pdu->tag);
436 437
437 if (type) 438 if (type)
438 *type = r_type; 439 *type = r_type;
@@ -473,7 +474,7 @@ static int p9_check_errors(struct p9_client *c, struct p9_req_t *req)
473 */ 474 */
474 trace_9p_protocol_dump(c, req->rc); 475 trace_9p_protocol_dump(c, req->rc);
475 if (err) { 476 if (err) {
476 P9_DPRINTK(P9_DEBUG_ERROR, "couldn't parse header %d\n", err); 477 p9_debug(P9_DEBUG_ERROR, "couldn't parse header %d\n", err);
477 return err; 478 return err;
478 } 479 }
479 if (type != P9_RERROR && type != P9_RLERROR) 480 if (type != P9_RERROR && type != P9_RLERROR)
@@ -492,21 +493,21 @@ static int p9_check_errors(struct p9_client *c, struct p9_req_t *req)
492 if (!err || !IS_ERR_VALUE(err)) { 493 if (!err || !IS_ERR_VALUE(err)) {
493 err = p9_errstr2errno(ename, strlen(ename)); 494 err = p9_errstr2errno(ename, strlen(ename));
494 495
495 P9_DPRINTK(P9_DEBUG_9P, "<<< RERROR (%d) %s\n", 496 p9_debug(P9_DEBUG_9P, "<<< RERROR (%d) %s\n",
496 -ecode, ename); 497 -ecode, ename);
497 } 498 }
498 kfree(ename); 499 kfree(ename);
499 } else { 500 } else {
500 err = p9pdu_readf(req->rc, c->proto_version, "d", &ecode); 501 err = p9pdu_readf(req->rc, c->proto_version, "d", &ecode);
501 err = -ecode; 502 err = -ecode;
502 503
503 P9_DPRINTK(P9_DEBUG_9P, "<<< RLERROR (%d)\n", -ecode); 504 p9_debug(P9_DEBUG_9P, "<<< RLERROR (%d)\n", -ecode);
504 } 505 }
505 506
506 return err; 507 return err;
507 508
508out_err: 509out_err:
509 P9_DPRINTK(P9_DEBUG_ERROR, "couldn't parse error%d\n", err); 510 p9_debug(P9_DEBUG_ERROR, "couldn't parse error%d\n", err);
510 511
511 return err; 512 return err;
512} 513}
@@ -538,7 +539,7 @@ static int p9_check_zc_errors(struct p9_client *c, struct p9_req_t *req,
538 */ 539 */
539 trace_9p_protocol_dump(c, req->rc); 540 trace_9p_protocol_dump(c, req->rc);
540 if (err) { 541 if (err) {
541 P9_DPRINTK(P9_DEBUG_ERROR, "couldn't parse header %d\n", err); 542 p9_debug(P9_DEBUG_ERROR, "couldn't parse header %d\n", err);
542 return err; 543 return err;
543 } 544 }
544 545
@@ -601,22 +602,22 @@ static int p9_check_zc_errors(struct p9_client *c, struct p9_req_t *req,
601 if (!err || !IS_ERR_VALUE(err)) { 602 if (!err || !IS_ERR_VALUE(err)) {
602 err = p9_errstr2errno(ename, strlen(ename)); 603 err = p9_errstr2errno(ename, strlen(ename));
603 604
604 P9_DPRINTK(P9_DEBUG_9P, "<<< RERROR (%d) %s\n", 605 p9_debug(P9_DEBUG_9P, "<<< RERROR (%d) %s\n",
605 -ecode, ename); 606 -ecode, ename);
606 } 607 }
607 kfree(ename); 608 kfree(ename);
608 } else { 609 } else {
609 err = p9pdu_readf(req->rc, c->proto_version, "d", &ecode); 610 err = p9pdu_readf(req->rc, c->proto_version, "d", &ecode);
610 err = -ecode; 611 err = -ecode;
611 612
612 P9_DPRINTK(P9_DEBUG_9P, "<<< RLERROR (%d)\n", -ecode); 613 p9_debug(P9_DEBUG_9P, "<<< RLERROR (%d)\n", -ecode);
613 } 614 }
614 return err; 615 return err;
615 616
616out_free: 617out_free:
617 kfree(ename); 618 kfree(ename);
618out_err: 619out_err:
619 P9_DPRINTK(P9_DEBUG_ERROR, "couldn't parse error%d\n", err); 620 p9_debug(P9_DEBUG_ERROR, "couldn't parse error%d\n", err);
620 return err; 621 return err;
621} 622}
622 623
@@ -645,7 +646,7 @@ static int p9_client_flush(struct p9_client *c, struct p9_req_t *oldreq)
645 if (err) 646 if (err)
646 return err; 647 return err;
647 648
648 P9_DPRINTK(P9_DEBUG_9P, ">>> TFLUSH tag %d\n", oldtag); 649 p9_debug(P9_DEBUG_9P, ">>> TFLUSH tag %d\n", oldtag);
649 650
650 req = p9_client_rpc(c, P9_TFLUSH, "w", oldtag); 651 req = p9_client_rpc(c, P9_TFLUSH, "w", oldtag);
651 if (IS_ERR(req)) 652 if (IS_ERR(req))
@@ -670,7 +671,7 @@ static struct p9_req_t *p9_client_prepare_req(struct p9_client *c,
670 int tag, err; 671 int tag, err;
671 struct p9_req_t *req; 672 struct p9_req_t *req;
672 673
673 P9_DPRINTK(P9_DEBUG_MUX, "client %p op %d\n", c, type); 674 p9_debug(P9_DEBUG_MUX, "client %p op %d\n", c, type);
674 675
675 /* we allow for any status other than disconnected */ 676 /* we allow for any status other than disconnected */
676 if (c->status == Disconnected) 677 if (c->status == Disconnected)
@@ -744,11 +745,11 @@ p9_client_rpc(struct p9_client *c, int8_t type, const char *fmt, ...)
744 req->status >= REQ_STATUS_RCVD); 745 req->status >= REQ_STATUS_RCVD);
745 746
746 if (req->status == REQ_STATUS_ERROR) { 747 if (req->status == REQ_STATUS_ERROR) {
747 P9_DPRINTK(P9_DEBUG_ERROR, "req_status error %d\n", req->t_err); 748 p9_debug(P9_DEBUG_ERROR, "req_status error %d\n", req->t_err);
748 err = req->t_err; 749 err = req->t_err;
749 } 750 }
750 if ((err == -ERESTARTSYS) && (c->status == Connected)) { 751 if ((err == -ERESTARTSYS) && (c->status == Connected)) {
751 P9_DPRINTK(P9_DEBUG_MUX, "flushing\n"); 752 p9_debug(P9_DEBUG_MUX, "flushing\n");
752 sigpending = 1; 753 sigpending = 1;
753 clear_thread_flag(TIF_SIGPENDING); 754 clear_thread_flag(TIF_SIGPENDING);
754 755
@@ -827,11 +828,11 @@ static struct p9_req_t *p9_client_zc_rpc(struct p9_client *c, int8_t type,
827 goto reterr; 828 goto reterr;
828 } 829 }
829 if (req->status == REQ_STATUS_ERROR) { 830 if (req->status == REQ_STATUS_ERROR) {
830 P9_DPRINTK(P9_DEBUG_ERROR, "req_status error %d\n", req->t_err); 831 p9_debug(P9_DEBUG_ERROR, "req_status error %d\n", req->t_err);
831 err = req->t_err; 832 err = req->t_err;
832 } 833 }
833 if ((err == -ERESTARTSYS) && (c->status == Connected)) { 834 if ((err == -ERESTARTSYS) && (c->status == Connected)) {
834 P9_DPRINTK(P9_DEBUG_MUX, "flushing\n"); 835 p9_debug(P9_DEBUG_MUX, "flushing\n");
835 sigpending = 1; 836 sigpending = 1;
836 clear_thread_flag(TIF_SIGPENDING); 837 clear_thread_flag(TIF_SIGPENDING);
837 838
@@ -865,7 +866,7 @@ static struct p9_fid *p9_fid_create(struct p9_client *clnt)
865 struct p9_fid *fid; 866 struct p9_fid *fid;
866 unsigned long flags; 867 unsigned long flags;
867 868
868 P9_DPRINTK(P9_DEBUG_FID, "clnt %p\n", clnt); 869 p9_debug(P9_DEBUG_FID, "clnt %p\n", clnt);
869 fid = kmalloc(sizeof(struct p9_fid), GFP_KERNEL); 870 fid = kmalloc(sizeof(struct p9_fid), GFP_KERNEL);
870 if (!fid) 871 if (!fid)
871 return ERR_PTR(-ENOMEM); 872 return ERR_PTR(-ENOMEM);
@@ -898,7 +899,7 @@ static void p9_fid_destroy(struct p9_fid *fid)
898 struct p9_client *clnt; 899 struct p9_client *clnt;
899 unsigned long flags; 900 unsigned long flags;
900 901
901 P9_DPRINTK(P9_DEBUG_FID, "fid %d\n", fid->fid); 902 p9_debug(P9_DEBUG_FID, "fid %d\n", fid->fid);
902 clnt = fid->clnt; 903 clnt = fid->clnt;
903 p9_idpool_put(fid->fid, clnt->fidpool); 904 p9_idpool_put(fid->fid, clnt->fidpool);
904 spin_lock_irqsave(&clnt->lock, flags); 905 spin_lock_irqsave(&clnt->lock, flags);
@@ -915,8 +916,8 @@ static int p9_client_version(struct p9_client *c)
915 char *version; 916 char *version;
916 int msize; 917 int msize;
917 918
918 P9_DPRINTK(P9_DEBUG_9P, ">>> TVERSION msize %d protocol %d\n", 919 p9_debug(P9_DEBUG_9P, ">>> TVERSION msize %d protocol %d\n",
919 c->msize, c->proto_version); 920 c->msize, c->proto_version);
920 921
921 switch (c->proto_version) { 922 switch (c->proto_version) {
922 case p9_proto_2000L: 923 case p9_proto_2000L:
@@ -941,12 +942,12 @@ static int p9_client_version(struct p9_client *c)
941 942
942 err = p9pdu_readf(req->rc, c->proto_version, "ds", &msize, &version); 943 err = p9pdu_readf(req->rc, c->proto_version, "ds", &msize, &version);
943 if (err) { 944 if (err) {
944 P9_DPRINTK(P9_DEBUG_9P, "version error %d\n", err); 945 p9_debug(P9_DEBUG_9P, "version error %d\n", err);
945 trace_9p_protocol_dump(c, req->rc); 946 trace_9p_protocol_dump(c, req->rc);
946 goto error; 947 goto error;
947 } 948 }
948 949
949 P9_DPRINTK(P9_DEBUG_9P, "<<< RVERSION msize %d %s\n", msize, version); 950 p9_debug(P9_DEBUG_9P, "<<< RVERSION msize %d %s\n", msize, version);
950 if (!strncmp(version, "9P2000.L", 8)) 951 if (!strncmp(version, "9P2000.L", 8))
951 c->proto_version = p9_proto_2000L; 952 c->proto_version = p9_proto_2000L;
952 else if (!strncmp(version, "9P2000.u", 8)) 953 else if (!strncmp(version, "9P2000.u", 8))
@@ -996,8 +997,8 @@ struct p9_client *p9_client_create(const char *dev_name, char *options)
996 997
997 if (clnt->trans_mod == NULL) { 998 if (clnt->trans_mod == NULL) {
998 err = -EPROTONOSUPPORT; 999 err = -EPROTONOSUPPORT;
999 P9_DPRINTK(P9_DEBUG_ERROR, 1000 p9_debug(P9_DEBUG_ERROR,
1000 "No transport defined or default transport\n"); 1001 "No transport defined or default transport\n");
1001 goto destroy_tagpool; 1002 goto destroy_tagpool;
1002 } 1003 }
1003 1004
@@ -1007,8 +1008,8 @@ struct p9_client *p9_client_create(const char *dev_name, char *options)
1007 goto put_trans; 1008 goto put_trans;
1008 } 1009 }
1009 1010
1010 P9_DPRINTK(P9_DEBUG_MUX, "clnt %p trans %p msize %d protocol %d\n", 1011 p9_debug(P9_DEBUG_MUX, "clnt %p trans %p msize %d protocol %d\n",
1011 clnt, clnt->trans_mod, clnt->msize, clnt->proto_version); 1012 clnt, clnt->trans_mod, clnt->msize, clnt->proto_version);
1012 1013
1013 err = clnt->trans_mod->create(clnt, dev_name, options); 1014 err = clnt->trans_mod->create(clnt, dev_name, options);
1014 if (err) 1015 if (err)
@@ -1041,7 +1042,7 @@ void p9_client_destroy(struct p9_client *clnt)
1041{ 1042{
1042 struct p9_fid *fid, *fidptr; 1043 struct p9_fid *fid, *fidptr;
1043 1044
1044 P9_DPRINTK(P9_DEBUG_MUX, "clnt %p\n", clnt); 1045 p9_debug(P9_DEBUG_MUX, "clnt %p\n", clnt);
1045 1046
1046 if (clnt->trans_mod) 1047 if (clnt->trans_mod)
1047 clnt->trans_mod->close(clnt); 1048 clnt->trans_mod->close(clnt);
@@ -1049,7 +1050,7 @@ void p9_client_destroy(struct p9_client *clnt)
1049 v9fs_put_trans(clnt->trans_mod); 1050 v9fs_put_trans(clnt->trans_mod);
1050 1051
1051 list_for_each_entry_safe(fid, fidptr, &clnt->fidlist, flist) { 1052 list_for_each_entry_safe(fid, fidptr, &clnt->fidlist, flist) {
1052 printk(KERN_INFO "Found fid %d not clunked\n", fid->fid); 1053 pr_info("Found fid %d not clunked\n", fid->fid);
1053 p9_fid_destroy(fid); 1054 p9_fid_destroy(fid);
1054 } 1055 }
1055 1056
@@ -1064,14 +1065,14 @@ EXPORT_SYMBOL(p9_client_destroy);
1064 1065
1065void p9_client_disconnect(struct p9_client *clnt) 1066void p9_client_disconnect(struct p9_client *clnt)
1066{ 1067{
1067 P9_DPRINTK(P9_DEBUG_9P, "clnt %p\n", clnt); 1068 p9_debug(P9_DEBUG_9P, "clnt %p\n", clnt);
1068 clnt->status = Disconnected; 1069 clnt->status = Disconnected;
1069} 1070}
1070EXPORT_SYMBOL(p9_client_disconnect); 1071EXPORT_SYMBOL(p9_client_disconnect);
1071 1072
1072void p9_client_begin_disconnect(struct p9_client *clnt) 1073void p9_client_begin_disconnect(struct p9_client *clnt)
1073{ 1074{
1074 P9_DPRINTK(P9_DEBUG_9P, "clnt %p\n", clnt); 1075 p9_debug(P9_DEBUG_9P, "clnt %p\n", clnt);
1075 clnt->status = BeginDisconnect; 1076 clnt->status = BeginDisconnect;
1076} 1077}
1077EXPORT_SYMBOL(p9_client_begin_disconnect); 1078EXPORT_SYMBOL(p9_client_begin_disconnect);
@@ -1085,8 +1086,8 @@ struct p9_fid *p9_client_attach(struct p9_client *clnt, struct p9_fid *afid,
1085 struct p9_qid qid; 1086 struct p9_qid qid;
1086 1087
1087 1088
1088 P9_DPRINTK(P9_DEBUG_9P, ">>> TATTACH afid %d uname %s aname %s\n", 1089 p9_debug(P9_DEBUG_9P, ">>> TATTACH afid %d uname %s aname %s\n",
1089 afid ? afid->fid : -1, uname, aname); 1090 afid ? afid->fid : -1, uname, aname);
1090 fid = p9_fid_create(clnt); 1091 fid = p9_fid_create(clnt);
1091 if (IS_ERR(fid)) { 1092 if (IS_ERR(fid)) {
1092 err = PTR_ERR(fid); 1093 err = PTR_ERR(fid);
@@ -1108,10 +1109,8 @@ struct p9_fid *p9_client_attach(struct p9_client *clnt, struct p9_fid *afid,
1108 goto error; 1109 goto error;
1109 } 1110 }
1110 1111
1111 P9_DPRINTK(P9_DEBUG_9P, "<<< RATTACH qid %x.%llx.%x\n", 1112 p9_debug(P9_DEBUG_9P, "<<< RATTACH qid %x.%llx.%x\n",
1112 qid.type, 1113 qid.type, (unsigned long long)qid.path, qid.version);
1113 (unsigned long long)qid.path,
1114 qid.version);
1115 1114
1116 memmove(&fid->qid, &qid, sizeof(struct p9_qid)); 1115 memmove(&fid->qid, &qid, sizeof(struct p9_qid));
1117 1116
@@ -1151,8 +1150,8 @@ struct p9_fid *p9_client_walk(struct p9_fid *oldfid, uint16_t nwname,
1151 fid = oldfid; 1150 fid = oldfid;
1152 1151
1153 1152
1154 P9_DPRINTK(P9_DEBUG_9P, ">>> TWALK fids %d,%d nwname %ud wname[0] %s\n", 1153 p9_debug(P9_DEBUG_9P, ">>> TWALK fids %d,%d nwname %ud wname[0] %s\n",
1155 oldfid->fid, fid->fid, nwname, wnames ? wnames[0] : NULL); 1154 oldfid->fid, fid->fid, nwname, wnames ? wnames[0] : NULL);
1156 1155
1157 req = p9_client_rpc(clnt, P9_TWALK, "ddT", oldfid->fid, fid->fid, 1156 req = p9_client_rpc(clnt, P9_TWALK, "ddT", oldfid->fid, fid->fid,
1158 nwname, wnames); 1157 nwname, wnames);
@@ -1169,7 +1168,7 @@ struct p9_fid *p9_client_walk(struct p9_fid *oldfid, uint16_t nwname,
1169 } 1168 }
1170 p9_free_req(clnt, req); 1169 p9_free_req(clnt, req);
1171 1170
1172 P9_DPRINTK(P9_DEBUG_9P, "<<< RWALK nwqid %d:\n", nwqids); 1171 p9_debug(P9_DEBUG_9P, "<<< RWALK nwqid %d:\n", nwqids);
1173 1172
1174 if (nwqids != nwname) { 1173 if (nwqids != nwname) {
1175 err = -ENOENT; 1174 err = -ENOENT;
@@ -1177,7 +1176,7 @@ struct p9_fid *p9_client_walk(struct p9_fid *oldfid, uint16_t nwname,
1177 } 1176 }
1178 1177
1179 for (count = 0; count < nwqids; count++) 1178 for (count = 0; count < nwqids; count++)
1180 P9_DPRINTK(P9_DEBUG_9P, "<<< [%d] %x.%llx.%x\n", 1179 p9_debug(P9_DEBUG_9P, "<<< [%d] %x.%llx.%x\n",
1181 count, wqids[count].type, 1180 count, wqids[count].type,
1182 (unsigned long long)wqids[count].path, 1181 (unsigned long long)wqids[count].path,
1183 wqids[count].version); 1182 wqids[count].version);
@@ -1212,7 +1211,7 @@ int p9_client_open(struct p9_fid *fid, int mode)
1212 int iounit; 1211 int iounit;
1213 1212
1214 clnt = fid->clnt; 1213 clnt = fid->clnt;
1215 P9_DPRINTK(P9_DEBUG_9P, ">>> %s fid %d mode %d\n", 1214 p9_debug(P9_DEBUG_9P, ">>> %s fid %d mode %d\n",
1216 p9_is_proto_dotl(clnt) ? "TLOPEN" : "TOPEN", fid->fid, mode); 1215 p9_is_proto_dotl(clnt) ? "TLOPEN" : "TOPEN", fid->fid, mode);
1217 err = 0; 1216 err = 0;
1218 1217
@@ -1234,7 +1233,7 @@ int p9_client_open(struct p9_fid *fid, int mode)
1234 goto free_and_error; 1233 goto free_and_error;
1235 } 1234 }
1236 1235
1237 P9_DPRINTK(P9_DEBUG_9P, "<<< %s qid %x.%llx.%x iounit %x\n", 1236 p9_debug(P9_DEBUG_9P, "<<< %s qid %x.%llx.%x iounit %x\n",
1238 p9_is_proto_dotl(clnt) ? "RLOPEN" : "ROPEN", qid.type, 1237 p9_is_proto_dotl(clnt) ? "RLOPEN" : "ROPEN", qid.type,
1239 (unsigned long long)qid.path, qid.version, iounit); 1238 (unsigned long long)qid.path, qid.version, iounit);
1240 1239
@@ -1256,7 +1255,7 @@ int p9_client_create_dotl(struct p9_fid *ofid, char *name, u32 flags, u32 mode,
1256 struct p9_req_t *req; 1255 struct p9_req_t *req;
1257 int iounit; 1256 int iounit;
1258 1257
1259 P9_DPRINTK(P9_DEBUG_9P, 1258 p9_debug(P9_DEBUG_9P,
1260 ">>> TLCREATE fid %d name %s flags %d mode %d gid %d\n", 1259 ">>> TLCREATE fid %d name %s flags %d mode %d gid %d\n",
1261 ofid->fid, name, flags, mode, gid); 1260 ofid->fid, name, flags, mode, gid);
1262 clnt = ofid->clnt; 1261 clnt = ofid->clnt;
@@ -1277,7 +1276,7 @@ int p9_client_create_dotl(struct p9_fid *ofid, char *name, u32 flags, u32 mode,
1277 goto free_and_error; 1276 goto free_and_error;
1278 } 1277 }
1279 1278
1280 P9_DPRINTK(P9_DEBUG_9P, "<<< RLCREATE qid %x.%llx.%x iounit %x\n", 1279 p9_debug(P9_DEBUG_9P, "<<< RLCREATE qid %x.%llx.%x iounit %x\n",
1281 qid->type, 1280 qid->type,
1282 (unsigned long long)qid->path, 1281 (unsigned long long)qid->path,
1283 qid->version, iounit); 1282 qid->version, iounit);
@@ -1301,7 +1300,7 @@ int p9_client_fcreate(struct p9_fid *fid, char *name, u32 perm, int mode,
1301 struct p9_qid qid; 1300 struct p9_qid qid;
1302 int iounit; 1301 int iounit;
1303 1302
1304 P9_DPRINTK(P9_DEBUG_9P, ">>> TCREATE fid %d name %s perm %d mode %d\n", 1303 p9_debug(P9_DEBUG_9P, ">>> TCREATE fid %d name %s perm %d mode %d\n",
1305 fid->fid, name, perm, mode); 1304 fid->fid, name, perm, mode);
1306 err = 0; 1305 err = 0;
1307 clnt = fid->clnt; 1306 clnt = fid->clnt;
@@ -1322,7 +1321,7 @@ int p9_client_fcreate(struct p9_fid *fid, char *name, u32 perm, int mode,
1322 goto free_and_error; 1321 goto free_and_error;
1323 } 1322 }
1324 1323
1325 P9_DPRINTK(P9_DEBUG_9P, "<<< RCREATE qid %x.%llx.%x iounit %x\n", 1324 p9_debug(P9_DEBUG_9P, "<<< RCREATE qid %x.%llx.%x iounit %x\n",
1326 qid.type, 1325 qid.type,
1327 (unsigned long long)qid.path, 1326 (unsigned long long)qid.path,
1328 qid.version, iounit); 1327 qid.version, iounit);
@@ -1344,7 +1343,7 @@ int p9_client_symlink(struct p9_fid *dfid, char *name, char *symtgt, gid_t gid,
1344 struct p9_client *clnt; 1343 struct p9_client *clnt;
1345 struct p9_req_t *req; 1344 struct p9_req_t *req;
1346 1345
1347 P9_DPRINTK(P9_DEBUG_9P, ">>> TSYMLINK dfid %d name %s symtgt %s\n", 1346 p9_debug(P9_DEBUG_9P, ">>> TSYMLINK dfid %d name %s symtgt %s\n",
1348 dfid->fid, name, symtgt); 1347 dfid->fid, name, symtgt);
1349 clnt = dfid->clnt; 1348 clnt = dfid->clnt;
1350 1349
@@ -1361,7 +1360,7 @@ int p9_client_symlink(struct p9_fid *dfid, char *name, char *symtgt, gid_t gid,
1361 goto free_and_error; 1360 goto free_and_error;
1362 } 1361 }
1363 1362
1364 P9_DPRINTK(P9_DEBUG_9P, "<<< RSYMLINK qid %x.%llx.%x\n", 1363 p9_debug(P9_DEBUG_9P, "<<< RSYMLINK qid %x.%llx.%x\n",
1365 qid->type, (unsigned long long)qid->path, qid->version); 1364 qid->type, (unsigned long long)qid->path, qid->version);
1366 1365
1367free_and_error: 1366free_and_error:
@@ -1376,7 +1375,7 @@ int p9_client_link(struct p9_fid *dfid, struct p9_fid *oldfid, char *newname)
1376 struct p9_client *clnt; 1375 struct p9_client *clnt;
1377 struct p9_req_t *req; 1376 struct p9_req_t *req;
1378 1377
1379 P9_DPRINTK(P9_DEBUG_9P, ">>> TLINK dfid %d oldfid %d newname %s\n", 1378 p9_debug(P9_DEBUG_9P, ">>> TLINK dfid %d oldfid %d newname %s\n",
1380 dfid->fid, oldfid->fid, newname); 1379 dfid->fid, oldfid->fid, newname);
1381 clnt = dfid->clnt; 1380 clnt = dfid->clnt;
1382 req = p9_client_rpc(clnt, P9_TLINK, "dds", dfid->fid, oldfid->fid, 1381 req = p9_client_rpc(clnt, P9_TLINK, "dds", dfid->fid, oldfid->fid,
@@ -1384,7 +1383,7 @@ int p9_client_link(struct p9_fid *dfid, struct p9_fid *oldfid, char *newname)
1384 if (IS_ERR(req)) 1383 if (IS_ERR(req))
1385 return PTR_ERR(req); 1384 return PTR_ERR(req);
1386 1385
1387 P9_DPRINTK(P9_DEBUG_9P, "<<< RLINK\n"); 1386 p9_debug(P9_DEBUG_9P, "<<< RLINK\n");
1388 p9_free_req(clnt, req); 1387 p9_free_req(clnt, req);
1389 return 0; 1388 return 0;
1390} 1389}
@@ -1396,7 +1395,7 @@ int p9_client_fsync(struct p9_fid *fid, int datasync)
1396 struct p9_client *clnt; 1395 struct p9_client *clnt;
1397 struct p9_req_t *req; 1396 struct p9_req_t *req;
1398 1397
1399 P9_DPRINTK(P9_DEBUG_9P, ">>> TFSYNC fid %d datasync:%d\n", 1398 p9_debug(P9_DEBUG_9P, ">>> TFSYNC fid %d datasync:%d\n",
1400 fid->fid, datasync); 1399 fid->fid, datasync);
1401 err = 0; 1400 err = 0;
1402 clnt = fid->clnt; 1401 clnt = fid->clnt;
@@ -1407,7 +1406,7 @@ int p9_client_fsync(struct p9_fid *fid, int datasync)
1407 goto error; 1406 goto error;
1408 } 1407 }
1409 1408
1410 P9_DPRINTK(P9_DEBUG_9P, "<<< RFSYNC fid %d\n", fid->fid); 1409 p9_debug(P9_DEBUG_9P, "<<< RFSYNC fid %d\n", fid->fid);
1411 1410
1412 p9_free_req(clnt, req); 1411 p9_free_req(clnt, req);
1413 1412
@@ -1423,12 +1422,13 @@ int p9_client_clunk(struct p9_fid *fid)
1423 struct p9_req_t *req; 1422 struct p9_req_t *req;
1424 1423
1425 if (!fid) { 1424 if (!fid) {
1426 P9_EPRINTK(KERN_WARNING, "Trying to clunk with NULL fid\n"); 1425 pr_warn("%s (%d): Trying to clunk with NULL fid\n",
1426 __func__, task_pid_nr(current));
1427 dump_stack(); 1427 dump_stack();
1428 return 0; 1428 return 0;
1429 } 1429 }
1430 1430
1431 P9_DPRINTK(P9_DEBUG_9P, ">>> TCLUNK fid %d\n", fid->fid); 1431 p9_debug(P9_DEBUG_9P, ">>> TCLUNK fid %d\n", fid->fid);
1432 err = 0; 1432 err = 0;
1433 clnt = fid->clnt; 1433 clnt = fid->clnt;
1434 1434
@@ -1438,7 +1438,7 @@ int p9_client_clunk(struct p9_fid *fid)
1438 goto error; 1438 goto error;
1439 } 1439 }
1440 1440
1441 P9_DPRINTK(P9_DEBUG_9P, "<<< RCLUNK fid %d\n", fid->fid); 1441 p9_debug(P9_DEBUG_9P, "<<< RCLUNK fid %d\n", fid->fid);
1442 1442
1443 p9_free_req(clnt, req); 1443 p9_free_req(clnt, req);
1444error: 1444error:
@@ -1456,7 +1456,7 @@ int p9_client_remove(struct p9_fid *fid)
1456 struct p9_client *clnt; 1456 struct p9_client *clnt;
1457 struct p9_req_t *req; 1457 struct p9_req_t *req;
1458 1458
1459 P9_DPRINTK(P9_DEBUG_9P, ">>> TREMOVE fid %d\n", fid->fid); 1459 p9_debug(P9_DEBUG_9P, ">>> TREMOVE fid %d\n", fid->fid);
1460 err = 0; 1460 err = 0;
1461 clnt = fid->clnt; 1461 clnt = fid->clnt;
1462 1462
@@ -1466,7 +1466,7 @@ int p9_client_remove(struct p9_fid *fid)
1466 goto error; 1466 goto error;
1467 } 1467 }
1468 1468
1469 P9_DPRINTK(P9_DEBUG_9P, "<<< RREMOVE fid %d\n", fid->fid); 1469 p9_debug(P9_DEBUG_9P, "<<< RREMOVE fid %d\n", fid->fid);
1470 1470
1471 p9_free_req(clnt, req); 1471 p9_free_req(clnt, req);
1472error: 1472error:
@@ -1481,7 +1481,7 @@ int p9_client_unlinkat(struct p9_fid *dfid, const char *name, int flags)
1481 struct p9_req_t *req; 1481 struct p9_req_t *req;
1482 struct p9_client *clnt; 1482 struct p9_client *clnt;
1483 1483
1484 P9_DPRINTK(P9_DEBUG_9P, ">>> TUNLINKAT fid %d %s %d\n", 1484 p9_debug(P9_DEBUG_9P, ">>> TUNLINKAT fid %d %s %d\n",
1485 dfid->fid, name, flags); 1485 dfid->fid, name, flags);
1486 1486
1487 clnt = dfid->clnt; 1487 clnt = dfid->clnt;
@@ -1490,7 +1490,7 @@ int p9_client_unlinkat(struct p9_fid *dfid, const char *name, int flags)
1490 err = PTR_ERR(req); 1490 err = PTR_ERR(req);
1491 goto error; 1491 goto error;
1492 } 1492 }
1493 P9_DPRINTK(P9_DEBUG_9P, "<<< RUNLINKAT fid %d %s\n", dfid->fid, name); 1493 p9_debug(P9_DEBUG_9P, "<<< RUNLINKAT fid %d %s\n", dfid->fid, name);
1494 1494
1495 p9_free_req(clnt, req); 1495 p9_free_req(clnt, req);
1496error: 1496error:
@@ -1509,7 +1509,7 @@ p9_client_read(struct p9_fid *fid, char *data, char __user *udata, u64 offset,
1509 int err, rsize, non_zc = 0; 1509 int err, rsize, non_zc = 0;
1510 1510
1511 1511
1512 P9_DPRINTK(P9_DEBUG_9P, ">>> TREAD fid %d offset %llu %d\n", 1512 p9_debug(P9_DEBUG_9P, ">>> TREAD fid %d offset %llu %d\n",
1513 fid->fid, (long long unsigned) offset, count); 1513 fid->fid, (long long unsigned) offset, count);
1514 err = 0; 1514 err = 0;
1515 clnt = fid->clnt; 1515 clnt = fid->clnt;
@@ -1552,7 +1552,7 @@ p9_client_read(struct p9_fid *fid, char *data, char __user *udata, u64 offset,
1552 goto free_and_error; 1552 goto free_and_error;
1553 } 1553 }
1554 1554
1555 P9_DPRINTK(P9_DEBUG_9P, "<<< RREAD count %d\n", count); 1555 p9_debug(P9_DEBUG_9P, "<<< RREAD count %d\n", count);
1556 1556
1557 if (non_zc) { 1557 if (non_zc) {
1558 if (data) { 1558 if (data) {
@@ -1584,7 +1584,7 @@ p9_client_write(struct p9_fid *fid, char *data, const char __user *udata,
1584 struct p9_client *clnt; 1584 struct p9_client *clnt;
1585 struct p9_req_t *req; 1585 struct p9_req_t *req;
1586 1586
1587 P9_DPRINTK(P9_DEBUG_9P, ">>> TWRITE fid %d offset %llu count %d\n", 1587 p9_debug(P9_DEBUG_9P, ">>> TWRITE fid %d offset %llu count %d\n",
1588 fid->fid, (long long unsigned) offset, count); 1588 fid->fid, (long long unsigned) offset, count);
1589 err = 0; 1589 err = 0;
1590 clnt = fid->clnt; 1590 clnt = fid->clnt;
@@ -1626,7 +1626,7 @@ p9_client_write(struct p9_fid *fid, char *data, const char __user *udata,
1626 goto free_and_error; 1626 goto free_and_error;
1627 } 1627 }
1628 1628
1629 P9_DPRINTK(P9_DEBUG_9P, "<<< RWRITE count %d\n", count); 1629 p9_debug(P9_DEBUG_9P, "<<< RWRITE count %d\n", count);
1630 1630
1631 p9_free_req(clnt, req); 1631 p9_free_req(clnt, req);
1632 return count; 1632 return count;
@@ -1646,7 +1646,7 @@ struct p9_wstat *p9_client_stat(struct p9_fid *fid)
1646 struct p9_req_t *req; 1646 struct p9_req_t *req;
1647 u16 ignored; 1647 u16 ignored;
1648 1648
1649 P9_DPRINTK(P9_DEBUG_9P, ">>> TSTAT fid %d\n", fid->fid); 1649 p9_debug(P9_DEBUG_9P, ">>> TSTAT fid %d\n", fid->fid);
1650 1650
1651 if (!ret) 1651 if (!ret)
1652 return ERR_PTR(-ENOMEM); 1652 return ERR_PTR(-ENOMEM);
@@ -1667,7 +1667,7 @@ struct p9_wstat *p9_client_stat(struct p9_fid *fid)
1667 goto error; 1667 goto error;
1668 } 1668 }
1669 1669
1670 P9_DPRINTK(P9_DEBUG_9P, 1670 p9_debug(P9_DEBUG_9P,
1671 "<<< RSTAT sz=%x type=%x dev=%x qid=%x.%llx.%x\n" 1671 "<<< RSTAT sz=%x type=%x dev=%x qid=%x.%llx.%x\n"
1672 "<<< mode=%8.8x atime=%8.8x mtime=%8.8x length=%llx\n" 1672 "<<< mode=%8.8x atime=%8.8x mtime=%8.8x length=%llx\n"
1673 "<<< name=%s uid=%s gid=%s muid=%s extension=(%s)\n" 1673 "<<< name=%s uid=%s gid=%s muid=%s extension=(%s)\n"
@@ -1696,7 +1696,7 @@ struct p9_stat_dotl *p9_client_getattr_dotl(struct p9_fid *fid,
1696 GFP_KERNEL); 1696 GFP_KERNEL);
1697 struct p9_req_t *req; 1697 struct p9_req_t *req;
1698 1698
1699 P9_DPRINTK(P9_DEBUG_9P, ">>> TGETATTR fid %d, request_mask %lld\n", 1699 p9_debug(P9_DEBUG_9P, ">>> TGETATTR fid %d, request_mask %lld\n",
1700 fid->fid, request_mask); 1700 fid->fid, request_mask);
1701 1701
1702 if (!ret) 1702 if (!ret)
@@ -1718,7 +1718,7 @@ struct p9_stat_dotl *p9_client_getattr_dotl(struct p9_fid *fid,
1718 goto error; 1718 goto error;
1719 } 1719 }
1720 1720
1721 P9_DPRINTK(P9_DEBUG_9P, 1721 p9_debug(P9_DEBUG_9P,
1722 "<<< RGETATTR st_result_mask=%lld\n" 1722 "<<< RGETATTR st_result_mask=%lld\n"
1723 "<<< qid=%x.%llx.%x\n" 1723 "<<< qid=%x.%llx.%x\n"
1724 "<<< st_mode=%8.8x st_nlink=%llu\n" 1724 "<<< st_mode=%8.8x st_nlink=%llu\n"
@@ -1784,8 +1784,8 @@ int p9_client_wstat(struct p9_fid *fid, struct p9_wstat *wst)
1784 err = 0; 1784 err = 0;
1785 clnt = fid->clnt; 1785 clnt = fid->clnt;
1786 wst->size = p9_client_statsize(wst, clnt->proto_version); 1786 wst->size = p9_client_statsize(wst, clnt->proto_version);
1787 P9_DPRINTK(P9_DEBUG_9P, ">>> TWSTAT fid %d\n", fid->fid); 1787 p9_debug(P9_DEBUG_9P, ">>> TWSTAT fid %d\n", fid->fid);
1788 P9_DPRINTK(P9_DEBUG_9P, 1788 p9_debug(P9_DEBUG_9P,
1789 " sz=%x type=%x dev=%x qid=%x.%llx.%x\n" 1789 " sz=%x type=%x dev=%x qid=%x.%llx.%x\n"
1790 " mode=%8.8x atime=%8.8x mtime=%8.8x length=%llx\n" 1790 " mode=%8.8x atime=%8.8x mtime=%8.8x length=%llx\n"
1791 " name=%s uid=%s gid=%s muid=%s extension=(%s)\n" 1791 " name=%s uid=%s gid=%s muid=%s extension=(%s)\n"
@@ -1802,7 +1802,7 @@ int p9_client_wstat(struct p9_fid *fid, struct p9_wstat *wst)
1802 goto error; 1802 goto error;
1803 } 1803 }
1804 1804
1805 P9_DPRINTK(P9_DEBUG_9P, "<<< RWSTAT fid %d\n", fid->fid); 1805 p9_debug(P9_DEBUG_9P, "<<< RWSTAT fid %d\n", fid->fid);
1806 1806
1807 p9_free_req(clnt, req); 1807 p9_free_req(clnt, req);
1808error: 1808error:
@@ -1818,8 +1818,8 @@ int p9_client_setattr(struct p9_fid *fid, struct p9_iattr_dotl *p9attr)
1818 1818
1819 err = 0; 1819 err = 0;
1820 clnt = fid->clnt; 1820 clnt = fid->clnt;
1821 P9_DPRINTK(P9_DEBUG_9P, ">>> TSETATTR fid %d\n", fid->fid); 1821 p9_debug(P9_DEBUG_9P, ">>> TSETATTR fid %d\n", fid->fid);
1822 P9_DPRINTK(P9_DEBUG_9P, 1822 p9_debug(P9_DEBUG_9P,
1823 " valid=%x mode=%x uid=%d gid=%d size=%lld\n" 1823 " valid=%x mode=%x uid=%d gid=%d size=%lld\n"
1824 " atime_sec=%lld atime_nsec=%lld\n" 1824 " atime_sec=%lld atime_nsec=%lld\n"
1825 " mtime_sec=%lld mtime_nsec=%lld\n", 1825 " mtime_sec=%lld mtime_nsec=%lld\n",
@@ -1833,7 +1833,7 @@ int p9_client_setattr(struct p9_fid *fid, struct p9_iattr_dotl *p9attr)
1833 err = PTR_ERR(req); 1833 err = PTR_ERR(req);
1834 goto error; 1834 goto error;
1835 } 1835 }
1836 P9_DPRINTK(P9_DEBUG_9P, "<<< RSETATTR fid %d\n", fid->fid); 1836 p9_debug(P9_DEBUG_9P, "<<< RSETATTR fid %d\n", fid->fid);
1837 p9_free_req(clnt, req); 1837 p9_free_req(clnt, req);
1838error: 1838error:
1839 return err; 1839 return err;
@@ -1849,7 +1849,7 @@ int p9_client_statfs(struct p9_fid *fid, struct p9_rstatfs *sb)
1849 err = 0; 1849 err = 0;
1850 clnt = fid->clnt; 1850 clnt = fid->clnt;
1851 1851
1852 P9_DPRINTK(P9_DEBUG_9P, ">>> TSTATFS fid %d\n", fid->fid); 1852 p9_debug(P9_DEBUG_9P, ">>> TSTATFS fid %d\n", fid->fid);
1853 1853
1854 req = p9_client_rpc(clnt, P9_TSTATFS, "d", fid->fid); 1854 req = p9_client_rpc(clnt, P9_TSTATFS, "d", fid->fid);
1855 if (IS_ERR(req)) { 1855 if (IS_ERR(req)) {
@@ -1866,7 +1866,7 @@ int p9_client_statfs(struct p9_fid *fid, struct p9_rstatfs *sb)
1866 goto error; 1866 goto error;
1867 } 1867 }
1868 1868
1869 P9_DPRINTK(P9_DEBUG_9P, "<<< RSTATFS fid %d type 0x%lx bsize %ld " 1869 p9_debug(P9_DEBUG_9P, "<<< RSTATFS fid %d type 0x%lx bsize %ld "
1870 "blocks %llu bfree %llu bavail %llu files %llu ffree %llu " 1870 "blocks %llu bfree %llu bavail %llu files %llu ffree %llu "
1871 "fsid %llu namelen %ld\n", 1871 "fsid %llu namelen %ld\n",
1872 fid->fid, (long unsigned int)sb->type, (long int)sb->bsize, 1872 fid->fid, (long unsigned int)sb->type, (long int)sb->bsize,
@@ -1889,7 +1889,7 @@ int p9_client_rename(struct p9_fid *fid,
1889 err = 0; 1889 err = 0;
1890 clnt = fid->clnt; 1890 clnt = fid->clnt;
1891 1891
1892 P9_DPRINTK(P9_DEBUG_9P, ">>> TRENAME fid %d newdirfid %d name %s\n", 1892 p9_debug(P9_DEBUG_9P, ">>> TRENAME fid %d newdirfid %d name %s\n",
1893 fid->fid, newdirfid->fid, name); 1893 fid->fid, newdirfid->fid, name);
1894 1894
1895 req = p9_client_rpc(clnt, P9_TRENAME, "dds", fid->fid, 1895 req = p9_client_rpc(clnt, P9_TRENAME, "dds", fid->fid,
@@ -1899,7 +1899,7 @@ int p9_client_rename(struct p9_fid *fid,
1899 goto error; 1899 goto error;
1900 } 1900 }
1901 1901
1902 P9_DPRINTK(P9_DEBUG_9P, "<<< RRENAME fid %d\n", fid->fid); 1902 p9_debug(P9_DEBUG_9P, "<<< RRENAME fid %d\n", fid->fid);
1903 1903
1904 p9_free_req(clnt, req); 1904 p9_free_req(clnt, req);
1905error: 1905error:
@@ -1917,7 +1917,7 @@ int p9_client_renameat(struct p9_fid *olddirfid, const char *old_name,
1917 err = 0; 1917 err = 0;
1918 clnt = olddirfid->clnt; 1918 clnt = olddirfid->clnt;
1919 1919
1920 P9_DPRINTK(P9_DEBUG_9P, ">>> TRENAMEAT olddirfid %d old name %s" 1920 p9_debug(P9_DEBUG_9P, ">>> TRENAMEAT olddirfid %d old name %s"
1921 " newdirfid %d new name %s\n", olddirfid->fid, old_name, 1921 " newdirfid %d new name %s\n", olddirfid->fid, old_name,
1922 newdirfid->fid, new_name); 1922 newdirfid->fid, new_name);
1923 1923
@@ -1928,7 +1928,7 @@ int p9_client_renameat(struct p9_fid *olddirfid, const char *old_name,
1928 goto error; 1928 goto error;
1929 } 1929 }
1930 1930
1931 P9_DPRINTK(P9_DEBUG_9P, "<<< RRENAMEAT newdirfid %d new name %s\n", 1931 p9_debug(P9_DEBUG_9P, "<<< RRENAMEAT newdirfid %d new name %s\n",
1932 newdirfid->fid, new_name); 1932 newdirfid->fid, new_name);
1933 1933
1934 p9_free_req(clnt, req); 1934 p9_free_req(clnt, req);
@@ -1956,7 +1956,7 @@ struct p9_fid *p9_client_xattrwalk(struct p9_fid *file_fid,
1956 attr_fid = NULL; 1956 attr_fid = NULL;
1957 goto error; 1957 goto error;
1958 } 1958 }
1959 P9_DPRINTK(P9_DEBUG_9P, 1959 p9_debug(P9_DEBUG_9P,
1960 ">>> TXATTRWALK file_fid %d, attr_fid %d name %s\n", 1960 ">>> TXATTRWALK file_fid %d, attr_fid %d name %s\n",
1961 file_fid->fid, attr_fid->fid, attr_name); 1961 file_fid->fid, attr_fid->fid, attr_name);
1962 1962
@@ -1973,7 +1973,7 @@ struct p9_fid *p9_client_xattrwalk(struct p9_fid *file_fid,
1973 goto clunk_fid; 1973 goto clunk_fid;
1974 } 1974 }
1975 p9_free_req(clnt, req); 1975 p9_free_req(clnt, req);
1976 P9_DPRINTK(P9_DEBUG_9P, "<<< RXATTRWALK fid %d size %llu\n", 1976 p9_debug(P9_DEBUG_9P, "<<< RXATTRWALK fid %d size %llu\n",
1977 attr_fid->fid, *attr_size); 1977 attr_fid->fid, *attr_size);
1978 return attr_fid; 1978 return attr_fid;
1979clunk_fid: 1979clunk_fid:
@@ -1994,7 +1994,7 @@ int p9_client_xattrcreate(struct p9_fid *fid, const char *name,
1994 struct p9_req_t *req; 1994 struct p9_req_t *req;
1995 struct p9_client *clnt; 1995 struct p9_client *clnt;
1996 1996
1997 P9_DPRINTK(P9_DEBUG_9P, 1997 p9_debug(P9_DEBUG_9P,
1998 ">>> TXATTRCREATE fid %d name %s size %lld flag %d\n", 1998 ">>> TXATTRCREATE fid %d name %s size %lld flag %d\n",
1999 fid->fid, name, (long long)attr_size, flags); 1999 fid->fid, name, (long long)attr_size, flags);
2000 err = 0; 2000 err = 0;
@@ -2005,7 +2005,7 @@ int p9_client_xattrcreate(struct p9_fid *fid, const char *name,
2005 err = PTR_ERR(req); 2005 err = PTR_ERR(req);
2006 goto error; 2006 goto error;
2007 } 2007 }
2008 P9_DPRINTK(P9_DEBUG_9P, "<<< RXATTRCREATE fid %d\n", fid->fid); 2008 p9_debug(P9_DEBUG_9P, "<<< RXATTRCREATE fid %d\n", fid->fid);
2009 p9_free_req(clnt, req); 2009 p9_free_req(clnt, req);
2010error: 2010error:
2011 return err; 2011 return err;
@@ -2019,7 +2019,7 @@ int p9_client_readdir(struct p9_fid *fid, char *data, u32 count, u64 offset)
2019 struct p9_req_t *req; 2019 struct p9_req_t *req;
2020 char *dataptr; 2020 char *dataptr;
2021 2021
2022 P9_DPRINTK(P9_DEBUG_9P, ">>> TREADDIR fid %d offset %llu count %d\n", 2022 p9_debug(P9_DEBUG_9P, ">>> TREADDIR fid %d offset %llu count %d\n",
2023 fid->fid, (long long unsigned) offset, count); 2023 fid->fid, (long long unsigned) offset, count);
2024 2024
2025 err = 0; 2025 err = 0;
@@ -2056,7 +2056,7 @@ int p9_client_readdir(struct p9_fid *fid, char *data, u32 count, u64 offset)
2056 goto free_and_error; 2056 goto free_and_error;
2057 } 2057 }
2058 2058
2059 P9_DPRINTK(P9_DEBUG_9P, "<<< RREADDIR count %d\n", count); 2059 p9_debug(P9_DEBUG_9P, "<<< RREADDIR count %d\n", count);
2060 2060
2061 if (non_zc) 2061 if (non_zc)
2062 memmove(data, dataptr, count); 2062 memmove(data, dataptr, count);
@@ -2080,7 +2080,7 @@ int p9_client_mknod_dotl(struct p9_fid *fid, char *name, int mode,
2080 2080
2081 err = 0; 2081 err = 0;
2082 clnt = fid->clnt; 2082 clnt = fid->clnt;
2083 P9_DPRINTK(P9_DEBUG_9P, ">>> TMKNOD fid %d name %s mode %d major %d " 2083 p9_debug(P9_DEBUG_9P, ">>> TMKNOD fid %d name %s mode %d major %d "
2084 "minor %d\n", fid->fid, name, mode, MAJOR(rdev), MINOR(rdev)); 2084 "minor %d\n", fid->fid, name, mode, MAJOR(rdev), MINOR(rdev));
2085 req = p9_client_rpc(clnt, P9_TMKNOD, "dsdddd", fid->fid, name, mode, 2085 req = p9_client_rpc(clnt, P9_TMKNOD, "dsdddd", fid->fid, name, mode,
2086 MAJOR(rdev), MINOR(rdev), gid); 2086 MAJOR(rdev), MINOR(rdev), gid);
@@ -2092,7 +2092,7 @@ int p9_client_mknod_dotl(struct p9_fid *fid, char *name, int mode,
2092 trace_9p_protocol_dump(clnt, req->rc); 2092 trace_9p_protocol_dump(clnt, req->rc);
2093 goto error; 2093 goto error;
2094 } 2094 }
2095 P9_DPRINTK(P9_DEBUG_9P, "<<< RMKNOD qid %x.%llx.%x\n", qid->type, 2095 p9_debug(P9_DEBUG_9P, "<<< RMKNOD qid %x.%llx.%x\n", qid->type,
2096 (unsigned long long)qid->path, qid->version); 2096 (unsigned long long)qid->path, qid->version);
2097 2097
2098error: 2098error:
@@ -2111,7 +2111,7 @@ int p9_client_mkdir_dotl(struct p9_fid *fid, char *name, int mode,
2111 2111
2112 err = 0; 2112 err = 0;
2113 clnt = fid->clnt; 2113 clnt = fid->clnt;
2114 P9_DPRINTK(P9_DEBUG_9P, ">>> TMKDIR fid %d name %s mode %d gid %d\n", 2114 p9_debug(P9_DEBUG_9P, ">>> TMKDIR fid %d name %s mode %d gid %d\n",
2115 fid->fid, name, mode, gid); 2115 fid->fid, name, mode, gid);
2116 req = p9_client_rpc(clnt, P9_TMKDIR, "dsdd", fid->fid, name, mode, 2116 req = p9_client_rpc(clnt, P9_TMKDIR, "dsdd", fid->fid, name, mode,
2117 gid); 2117 gid);
@@ -2123,7 +2123,7 @@ int p9_client_mkdir_dotl(struct p9_fid *fid, char *name, int mode,
2123 trace_9p_protocol_dump(clnt, req->rc); 2123 trace_9p_protocol_dump(clnt, req->rc);
2124 goto error; 2124 goto error;
2125 } 2125 }
2126 P9_DPRINTK(P9_DEBUG_9P, "<<< RMKDIR qid %x.%llx.%x\n", qid->type, 2126 p9_debug(P9_DEBUG_9P, "<<< RMKDIR qid %x.%llx.%x\n", qid->type,
2127 (unsigned long long)qid->path, qid->version); 2127 (unsigned long long)qid->path, qid->version);
2128 2128
2129error: 2129error:
@@ -2141,7 +2141,7 @@ int p9_client_lock_dotl(struct p9_fid *fid, struct p9_flock *flock, u8 *status)
2141 2141
2142 err = 0; 2142 err = 0;
2143 clnt = fid->clnt; 2143 clnt = fid->clnt;
2144 P9_DPRINTK(P9_DEBUG_9P, ">>> TLOCK fid %d type %i flags %d " 2144 p9_debug(P9_DEBUG_9P, ">>> TLOCK fid %d type %i flags %d "
2145 "start %lld length %lld proc_id %d client_id %s\n", 2145 "start %lld length %lld proc_id %d client_id %s\n",
2146 fid->fid, flock->type, flock->flags, flock->start, 2146 fid->fid, flock->type, flock->flags, flock->start,
2147 flock->length, flock->proc_id, flock->client_id); 2147 flock->length, flock->proc_id, flock->client_id);
@@ -2158,7 +2158,7 @@ int p9_client_lock_dotl(struct p9_fid *fid, struct p9_flock *flock, u8 *status)
2158 trace_9p_protocol_dump(clnt, req->rc); 2158 trace_9p_protocol_dump(clnt, req->rc);
2159 goto error; 2159 goto error;
2160 } 2160 }
2161 P9_DPRINTK(P9_DEBUG_9P, "<<< RLOCK status %i\n", *status); 2161 p9_debug(P9_DEBUG_9P, "<<< RLOCK status %i\n", *status);
2162error: 2162error:
2163 p9_free_req(clnt, req); 2163 p9_free_req(clnt, req);
2164 return err; 2164 return err;
@@ -2174,7 +2174,7 @@ int p9_client_getlock_dotl(struct p9_fid *fid, struct p9_getlock *glock)
2174 2174
2175 err = 0; 2175 err = 0;
2176 clnt = fid->clnt; 2176 clnt = fid->clnt;
2177 P9_DPRINTK(P9_DEBUG_9P, ">>> TGETLOCK fid %d, type %i start %lld " 2177 p9_debug(P9_DEBUG_9P, ">>> TGETLOCK fid %d, type %i start %lld "
2178 "length %lld proc_id %d client_id %s\n", fid->fid, glock->type, 2178 "length %lld proc_id %d client_id %s\n", fid->fid, glock->type,
2179 glock->start, glock->length, glock->proc_id, glock->client_id); 2179 glock->start, glock->length, glock->proc_id, glock->client_id);
2180 2180
@@ -2191,7 +2191,7 @@ int p9_client_getlock_dotl(struct p9_fid *fid, struct p9_getlock *glock)
2191 trace_9p_protocol_dump(clnt, req->rc); 2191 trace_9p_protocol_dump(clnt, req->rc);
2192 goto error; 2192 goto error;
2193 } 2193 }
2194 P9_DPRINTK(P9_DEBUG_9P, "<<< RGETLOCK type %i start %lld length %lld " 2194 p9_debug(P9_DEBUG_9P, "<<< RGETLOCK type %i start %lld length %lld "
2195 "proc_id %d client_id %s\n", glock->type, glock->start, 2195 "proc_id %d client_id %s\n", glock->type, glock->start,
2196 glock->length, glock->proc_id, glock->client_id); 2196 glock->length, glock->proc_id, glock->client_id);
2197error: 2197error:
@@ -2208,7 +2208,7 @@ int p9_client_readlink(struct p9_fid *fid, char **target)
2208 2208
2209 err = 0; 2209 err = 0;
2210 clnt = fid->clnt; 2210 clnt = fid->clnt;
2211 P9_DPRINTK(P9_DEBUG_9P, ">>> TREADLINK fid %d\n", fid->fid); 2211 p9_debug(P9_DEBUG_9P, ">>> TREADLINK fid %d\n", fid->fid);
2212 2212
2213 req = p9_client_rpc(clnt, P9_TREADLINK, "d", fid->fid); 2213 req = p9_client_rpc(clnt, P9_TREADLINK, "d", fid->fid);
2214 if (IS_ERR(req)) 2214 if (IS_ERR(req))
@@ -2219,7 +2219,7 @@ int p9_client_readlink(struct p9_fid *fid, char **target)
2219 trace_9p_protocol_dump(clnt, req->rc); 2219 trace_9p_protocol_dump(clnt, req->rc);
2220 goto error; 2220 goto error;
2221 } 2221 }
2222 P9_DPRINTK(P9_DEBUG_9P, "<<< RREADLINK target %s\n", *target); 2222 p9_debug(P9_DEBUG_9P, "<<< RREADLINK target %s\n", *target);
2223error: 2223error:
2224 p9_free_req(clnt, req); 2224 p9_free_req(clnt, req);
2225 return err; 2225 return err;
diff --git a/net/9p/error.c b/net/9p/error.c
index 52518512a93e..2ab2de76010f 100644
--- a/net/9p/error.c
+++ b/net/9p/error.c
@@ -27,6 +27,8 @@
27 * 27 *
28 */ 28 */
29 29
30#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
31
30#include <linux/module.h> 32#include <linux/module.h>
31#include <linux/list.h> 33#include <linux/list.h>
32#include <linux/jhash.h> 34#include <linux/jhash.h>
@@ -237,8 +239,8 @@ int p9_errstr2errno(char *errstr, int len)
237 if (errno == 0) { 239 if (errno == 0) {
238 /* TODO: if error isn't found, add it dynamically */ 240 /* TODO: if error isn't found, add it dynamically */
239 errstr[len] = 0; 241 errstr[len] = 0;
240 printk(KERN_ERR "%s: server reported unknown error %s\n", 242 pr_err("%s: server reported unknown error %s\n",
241 __func__, errstr); 243 __func__, errstr);
242 errno = ESERVERFAULT; 244 errno = ESERVERFAULT;
243 } 245 }
244 246
diff --git a/net/9p/mod.c b/net/9p/mod.c
index 2664d1292291..6ab36aea7727 100644
--- a/net/9p/mod.c
+++ b/net/9p/mod.c
@@ -24,7 +24,11 @@
24 * 24 *
25 */ 25 */
26 26
27#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
28
27#include <linux/module.h> 29#include <linux/module.h>
30#include <linux/errno.h>
31#include <linux/sched.h>
28#include <linux/moduleparam.h> 32#include <linux/moduleparam.h>
29#include <net/9p/9p.h> 33#include <net/9p/9p.h>
30#include <linux/fs.h> 34#include <linux/fs.h>
@@ -39,6 +43,29 @@ unsigned int p9_debug_level = 0; /* feature-rific global debug level */
39EXPORT_SYMBOL(p9_debug_level); 43EXPORT_SYMBOL(p9_debug_level);
40module_param_named(debug, p9_debug_level, uint, 0); 44module_param_named(debug, p9_debug_level, uint, 0);
41MODULE_PARM_DESC(debug, "9P debugging level"); 45MODULE_PARM_DESC(debug, "9P debugging level");
46
47void _p9_debug(enum p9_debug_flags level, const char *func,
48 const char *fmt, ...)
49{
50 struct va_format vaf;
51 va_list args;
52
53 if ((p9_debug_level & level) != level)
54 return;
55
56 va_start(args, fmt);
57
58 vaf.fmt = fmt;
59 vaf.va = &args;
60
61 if (level == P9_DEBUG_9P)
62 pr_notice("(%8.8d) %pV", task_pid_nr(current), &vaf);
63 else
64 pr_notice("-- %s (%d): %pV", func, task_pid_nr(current), &vaf);
65
66 va_end(args);
67}
68EXPORT_SYMBOL(_p9_debug);
42#endif 69#endif
43 70
44/* 71/*
@@ -147,7 +174,7 @@ static int __init init_p9(void)
147 int ret = 0; 174 int ret = 0;
148 175
149 p9_error_init(); 176 p9_error_init();
150 printk(KERN_INFO "Installing 9P2000 support\n"); 177 pr_info("Installing 9P2000 support\n");
151 p9_trans_fd_init(); 178 p9_trans_fd_init();
152 179
153 return ret; 180 return ret;
@@ -160,7 +187,7 @@ static int __init init_p9(void)
160 187
161static void __exit exit_p9(void) 188static void __exit exit_p9(void)
162{ 189{
163 printk(KERN_INFO "Unloading 9P2000 support\n"); 190 pr_info("Unloading 9P2000 support\n");
164 191
165 p9_trans_fd_exit(); 192 p9_trans_fd_exit();
166} 193}
diff --git a/net/9p/protocol.c b/net/9p/protocol.c
index 55e10a96c902..9ee48cb30179 100644
--- a/net/9p/protocol.c
+++ b/net/9p/protocol.c
@@ -534,7 +534,7 @@ int p9stat_read(struct p9_client *clnt, char *buf, int len, struct p9_wstat *st)
534 534
535 ret = p9pdu_readf(&fake_pdu, clnt->proto_version, "S", st); 535 ret = p9pdu_readf(&fake_pdu, clnt->proto_version, "S", st);
536 if (ret) { 536 if (ret) {
537 P9_DPRINTK(P9_DEBUG_9P, "<<< p9stat_read failed: %d\n", ret); 537 p9_debug(P9_DEBUG_9P, "<<< p9stat_read failed: %d\n", ret);
538 trace_9p_protocol_dump(clnt, &fake_pdu); 538 trace_9p_protocol_dump(clnt, &fake_pdu);
539 } 539 }
540 540
@@ -558,8 +558,8 @@ int p9pdu_finalize(struct p9_client *clnt, struct p9_fcall *pdu)
558 pdu->size = size; 558 pdu->size = size;
559 559
560 trace_9p_protocol_dump(clnt, pdu); 560 trace_9p_protocol_dump(clnt, pdu);
561 P9_DPRINTK(P9_DEBUG_9P, ">>> size=%d type: %d tag: %d\n", pdu->size, 561 p9_debug(P9_DEBUG_9P, ">>> size=%d type: %d tag: %d\n",
562 pdu->id, pdu->tag); 562 pdu->size, pdu->id, pdu->tag);
563 563
564 return err; 564 return err;
565} 565}
@@ -585,7 +585,7 @@ int p9dirent_read(struct p9_client *clnt, char *buf, int len,
585 ret = p9pdu_readf(&fake_pdu, clnt->proto_version, "Qqbs", &dirent->qid, 585 ret = p9pdu_readf(&fake_pdu, clnt->proto_version, "Qqbs", &dirent->qid,
586 &dirent->d_off, &dirent->d_type, &nameptr); 586 &dirent->d_off, &dirent->d_type, &nameptr);
587 if (ret) { 587 if (ret) {
588 P9_DPRINTK(P9_DEBUG_9P, "<<< p9dirent_read failed: %d\n", ret); 588 p9_debug(P9_DEBUG_9P, "<<< p9dirent_read failed: %d\n", ret);
589 trace_9p_protocol_dump(clnt, &fake_pdu); 589 trace_9p_protocol_dump(clnt, &fake_pdu);
590 goto out; 590 goto out;
591 } 591 }
diff --git a/net/9p/trans_fd.c b/net/9p/trans_fd.c
index fdfdb5747f63..fccae26fa674 100644
--- a/net/9p/trans_fd.c
+++ b/net/9p/trans_fd.c
@@ -25,6 +25,8 @@
25 * 25 *
26 */ 26 */
27 27
28#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
29
28#include <linux/in.h> 30#include <linux/in.h>
29#include <linux/module.h> 31#include <linux/module.h>
30#include <linux/net.h> 32#include <linux/net.h>
@@ -191,7 +193,7 @@ static void p9_conn_cancel(struct p9_conn *m, int err)
191 unsigned long flags; 193 unsigned long flags;
192 LIST_HEAD(cancel_list); 194 LIST_HEAD(cancel_list);
193 195
194 P9_DPRINTK(P9_DEBUG_ERROR, "mux %p err %d\n", m, err); 196 p9_debug(P9_DEBUG_ERROR, "mux %p err %d\n", m, err);
195 197
196 spin_lock_irqsave(&m->client->lock, flags); 198 spin_lock_irqsave(&m->client->lock, flags);
197 199
@@ -217,7 +219,7 @@ static void p9_conn_cancel(struct p9_conn *m, int err)
217 spin_unlock_irqrestore(&m->client->lock, flags); 219 spin_unlock_irqrestore(&m->client->lock, flags);
218 220
219 list_for_each_entry_safe(req, rtmp, &cancel_list, req_list) { 221 list_for_each_entry_safe(req, rtmp, &cancel_list, req_list) {
220 P9_DPRINTK(P9_DEBUG_ERROR, "call back req %p\n", req); 222 p9_debug(P9_DEBUG_ERROR, "call back req %p\n", req);
221 list_del(&req->req_list); 223 list_del(&req->req_list);
222 p9_client_cb(m->client, req); 224 p9_client_cb(m->client, req);
223 } 225 }
@@ -275,7 +277,7 @@ static int p9_fd_read(struct p9_client *client, void *v, int len)
275 return -EREMOTEIO; 277 return -EREMOTEIO;
276 278
277 if (!(ts->rd->f_flags & O_NONBLOCK)) 279 if (!(ts->rd->f_flags & O_NONBLOCK))
278 P9_DPRINTK(P9_DEBUG_ERROR, "blocking read ...\n"); 280 p9_debug(P9_DEBUG_ERROR, "blocking read ...\n");
279 281
280 ret = kernel_read(ts->rd, ts->rd->f_pos, v, len); 282 ret = kernel_read(ts->rd, ts->rd->f_pos, v, len);
281 if (ret <= 0 && ret != -ERESTARTSYS && ret != -EAGAIN) 283 if (ret <= 0 && ret != -ERESTARTSYS && ret != -EAGAIN)
@@ -299,7 +301,7 @@ static void p9_read_work(struct work_struct *work)
299 if (m->err < 0) 301 if (m->err < 0)
300 return; 302 return;
301 303
302 P9_DPRINTK(P9_DEBUG_TRANS, "start mux %p pos %d\n", m, m->rpos); 304 p9_debug(P9_DEBUG_TRANS, "start mux %p pos %d\n", m, m->rpos);
303 305
304 if (!m->rbuf) { 306 if (!m->rbuf) {
305 m->rbuf = m->tmp_buf; 307 m->rbuf = m->tmp_buf;
@@ -308,11 +310,11 @@ static void p9_read_work(struct work_struct *work)
308 } 310 }
309 311
310 clear_bit(Rpending, &m->wsched); 312 clear_bit(Rpending, &m->wsched);
311 P9_DPRINTK(P9_DEBUG_TRANS, "read mux %p pos %d size: %d = %d\n", m, 313 p9_debug(P9_DEBUG_TRANS, "read mux %p pos %d size: %d = %d\n",
312 m->rpos, m->rsize, m->rsize-m->rpos); 314 m, m->rpos, m->rsize, m->rsize-m->rpos);
313 err = p9_fd_read(m->client, m->rbuf + m->rpos, 315 err = p9_fd_read(m->client, m->rbuf + m->rpos,
314 m->rsize - m->rpos); 316 m->rsize - m->rpos);
315 P9_DPRINTK(P9_DEBUG_TRANS, "mux %p got %d bytes\n", m, err); 317 p9_debug(P9_DEBUG_TRANS, "mux %p got %d bytes\n", m, err);
316 if (err == -EAGAIN) { 318 if (err == -EAGAIN) {
317 clear_bit(Rworksched, &m->wsched); 319 clear_bit(Rworksched, &m->wsched);
318 return; 320 return;
@@ -325,25 +327,25 @@ static void p9_read_work(struct work_struct *work)
325 327
326 if ((!m->req) && (m->rpos == m->rsize)) { /* header read in */ 328 if ((!m->req) && (m->rpos == m->rsize)) { /* header read in */
327 u16 tag; 329 u16 tag;
328 P9_DPRINTK(P9_DEBUG_TRANS, "got new header\n"); 330 p9_debug(P9_DEBUG_TRANS, "got new header\n");
329 331
330 n = le32_to_cpu(*(__le32 *) m->rbuf); /* read packet size */ 332 n = le32_to_cpu(*(__le32 *) m->rbuf); /* read packet size */
331 if (n >= m->client->msize) { 333 if (n >= m->client->msize) {
332 P9_DPRINTK(P9_DEBUG_ERROR, 334 p9_debug(P9_DEBUG_ERROR,
333 "requested packet size too big: %d\n", n); 335 "requested packet size too big: %d\n", n);
334 err = -EIO; 336 err = -EIO;
335 goto error; 337 goto error;
336 } 338 }
337 339
338 tag = le16_to_cpu(*(__le16 *) (m->rbuf+5)); /* read tag */ 340 tag = le16_to_cpu(*(__le16 *) (m->rbuf+5)); /* read tag */
339 P9_DPRINTK(P9_DEBUG_TRANS, 341 p9_debug(P9_DEBUG_TRANS,
340 "mux %p pkt: size: %d bytes tag: %d\n", m, n, tag); 342 "mux %p pkt: size: %d bytes tag: %d\n", m, n, tag);
341 343
342 m->req = p9_tag_lookup(m->client, tag); 344 m->req = p9_tag_lookup(m->client, tag);
343 if (!m->req || (m->req->status != REQ_STATUS_SENT && 345 if (!m->req || (m->req->status != REQ_STATUS_SENT &&
344 m->req->status != REQ_STATUS_FLSH)) { 346 m->req->status != REQ_STATUS_FLSH)) {
345 P9_DPRINTK(P9_DEBUG_ERROR, "Unexpected packet tag %d\n", 347 p9_debug(P9_DEBUG_ERROR, "Unexpected packet tag %d\n",
346 tag); 348 tag);
347 err = -EIO; 349 err = -EIO;
348 goto error; 350 goto error;
349 } 351 }
@@ -364,7 +366,7 @@ static void p9_read_work(struct work_struct *work)
364 366
365 /* not an else because some packets (like clunk) have no payload */ 367 /* not an else because some packets (like clunk) have no payload */
366 if ((m->req) && (m->rpos == m->rsize)) { /* packet is read in */ 368 if ((m->req) && (m->rpos == m->rsize)) { /* packet is read in */
367 P9_DPRINTK(P9_DEBUG_TRANS, "got new packet\n"); 369 p9_debug(P9_DEBUG_TRANS, "got new packet\n");
368 spin_lock(&m->client->lock); 370 spin_lock(&m->client->lock);
369 if (m->req->status != REQ_STATUS_ERROR) 371 if (m->req->status != REQ_STATUS_ERROR)
370 m->req->status = REQ_STATUS_RCVD; 372 m->req->status = REQ_STATUS_RCVD;
@@ -384,7 +386,7 @@ static void p9_read_work(struct work_struct *work)
384 n = p9_fd_poll(m->client, NULL); 386 n = p9_fd_poll(m->client, NULL);
385 387
386 if (n & POLLIN) { 388 if (n & POLLIN) {
387 P9_DPRINTK(P9_DEBUG_TRANS, "sched read work %p\n", m); 389 p9_debug(P9_DEBUG_TRANS, "sched read work %p\n", m);
388 schedule_work(&m->rq); 390 schedule_work(&m->rq);
389 } else 391 } else
390 clear_bit(Rworksched, &m->wsched); 392 clear_bit(Rworksched, &m->wsched);
@@ -418,7 +420,7 @@ static int p9_fd_write(struct p9_client *client, void *v, int len)
418 return -EREMOTEIO; 420 return -EREMOTEIO;
419 421
420 if (!(ts->wr->f_flags & O_NONBLOCK)) 422 if (!(ts->wr->f_flags & O_NONBLOCK))
421 P9_DPRINTK(P9_DEBUG_ERROR, "blocking write ...\n"); 423 p9_debug(P9_DEBUG_ERROR, "blocking write ...\n");
422 424
423 oldfs = get_fs(); 425 oldfs = get_fs();
424 set_fs(get_ds()); 426 set_fs(get_ds());
@@ -460,7 +462,7 @@ static void p9_write_work(struct work_struct *work)
460 req = list_entry(m->unsent_req_list.next, struct p9_req_t, 462 req = list_entry(m->unsent_req_list.next, struct p9_req_t,
461 req_list); 463 req_list);
462 req->status = REQ_STATUS_SENT; 464 req->status = REQ_STATUS_SENT;
463 P9_DPRINTK(P9_DEBUG_TRANS, "move req %p\n", req); 465 p9_debug(P9_DEBUG_TRANS, "move req %p\n", req);
464 list_move_tail(&req->req_list, &m->req_list); 466 list_move_tail(&req->req_list, &m->req_list);
465 467
466 m->wbuf = req->tc->sdata; 468 m->wbuf = req->tc->sdata;
@@ -469,11 +471,11 @@ static void p9_write_work(struct work_struct *work)
469 spin_unlock(&m->client->lock); 471 spin_unlock(&m->client->lock);
470 } 472 }
471 473
472 P9_DPRINTK(P9_DEBUG_TRANS, "mux %p pos %d size %d\n", m, m->wpos, 474 p9_debug(P9_DEBUG_TRANS, "mux %p pos %d size %d\n",
473 m->wsize); 475 m, m->wpos, m->wsize);
474 clear_bit(Wpending, &m->wsched); 476 clear_bit(Wpending, &m->wsched);
475 err = p9_fd_write(m->client, m->wbuf + m->wpos, m->wsize - m->wpos); 477 err = p9_fd_write(m->client, m->wbuf + m->wpos, m->wsize - m->wpos);
476 P9_DPRINTK(P9_DEBUG_TRANS, "mux %p sent %d bytes\n", m, err); 478 p9_debug(P9_DEBUG_TRANS, "mux %p sent %d bytes\n", m, err);
477 if (err == -EAGAIN) { 479 if (err == -EAGAIN) {
478 clear_bit(Wworksched, &m->wsched); 480 clear_bit(Wworksched, &m->wsched);
479 return; 481 return;
@@ -497,7 +499,7 @@ static void p9_write_work(struct work_struct *work)
497 n = p9_fd_poll(m->client, NULL); 499 n = p9_fd_poll(m->client, NULL);
498 500
499 if (n & POLLOUT) { 501 if (n & POLLOUT) {
500 P9_DPRINTK(P9_DEBUG_TRANS, "sched write work %p\n", m); 502 p9_debug(P9_DEBUG_TRANS, "sched write work %p\n", m);
501 schedule_work(&m->wq); 503 schedule_work(&m->wq);
502 } else 504 } else
503 clear_bit(Wworksched, &m->wsched); 505 clear_bit(Wworksched, &m->wsched);
@@ -551,7 +553,7 @@ p9_pollwait(struct file *filp, wait_queue_head_t *wait_address, poll_table *p)
551 } 553 }
552 554
553 if (!pwait) { 555 if (!pwait) {
554 P9_DPRINTK(P9_DEBUG_ERROR, "not enough wait_address slots\n"); 556 p9_debug(P9_DEBUG_ERROR, "not enough wait_address slots\n");
555 return; 557 return;
556 } 558 }
557 559
@@ -573,8 +575,7 @@ static struct p9_conn *p9_conn_create(struct p9_client *client)
573 int n; 575 int n;
574 struct p9_conn *m; 576 struct p9_conn *m;
575 577
576 P9_DPRINTK(P9_DEBUG_TRANS, "client %p msize %d\n", client, 578 p9_debug(P9_DEBUG_TRANS, "client %p msize %d\n", client, client->msize);
577 client->msize);
578 m = kzalloc(sizeof(struct p9_conn), GFP_KERNEL); 579 m = kzalloc(sizeof(struct p9_conn), GFP_KERNEL);
579 if (!m) 580 if (!m)
580 return ERR_PTR(-ENOMEM); 581 return ERR_PTR(-ENOMEM);
@@ -591,12 +592,12 @@ static struct p9_conn *p9_conn_create(struct p9_client *client)
591 592
592 n = p9_fd_poll(client, &m->pt); 593 n = p9_fd_poll(client, &m->pt);
593 if (n & POLLIN) { 594 if (n & POLLIN) {
594 P9_DPRINTK(P9_DEBUG_TRANS, "mux %p can read\n", m); 595 p9_debug(P9_DEBUG_TRANS, "mux %p can read\n", m);
595 set_bit(Rpending, &m->wsched); 596 set_bit(Rpending, &m->wsched);
596 } 597 }
597 598
598 if (n & POLLOUT) { 599 if (n & POLLOUT) {
599 P9_DPRINTK(P9_DEBUG_TRANS, "mux %p can write\n", m); 600 p9_debug(P9_DEBUG_TRANS, "mux %p can write\n", m);
600 set_bit(Wpending, &m->wsched); 601 set_bit(Wpending, &m->wsched);
601 } 602 }
602 603
@@ -618,7 +619,7 @@ static void p9_poll_mux(struct p9_conn *m)
618 619
619 n = p9_fd_poll(m->client, NULL); 620 n = p9_fd_poll(m->client, NULL);
620 if (n < 0 || n & (POLLERR | POLLHUP | POLLNVAL)) { 621 if (n < 0 || n & (POLLERR | POLLHUP | POLLNVAL)) {
621 P9_DPRINTK(P9_DEBUG_TRANS, "error mux %p err %d\n", m, n); 622 p9_debug(P9_DEBUG_TRANS, "error mux %p err %d\n", m, n);
622 if (n >= 0) 623 if (n >= 0)
623 n = -ECONNRESET; 624 n = -ECONNRESET;
624 p9_conn_cancel(m, n); 625 p9_conn_cancel(m, n);
@@ -626,19 +627,19 @@ static void p9_poll_mux(struct p9_conn *m)
626 627
627 if (n & POLLIN) { 628 if (n & POLLIN) {
628 set_bit(Rpending, &m->wsched); 629 set_bit(Rpending, &m->wsched);
629 P9_DPRINTK(P9_DEBUG_TRANS, "mux %p can read\n", m); 630 p9_debug(P9_DEBUG_TRANS, "mux %p can read\n", m);
630 if (!test_and_set_bit(Rworksched, &m->wsched)) { 631 if (!test_and_set_bit(Rworksched, &m->wsched)) {
631 P9_DPRINTK(P9_DEBUG_TRANS, "sched read work %p\n", m); 632 p9_debug(P9_DEBUG_TRANS, "sched read work %p\n", m);
632 schedule_work(&m->rq); 633 schedule_work(&m->rq);
633 } 634 }
634 } 635 }
635 636
636 if (n & POLLOUT) { 637 if (n & POLLOUT) {
637 set_bit(Wpending, &m->wsched); 638 set_bit(Wpending, &m->wsched);
638 P9_DPRINTK(P9_DEBUG_TRANS, "mux %p can write\n", m); 639 p9_debug(P9_DEBUG_TRANS, "mux %p can write\n", m);
639 if ((m->wsize || !list_empty(&m->unsent_req_list)) && 640 if ((m->wsize || !list_empty(&m->unsent_req_list)) &&
640 !test_and_set_bit(Wworksched, &m->wsched)) { 641 !test_and_set_bit(Wworksched, &m->wsched)) {
641 P9_DPRINTK(P9_DEBUG_TRANS, "sched write work %p\n", m); 642 p9_debug(P9_DEBUG_TRANS, "sched write work %p\n", m);
642 schedule_work(&m->wq); 643 schedule_work(&m->wq);
643 } 644 }
644 } 645 }
@@ -661,8 +662,8 @@ static int p9_fd_request(struct p9_client *client, struct p9_req_t *req)
661 struct p9_trans_fd *ts = client->trans; 662 struct p9_trans_fd *ts = client->trans;
662 struct p9_conn *m = ts->conn; 663 struct p9_conn *m = ts->conn;
663 664
664 P9_DPRINTK(P9_DEBUG_TRANS, "mux %p task %p tcall %p id %d\n", m, 665 p9_debug(P9_DEBUG_TRANS, "mux %p task %p tcall %p id %d\n",
665 current, req->tc, req->tc->id); 666 m, current, req->tc, req->tc->id);
666 if (m->err < 0) 667 if (m->err < 0)
667 return m->err; 668 return m->err;
668 669
@@ -686,7 +687,7 @@ static int p9_fd_cancel(struct p9_client *client, struct p9_req_t *req)
686{ 687{
687 int ret = 1; 688 int ret = 1;
688 689
689 P9_DPRINTK(P9_DEBUG_TRANS, "client %p req %p\n", client, req); 690 p9_debug(P9_DEBUG_TRANS, "client %p req %p\n", client, req);
690 691
691 spin_lock(&client->lock); 692 spin_lock(&client->lock);
692 693
@@ -726,8 +727,8 @@ static int parse_opts(char *params, struct p9_fd_opts *opts)
726 727
727 tmp_options = kstrdup(params, GFP_KERNEL); 728 tmp_options = kstrdup(params, GFP_KERNEL);
728 if (!tmp_options) { 729 if (!tmp_options) {
729 P9_DPRINTK(P9_DEBUG_ERROR, 730 p9_debug(P9_DEBUG_ERROR,
730 "failed to allocate copy of option string\n"); 731 "failed to allocate copy of option string\n");
731 return -ENOMEM; 732 return -ENOMEM;
732 } 733 }
733 options = tmp_options; 734 options = tmp_options;
@@ -741,8 +742,8 @@ static int parse_opts(char *params, struct p9_fd_opts *opts)
741 if (token != Opt_err) { 742 if (token != Opt_err) {
742 r = match_int(&args[0], &option); 743 r = match_int(&args[0], &option);
743 if (r < 0) { 744 if (r < 0) {
744 P9_DPRINTK(P9_DEBUG_ERROR, 745 p9_debug(P9_DEBUG_ERROR,
745 "integer field, but no integer?\n"); 746 "integer field, but no integer?\n");
746 continue; 747 continue;
747 } 748 }
748 } 749 }
@@ -801,7 +802,8 @@ static int p9_socket_open(struct p9_client *client, struct socket *csocket)
801 csocket->sk->sk_allocation = GFP_NOIO; 802 csocket->sk->sk_allocation = GFP_NOIO;
802 fd = sock_map_fd(csocket, 0); 803 fd = sock_map_fd(csocket, 0);
803 if (fd < 0) { 804 if (fd < 0) {
804 P9_EPRINTK(KERN_ERR, "p9_socket_open: failed to map fd\n"); 805 pr_err("%s (%d): failed to map fd\n",
806 __func__, task_pid_nr(current));
805 sock_release(csocket); 807 sock_release(csocket);
806 kfree(p); 808 kfree(p);
807 return fd; 809 return fd;
@@ -837,8 +839,8 @@ static int p9_socket_open(struct p9_client *client, struct socket *csocket)
837 839
838static void p9_conn_destroy(struct p9_conn *m) 840static void p9_conn_destroy(struct p9_conn *m)
839{ 841{
840 P9_DPRINTK(P9_DEBUG_TRANS, "mux %p prev %p next %p\n", m, 842 p9_debug(P9_DEBUG_TRANS, "mux %p prev %p next %p\n",
841 m->mux_list.prev, m->mux_list.next); 843 m, m->mux_list.prev, m->mux_list.next);
842 844
843 p9_mux_poll_stop(m); 845 p9_mux_poll_stop(m);
844 cancel_work_sync(&m->rq); 846 cancel_work_sync(&m->rq);
@@ -919,7 +921,8 @@ p9_fd_create_tcp(struct p9_client *client, const char *addr, char *args)
919 err = __sock_create(read_pnet(&current->nsproxy->net_ns), PF_INET, 921 err = __sock_create(read_pnet(&current->nsproxy->net_ns), PF_INET,
920 SOCK_STREAM, IPPROTO_TCP, &csocket, 1); 922 SOCK_STREAM, IPPROTO_TCP, &csocket, 1);
921 if (err) { 923 if (err) {
922 P9_EPRINTK(KERN_ERR, "p9_trans_tcp: problem creating socket\n"); 924 pr_err("%s (%d): problem creating socket\n",
925 __func__, task_pid_nr(current));
923 return err; 926 return err;
924 } 927 }
925 928
@@ -927,9 +930,8 @@ p9_fd_create_tcp(struct p9_client *client, const char *addr, char *args)
927 (struct sockaddr *)&sin_server, 930 (struct sockaddr *)&sin_server,
928 sizeof(struct sockaddr_in), 0); 931 sizeof(struct sockaddr_in), 0);
929 if (err < 0) { 932 if (err < 0) {
930 P9_EPRINTK(KERN_ERR, 933 pr_err("%s (%d): problem connecting socket to %s\n",
931 "p9_trans_tcp: problem connecting socket to %s\n", 934 __func__, task_pid_nr(current), addr);
932 addr);
933 sock_release(csocket); 935 sock_release(csocket);
934 return err; 936 return err;
935 } 937 }
@@ -947,8 +949,8 @@ p9_fd_create_unix(struct p9_client *client, const char *addr, char *args)
947 csocket = NULL; 949 csocket = NULL;
948 950
949 if (strlen(addr) >= UNIX_PATH_MAX) { 951 if (strlen(addr) >= UNIX_PATH_MAX) {
950 P9_EPRINTK(KERN_ERR, "p9_trans_unix: address too long: %s\n", 952 pr_err("%s (%d): address too long: %s\n",
951 addr); 953 __func__, task_pid_nr(current), addr);
952 return -ENAMETOOLONG; 954 return -ENAMETOOLONG;
953 } 955 }
954 956
@@ -957,15 +959,16 @@ p9_fd_create_unix(struct p9_client *client, const char *addr, char *args)
957 err = __sock_create(read_pnet(&current->nsproxy->net_ns), PF_UNIX, 959 err = __sock_create(read_pnet(&current->nsproxy->net_ns), PF_UNIX,
958 SOCK_STREAM, 0, &csocket, 1); 960 SOCK_STREAM, 0, &csocket, 1);
959 if (err < 0) { 961 if (err < 0) {
960 P9_EPRINTK(KERN_ERR, "p9_trans_unix: problem creating socket\n"); 962 pr_err("%s (%d): problem creating socket\n",
963 __func__, task_pid_nr(current));
964
961 return err; 965 return err;
962 } 966 }
963 err = csocket->ops->connect(csocket, (struct sockaddr *)&sun_server, 967 err = csocket->ops->connect(csocket, (struct sockaddr *)&sun_server,
964 sizeof(struct sockaddr_un) - 1, 0); 968 sizeof(struct sockaddr_un) - 1, 0);
965 if (err < 0) { 969 if (err < 0) {
966 P9_EPRINTK(KERN_ERR, 970 pr_err("%s (%d): problem connecting socket: %s: %d\n",
967 "p9_trans_unix: problem connecting socket: %s: %d\n", 971 __func__, task_pid_nr(current), addr, err);
968 addr, err);
969 sock_release(csocket); 972 sock_release(csocket);
970 return err; 973 return err;
971 } 974 }
@@ -983,7 +986,7 @@ p9_fd_create(struct p9_client *client, const char *addr, char *args)
983 parse_opts(args, &opts); 986 parse_opts(args, &opts);
984 987
985 if (opts.rfd == ~0 || opts.wfd == ~0) { 988 if (opts.rfd == ~0 || opts.wfd == ~0) {
986 printk(KERN_ERR "v9fs: Insufficient options for proto=fd\n"); 989 pr_err("Insufficient options for proto=fd\n");
987 return -ENOPROTOOPT; 990 return -ENOPROTOOPT;
988 } 991 }
989 992
@@ -1050,7 +1053,7 @@ static void p9_poll_workfn(struct work_struct *work)
1050{ 1053{
1051 unsigned long flags; 1054 unsigned long flags;
1052 1055
1053 P9_DPRINTK(P9_DEBUG_TRANS, "start %p\n", current); 1056 p9_debug(P9_DEBUG_TRANS, "start %p\n", current);
1054 1057
1055 spin_lock_irqsave(&p9_poll_lock, flags); 1058 spin_lock_irqsave(&p9_poll_lock, flags);
1056 while (!list_empty(&p9_poll_pending_list)) { 1059 while (!list_empty(&p9_poll_pending_list)) {
@@ -1066,7 +1069,7 @@ static void p9_poll_workfn(struct work_struct *work)
1066 } 1069 }
1067 spin_unlock_irqrestore(&p9_poll_lock, flags); 1070 spin_unlock_irqrestore(&p9_poll_lock, flags);
1068 1071
1069 P9_DPRINTK(P9_DEBUG_TRANS, "finish\n"); 1072 p9_debug(P9_DEBUG_TRANS, "finish\n");
1070} 1073}
1071 1074
1072int p9_trans_fd_init(void) 1075int p9_trans_fd_init(void)
diff --git a/net/9p/trans_rdma.c b/net/9p/trans_rdma.c
index 159c50f1c6bf..2c69ddd691a1 100644
--- a/net/9p/trans_rdma.c
+++ b/net/9p/trans_rdma.c
@@ -26,6 +26,8 @@
26 * 26 *
27 */ 27 */
28 28
29#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
30
29#include <linux/in.h> 31#include <linux/in.h>
30#include <linux/module.h> 32#include <linux/module.h>
31#include <linux/net.h> 33#include <linux/net.h>
@@ -178,8 +180,8 @@ static int parse_opts(char *params, struct p9_rdma_opts *opts)
178 180
179 tmp_options = kstrdup(params, GFP_KERNEL); 181 tmp_options = kstrdup(params, GFP_KERNEL);
180 if (!tmp_options) { 182 if (!tmp_options) {
181 P9_DPRINTK(P9_DEBUG_ERROR, 183 p9_debug(P9_DEBUG_ERROR,
182 "failed to allocate copy of option string\n"); 184 "failed to allocate copy of option string\n");
183 return -ENOMEM; 185 return -ENOMEM;
184 } 186 }
185 options = tmp_options; 187 options = tmp_options;
@@ -192,8 +194,8 @@ static int parse_opts(char *params, struct p9_rdma_opts *opts)
192 token = match_token(p, tokens, args); 194 token = match_token(p, tokens, args);
193 r = match_int(&args[0], &option); 195 r = match_int(&args[0], &option);
194 if (r < 0) { 196 if (r < 0) {
195 P9_DPRINTK(P9_DEBUG_ERROR, 197 p9_debug(P9_DEBUG_ERROR,
196 "integer field, but no integer?\n"); 198 "integer field, but no integer?\n");
197 continue; 199 continue;
198 } 200 }
199 switch (token) { 201 switch (token) {
@@ -301,8 +303,7 @@ handle_recv(struct p9_client *client, struct p9_trans_rdma *rdma,
301 return; 303 return;
302 304
303 err_out: 305 err_out:
304 P9_DPRINTK(P9_DEBUG_ERROR, "req %p err %d status %d\n", 306 p9_debug(P9_DEBUG_ERROR, "req %p err %d status %d\n", req, err, status);
305 req, err, status);
306 rdma->state = P9_RDMA_FLUSHING; 307 rdma->state = P9_RDMA_FLUSHING;
307 client->status = Disconnected; 308 client->status = Disconnected;
308} 309}
@@ -318,8 +319,8 @@ handle_send(struct p9_client *client, struct p9_trans_rdma *rdma,
318 319
319static void qp_event_handler(struct ib_event *event, void *context) 320static void qp_event_handler(struct ib_event *event, void *context)
320{ 321{
321 P9_DPRINTK(P9_DEBUG_ERROR, "QP event %d context %p\n", event->event, 322 p9_debug(P9_DEBUG_ERROR, "QP event %d context %p\n",
322 context); 323 event->event, context);
323} 324}
324 325
325static void cq_comp_handler(struct ib_cq *cq, void *cq_context) 326static void cq_comp_handler(struct ib_cq *cq, void *cq_context)
@@ -345,8 +346,7 @@ static void cq_comp_handler(struct ib_cq *cq, void *cq_context)
345 break; 346 break;
346 347
347 default: 348 default:
348 printk(KERN_ERR "9prdma: unexpected completion type, " 349 pr_err("unexpected completion type, c->wc_op=%d, wc.opcode=%d, status=%d\n",
349 "c->wc_op=%d, wc.opcode=%d, status=%d\n",
350 c->wc_op, wc.opcode, wc.status); 350 c->wc_op, wc.opcode, wc.status);
351 break; 351 break;
352 } 352 }
@@ -356,7 +356,7 @@ static void cq_comp_handler(struct ib_cq *cq, void *cq_context)
356 356
357static void cq_event_handler(struct ib_event *e, void *v) 357static void cq_event_handler(struct ib_event *e, void *v)
358{ 358{
359 P9_DPRINTK(P9_DEBUG_ERROR, "CQ event %d context %p\n", e->event, v); 359 p9_debug(P9_DEBUG_ERROR, "CQ event %d context %p\n", e->event, v);
360} 360}
361 361
362static void rdma_destroy_trans(struct p9_trans_rdma *rdma) 362static void rdma_destroy_trans(struct p9_trans_rdma *rdma)
@@ -407,7 +407,7 @@ post_recv(struct p9_client *client, struct p9_rdma_context *c)
407 return ib_post_recv(rdma->qp, &wr, &bad_wr); 407 return ib_post_recv(rdma->qp, &wr, &bad_wr);
408 408
409 error: 409 error:
410 P9_DPRINTK(P9_DEBUG_ERROR, "EIO\n"); 410 p9_debug(P9_DEBUG_ERROR, "EIO\n");
411 return -EIO; 411 return -EIO;
412} 412}
413 413
@@ -500,7 +500,7 @@ static int rdma_request(struct p9_client *client, struct p9_req_t *req)
500 kfree(c); 500 kfree(c);
501 kfree(rpl_context->rc); 501 kfree(rpl_context->rc);
502 kfree(rpl_context); 502 kfree(rpl_context);
503 P9_DPRINTK(P9_DEBUG_ERROR, "EIO\n"); 503 p9_debug(P9_DEBUG_ERROR, "EIO\n");
504 return -EIO; 504 return -EIO;
505 err_free1: 505 err_free1:
506 kfree(rpl_context->rc); 506 kfree(rpl_context->rc);
diff --git a/net/9p/trans_virtio.c b/net/9p/trans_virtio.c
index 32aa9834229c..330421e54713 100644
--- a/net/9p/trans_virtio.c
+++ b/net/9p/trans_virtio.c
@@ -26,6 +26,8 @@
26 * 26 *
27 */ 27 */
28 28
29#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
30
29#include <linux/in.h> 31#include <linux/in.h>
30#include <linux/module.h> 32#include <linux/module.h>
31#include <linux/net.h> 33#include <linux/net.h>
@@ -145,7 +147,7 @@ static void req_done(struct virtqueue *vq)
145 struct p9_req_t *req; 147 struct p9_req_t *req;
146 unsigned long flags; 148 unsigned long flags;
147 149
148 P9_DPRINTK(P9_DEBUG_TRANS, ": request done\n"); 150 p9_debug(P9_DEBUG_TRANS, ": request done\n");
149 151
150 while (1) { 152 while (1) {
151 spin_lock_irqsave(&chan->lock, flags); 153 spin_lock_irqsave(&chan->lock, flags);
@@ -158,8 +160,8 @@ static void req_done(struct virtqueue *vq)
158 spin_unlock_irqrestore(&chan->lock, flags); 160 spin_unlock_irqrestore(&chan->lock, flags);
159 /* Wakeup if anyone waiting for VirtIO ring space. */ 161 /* Wakeup if anyone waiting for VirtIO ring space. */
160 wake_up(chan->vc_wq); 162 wake_up(chan->vc_wq);
161 P9_DPRINTK(P9_DEBUG_TRANS, ": rc %p\n", rc); 163 p9_debug(P9_DEBUG_TRANS, ": rc %p\n", rc);
162 P9_DPRINTK(P9_DEBUG_TRANS, ": lookup tag %d\n", rc->tag); 164 p9_debug(P9_DEBUG_TRANS, ": lookup tag %d\n", rc->tag);
163 req = p9_tag_lookup(chan->client, rc->tag); 165 req = p9_tag_lookup(chan->client, rc->tag);
164 req->status = REQ_STATUS_RCVD; 166 req->status = REQ_STATUS_RCVD;
165 p9_client_cb(chan->client, req); 167 p9_client_cb(chan->client, req);
@@ -257,7 +259,7 @@ p9_virtio_request(struct p9_client *client, struct p9_req_t *req)
257 unsigned long flags; 259 unsigned long flags;
258 struct virtio_chan *chan = client->trans; 260 struct virtio_chan *chan = client->trans;
259 261
260 P9_DPRINTK(P9_DEBUG_TRANS, "9p debug: virtio request\n"); 262 p9_debug(P9_DEBUG_TRANS, "9p debug: virtio request\n");
261 263
262 req->status = REQ_STATUS_SENT; 264 req->status = REQ_STATUS_SENT;
263req_retry: 265req_retry:
@@ -280,20 +282,19 @@ req_retry:
280 if (err == -ERESTARTSYS) 282 if (err == -ERESTARTSYS)
281 return err; 283 return err;
282 284
283 P9_DPRINTK(P9_DEBUG_TRANS, "9p:Retry virtio request\n"); 285 p9_debug(P9_DEBUG_TRANS, "Retry virtio request\n");
284 goto req_retry; 286 goto req_retry;
285 } else { 287 } else {
286 spin_unlock_irqrestore(&chan->lock, flags); 288 spin_unlock_irqrestore(&chan->lock, flags);
287 P9_DPRINTK(P9_DEBUG_TRANS, 289 p9_debug(P9_DEBUG_TRANS,
288 "9p debug: " 290 "virtio rpc add_buf returned failure\n");
289 "virtio rpc add_buf returned failure");
290 return -EIO; 291 return -EIO;
291 } 292 }
292 } 293 }
293 virtqueue_kick(chan->vq); 294 virtqueue_kick(chan->vq);
294 spin_unlock_irqrestore(&chan->lock, flags); 295 spin_unlock_irqrestore(&chan->lock, flags);
295 296
296 P9_DPRINTK(P9_DEBUG_TRANS, "9p debug: virtio request kicked\n"); 297 p9_debug(P9_DEBUG_TRANS, "virtio request kicked\n");
297 return 0; 298 return 0;
298} 299}
299 300
@@ -354,7 +355,7 @@ p9_virtio_zc_request(struct p9_client *client, struct p9_req_t *req,
354 struct page **in_pages = NULL, **out_pages = NULL; 355 struct page **in_pages = NULL, **out_pages = NULL;
355 struct virtio_chan *chan = client->trans; 356 struct virtio_chan *chan = client->trans;
356 357
357 P9_DPRINTK(P9_DEBUG_TRANS, "9p debug: virtio request\n"); 358 p9_debug(P9_DEBUG_TRANS, "virtio request\n");
358 359
359 if (uodata) { 360 if (uodata) {
360 out_nr_pages = p9_nr_pages(uodata, outlen); 361 out_nr_pages = p9_nr_pages(uodata, outlen);
@@ -423,20 +424,19 @@ req_retry_pinned:
423 if (err == -ERESTARTSYS) 424 if (err == -ERESTARTSYS)
424 goto err_out; 425 goto err_out;
425 426
426 P9_DPRINTK(P9_DEBUG_TRANS, "9p:Retry virtio request\n"); 427 p9_debug(P9_DEBUG_TRANS, "Retry virtio request\n");
427 goto req_retry_pinned; 428 goto req_retry_pinned;
428 } else { 429 } else {
429 spin_unlock_irqrestore(&chan->lock, flags); 430 spin_unlock_irqrestore(&chan->lock, flags);
430 P9_DPRINTK(P9_DEBUG_TRANS, 431 p9_debug(P9_DEBUG_TRANS,
431 "9p debug: " 432 "virtio rpc add_buf returned failure\n");
432 "virtio rpc add_buf returned failure");
433 err = -EIO; 433 err = -EIO;
434 goto err_out; 434 goto err_out;
435 } 435 }
436 } 436 }
437 virtqueue_kick(chan->vq); 437 virtqueue_kick(chan->vq);
438 spin_unlock_irqrestore(&chan->lock, flags); 438 spin_unlock_irqrestore(&chan->lock, flags);
439 P9_DPRINTK(P9_DEBUG_TRANS, "9p debug: virtio request kicked\n"); 439 p9_debug(P9_DEBUG_TRANS, "virtio request kicked\n");
440 err = wait_event_interruptible(*req->wq, 440 err = wait_event_interruptible(*req->wq,
441 req->status >= REQ_STATUS_RCVD); 441 req->status >= REQ_STATUS_RCVD);
442 /* 442 /*
@@ -491,7 +491,7 @@ static int p9_virtio_probe(struct virtio_device *vdev)
491 491
492 chan = kmalloc(sizeof(struct virtio_chan), GFP_KERNEL); 492 chan = kmalloc(sizeof(struct virtio_chan), GFP_KERNEL);
493 if (!chan) { 493 if (!chan) {
494 printk(KERN_ERR "9p: Failed to allocate virtio 9P channel\n"); 494 pr_err("Failed to allocate virtio 9P channel\n");
495 err = -ENOMEM; 495 err = -ENOMEM;
496 goto fail; 496 goto fail;
497 } 497 }
@@ -592,7 +592,7 @@ p9_virtio_create(struct p9_client *client, const char *devname, char *args)
592 mutex_unlock(&virtio_9p_lock); 592 mutex_unlock(&virtio_9p_lock);
593 593
594 if (!found) { 594 if (!found) {
595 printk(KERN_ERR "9p: no channels available\n"); 595 pr_err("no channels available\n");
596 return ret; 596 return ret;
597 } 597 }
598 598
diff --git a/net/9p/util.c b/net/9p/util.c
index 9c1c9348ac35..6ceeeb384de7 100644
--- a/net/9p/util.c
+++ b/net/9p/util.c
@@ -106,7 +106,7 @@ retry:
106 else if (error) 106 else if (error)
107 return -1; 107 return -1;
108 108
109 P9_DPRINTK(P9_DEBUG_MUX, " id %d pool %p\n", i, p); 109 p9_debug(P9_DEBUG_MUX, " id %d pool %p\n", i, p);
110 return i; 110 return i;
111} 111}
112EXPORT_SYMBOL(p9_idpool_get); 112EXPORT_SYMBOL(p9_idpool_get);
@@ -124,7 +124,7 @@ void p9_idpool_put(int id, struct p9_idpool *p)
124{ 124{
125 unsigned long flags; 125 unsigned long flags;
126 126
127 P9_DPRINTK(P9_DEBUG_MUX, " id %d pool %p\n", id, p); 127 p9_debug(P9_DEBUG_MUX, " id %d pool %p\n", id, p);
128 128
129 spin_lock_irqsave(&p->lock, flags); 129 spin_lock_irqsave(&p->lock, flags);
130 idr_remove(&p->pool, id); 130 idr_remove(&p->pool, id);