diff options
author | Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> | 2011-08-06 15:16:59 -0400 |
---|---|---|
committer | Eric Van Hensbergen <ericvh@gmail.com> | 2011-10-24 12:13:12 -0400 |
commit | 348b59012e5c6402741d067cf6eeeb6271999d06 (patch) | |
tree | 38041cac7af6f020fa2756eded6a2d9f31132ffc /net/9p/protocol.c | |
parent | ef6b0807e2c986d5f1cb878e1b32a7cf4c32b4c8 (diff) |
net/9p: Convert net/9p protocol dumps to tracepoints
This helps in more control over debugging.
root@qemu-img-64:~# ls /pass/123
ls: cannot access /pass/123: No such file or directory
root@qemu-img-64:~# cat /sys/kernel/debug/tracing/trace
# tracer: nop
#
# TASK-PID CPU# TIMESTAMP FUNCTION
# | | | | |
ls-1536 [001] 70.928584: 9p_protocol_dump: clnt 18446612132784021504 P9_TWALK(tag = 1)
000: 16 00 00 00 6e 01 00 01 00 00 00 02 00 00 00 01
010: 00 03 00 31 32 33 00 00 00 ff ff ff ff 00 00 00
ls-1536 [001] 70.928587: <stack trace>
=> trace_9p_protocol_dump
=> p9pdu_finalize
=> p9_client_rpc
=> p9_client_walk
=> v9fs_vfs_lookup
=> d_alloc_and_lookup
=> walk_component
=> path_lookupat
ls-1536 [000] 70.929696: 9p_protocol_dump: clnt 18446612132784021504 P9_RLERROR(tag = 1)
000: 0b 00 00 00 07 01 00 02 00 00 00 4e 03 00 02 00
010: 00 00 00 00 03 00 02 00 00 00 00 00 ff 43 00 00
ls-1536 [000] 70.929697: <stack trace>
=> trace_9p_protocol_dump
=> p9_client_rpc
=> p9_client_walk
=> v9fs_vfs_lookup
=> d_alloc_and_lookup
=> walk_component
=> path_lookupat
=> do_path_lookup
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
Diffstat (limited to 'net/9p/protocol.c')
-rw-r--r-- | net/9p/protocol.c | 53 |
1 files changed, 12 insertions, 41 deletions
diff --git a/net/9p/protocol.c b/net/9p/protocol.c index b7d4e8aa5383..55e10a96c902 100644 --- a/net/9p/protocol.c +++ b/net/9p/protocol.c | |||
@@ -37,40 +37,11 @@ | |||
37 | #include <net/9p/client.h> | 37 | #include <net/9p/client.h> |
38 | #include "protocol.h" | 38 | #include "protocol.h" |
39 | 39 | ||
40 | #include <trace/events/9p.h> | ||
41 | |||
40 | static int | 42 | static int |
41 | p9pdu_writef(struct p9_fcall *pdu, int proto_version, const char *fmt, ...); | 43 | p9pdu_writef(struct p9_fcall *pdu, int proto_version, const char *fmt, ...); |
42 | 44 | ||
43 | #ifdef CONFIG_NET_9P_DEBUG | ||
44 | void | ||
45 | p9pdu_dump(int way, struct p9_fcall *pdu) | ||
46 | { | ||
47 | int len = pdu->size; | ||
48 | |||
49 | if ((p9_debug_level & P9_DEBUG_VPKT) != P9_DEBUG_VPKT) { | ||
50 | if ((p9_debug_level & P9_DEBUG_PKT) == P9_DEBUG_PKT) { | ||
51 | if (len > 32) | ||
52 | len = 32; | ||
53 | } else { | ||
54 | /* shouldn't happen */ | ||
55 | return; | ||
56 | } | ||
57 | } | ||
58 | |||
59 | if (way) | ||
60 | print_hex_dump_bytes("[9P] ", DUMP_PREFIX_OFFSET, pdu->sdata, | ||
61 | len); | ||
62 | else | ||
63 | print_hex_dump_bytes("]9P[ ", DUMP_PREFIX_OFFSET, pdu->sdata, | ||
64 | len); | ||
65 | } | ||
66 | #else | ||
67 | void | ||
68 | p9pdu_dump(int way, struct p9_fcall *pdu) | ||
69 | { | ||
70 | } | ||
71 | #endif | ||
72 | EXPORT_SYMBOL(p9pdu_dump); | ||
73 | |||
74 | void p9stat_free(struct p9_wstat *stbuf) | 45 | void p9stat_free(struct p9_wstat *stbuf) |
75 | { | 46 | { |
76 | kfree(stbuf->name); | 47 | kfree(stbuf->name); |
@@ -551,7 +522,7 @@ p9pdu_writef(struct p9_fcall *pdu, int proto_version, const char *fmt, ...) | |||
551 | return ret; | 522 | return ret; |
552 | } | 523 | } |
553 | 524 | ||
554 | int p9stat_read(char *buf, int len, struct p9_wstat *st, int proto_version) | 525 | int p9stat_read(struct p9_client *clnt, char *buf, int len, struct p9_wstat *st) |
555 | { | 526 | { |
556 | struct p9_fcall fake_pdu; | 527 | struct p9_fcall fake_pdu; |
557 | int ret; | 528 | int ret; |
@@ -561,10 +532,10 @@ int p9stat_read(char *buf, int len, struct p9_wstat *st, int proto_version) | |||
561 | fake_pdu.sdata = buf; | 532 | fake_pdu.sdata = buf; |
562 | fake_pdu.offset = 0; | 533 | fake_pdu.offset = 0; |
563 | 534 | ||
564 | ret = p9pdu_readf(&fake_pdu, proto_version, "S", st); | 535 | ret = p9pdu_readf(&fake_pdu, clnt->proto_version, "S", st); |
565 | if (ret) { | 536 | if (ret) { |
566 | P9_DPRINTK(P9_DEBUG_9P, "<<< p9stat_read failed: %d\n", ret); | 537 | P9_DPRINTK(P9_DEBUG_9P, "<<< p9stat_read failed: %d\n", ret); |
567 | P9_DUMP_PKT(0, &fake_pdu); | 538 | trace_9p_protocol_dump(clnt, &fake_pdu); |
568 | } | 539 | } |
569 | 540 | ||
570 | return ret; | 541 | return ret; |
@@ -577,7 +548,7 @@ int p9pdu_prepare(struct p9_fcall *pdu, int16_t tag, int8_t type) | |||
577 | return p9pdu_writef(pdu, 0, "dbw", 0, type, tag); | 548 | return p9pdu_writef(pdu, 0, "dbw", 0, type, tag); |
578 | } | 549 | } |
579 | 550 | ||
580 | int p9pdu_finalize(struct p9_fcall *pdu) | 551 | int p9pdu_finalize(struct p9_client *clnt, struct p9_fcall *pdu) |
581 | { | 552 | { |
582 | int size = pdu->size; | 553 | int size = pdu->size; |
583 | int err; | 554 | int err; |
@@ -586,7 +557,7 @@ int p9pdu_finalize(struct p9_fcall *pdu) | |||
586 | err = p9pdu_writef(pdu, 0, "d", size); | 557 | err = p9pdu_writef(pdu, 0, "d", size); |
587 | pdu->size = size; | 558 | pdu->size = size; |
588 | 559 | ||
589 | P9_DUMP_PKT(0, pdu); | 560 | trace_9p_protocol_dump(clnt, pdu); |
590 | P9_DPRINTK(P9_DEBUG_9P, ">>> size=%d type: %d tag: %d\n", pdu->size, | 561 | P9_DPRINTK(P9_DEBUG_9P, ">>> size=%d type: %d tag: %d\n", pdu->size, |
591 | pdu->id, pdu->tag); | 562 | pdu->id, pdu->tag); |
592 | 563 | ||
@@ -599,8 +570,8 @@ void p9pdu_reset(struct p9_fcall *pdu) | |||
599 | pdu->size = 0; | 570 | pdu->size = 0; |
600 | } | 571 | } |
601 | 572 | ||
602 | int p9dirent_read(char *buf, int len, struct p9_dirent *dirent, | 573 | int p9dirent_read(struct p9_client *clnt, char *buf, int len, |
603 | int proto_version) | 574 | struct p9_dirent *dirent) |
604 | { | 575 | { |
605 | struct p9_fcall fake_pdu; | 576 | struct p9_fcall fake_pdu; |
606 | int ret; | 577 | int ret; |
@@ -611,11 +582,11 @@ int p9dirent_read(char *buf, int len, struct p9_dirent *dirent, | |||
611 | fake_pdu.sdata = buf; | 582 | fake_pdu.sdata = buf; |
612 | fake_pdu.offset = 0; | 583 | fake_pdu.offset = 0; |
613 | 584 | ||
614 | ret = p9pdu_readf(&fake_pdu, proto_version, "Qqbs", &dirent->qid, | 585 | ret = p9pdu_readf(&fake_pdu, clnt->proto_version, "Qqbs", &dirent->qid, |
615 | &dirent->d_off, &dirent->d_type, &nameptr); | 586 | &dirent->d_off, &dirent->d_type, &nameptr); |
616 | if (ret) { | 587 | if (ret) { |
617 | P9_DPRINTK(P9_DEBUG_9P, "<<< p9dirent_read failed: %d\n", ret); | 588 | P9_DPRINTK(P9_DEBUG_9P, "<<< p9dirent_read failed: %d\n", ret); |
618 | P9_DUMP_PKT(1, &fake_pdu); | 589 | trace_9p_protocol_dump(clnt, &fake_pdu); |
619 | goto out; | 590 | goto out; |
620 | } | 591 | } |
621 | 592 | ||