aboutsummaryrefslogtreecommitdiffstats
path: root/net/9p
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 /net/9p
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>
Diffstat (limited to 'net/9p')
-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
8 files changed, 248 insertions, 216 deletions
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);