diff mbox

hw/9pfs: Make VirtFS tracing work correctly

Message ID 1319449189-31621-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com
State New
Headers show

Commit Message

Aneesh Kumar K.V Oct. 24, 2011, 9:39 a.m. UTC
From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>

this patch fix multiple issues with VirtFS tracing.
a) Add tracepoint to the correct code path. We handle error in complete_pdu
b) Fix indentation in python script
c) Fix variable naming issue in python script

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
---
 hw/9pfs/virtio-9p.c               |   60 +++++++-------
 scripts/analyse-9p-simpletrace.py |  164 ++++++++++++++++++------------------
 trace-events                      |    2 +-
 3 files changed, 112 insertions(+), 114 deletions(-)

Comments

Blue Swirl Oct. 30, 2011, 11 a.m. UTC | #1
Thanks, applied.

On Mon, Oct 24, 2011 at 09:39, Aneesh Kumar K.V
<aneesh.kumar@linux.vnet.ibm.com> wrote:
> From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
>
> this patch fix multiple issues with VirtFS tracing.
> a) Add tracepoint to the correct code path. We handle error in complete_pdu
> b) Fix indentation in python script
> c) Fix variable naming issue in python script
>
> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
> ---
>  hw/9pfs/virtio-9p.c               |   60 +++++++-------
>  scripts/analyse-9p-simpletrace.py |  164 ++++++++++++++++++------------------
>  trace-events                      |    2 +-
>  3 files changed, 112 insertions(+), 114 deletions(-)
>
> diff --git a/hw/9pfs/virtio-9p.c b/hw/9pfs/virtio-9p.c
> index aab3beb..8b6813f 100644
> --- a/hw/9pfs/virtio-9p.c
> +++ b/hw/9pfs/virtio-9p.c
> @@ -969,7 +969,7 @@ static void complete_pdu(V9fsState *s, V9fsPDU *pdu, ssize_t len)
>         if (s->proto_version == V9FS_PROTO_2000L) {
>             id = P9_RLERROR;
>         }
> -        trace_complete_pdu(pdu->tag, pdu->id, err); /* Trace ERROR */
> +        trace_v9fs_rerror(pdu->tag, pdu->id, err); /* Trace ERROR */
>     }
>
>     /* fill out the header */
> @@ -1332,11 +1332,11 @@ static void v9fs_attach(void *opaque)
>     }
>     offset += pdu_marshal(pdu, offset, "Q", &qid);
>     err = offset;
> +    trace_v9fs_attach_return(pdu->tag, pdu->id,
> +                             qid.type, qid.version, qid.path);
>  out:
>     put_fid(pdu, fidp);
>  out_nofid:
> -    trace_v9fs_attach_return(pdu->tag, pdu->id,
> -                             qid.type, qid.version, qid.path);
>     complete_pdu(s, pdu, err);
>     v9fs_string_free(&uname);
>     v9fs_string_free(&aname);
> @@ -1371,13 +1371,12 @@ static void v9fs_stat(void *opaque)
>     }
>     offset += pdu_marshal(pdu, offset, "wS", 0, &v9stat);
>     err = offset;
> +    trace_v9fs_stat_return(pdu->tag, pdu->id, v9stat.mode,
> +                           v9stat.atime, v9stat.mtime, v9stat.length);
>     v9fs_stat_free(&v9stat);
>  out:
>     put_fid(pdu, fidp);
>  out_nofid:
> -    trace_v9fs_stat_return(pdu->tag, pdu->id, v9stat.mode,
> -                           v9stat.atime, v9stat.mtime, v9stat.length);
> -
>     complete_pdu(s, pdu, err);
>  }
>
> @@ -1421,13 +1420,12 @@ static void v9fs_getattr(void *opaque)
>     }
>     retval = offset;
>     retval += pdu_marshal(pdu, offset, "A", &v9stat_dotl);
> -out:
> -    put_fid(pdu, fidp);
> -out_nofid:
>     trace_v9fs_getattr_return(pdu->tag, pdu->id, v9stat_dotl.st_result_mask,
>                               v9stat_dotl.st_mode, v9stat_dotl.st_uid,
>                               v9stat_dotl.st_gid);
> -
> +out:
> +    put_fid(pdu, fidp);
> +out_nofid:
>     complete_pdu(s, pdu, retval);
>  }
>
> @@ -1605,6 +1603,7 @@ static void v9fs_walk(void *opaque)
>         v9fs_path_copy(&newfidp->path, &path);
>     }
>     err = v9fs_walk_marshal(pdu, nwnames, qids);
> +    trace_v9fs_walk_return(pdu->tag, pdu->id, nwnames, qids);
>  out:
>     put_fid(pdu, fidp);
>     if (newfidp) {
> @@ -1613,7 +1612,6 @@ out:
>     v9fs_path_free(&dpath);
>     v9fs_path_free(&path);
>  out_nofid:
> -    trace_v9fs_walk_return(pdu->tag, pdu->id, nwnames, qids);
>     complete_pdu(s, pdu, err);
>     if (nwnames && nwnames <= P9_MAXWELEM) {
>         for (name_idx = 0; name_idx < nwnames; name_idx++) {
> @@ -1648,10 +1646,10 @@ static int32_t get_iounit(V9fsPDU *pdu, V9fsPath *path)
>  static void v9fs_open(void *opaque)
>  {
>     int flags;
> -    int iounit;
>     int32_t fid;
>     int32_t mode;
>     V9fsQID qid;
> +    int iounit = 0;
>     ssize_t err = 0;
>     size_t offset = 7;
>     struct stat stbuf;
> @@ -1709,11 +1707,11 @@ static void v9fs_open(void *opaque)
>         offset += pdu_marshal(pdu, offset, "Qd", &qid, iounit);
>         err = offset;
>     }
> +    trace_v9fs_open_return(pdu->tag, pdu->id,
> +                           qid.type, qid.version, qid.path, iounit);
>  out:
>     put_fid(pdu, fidp);
>  out_nofid:
> -    trace_v9fs_open_return(pdu->tag, pdu->id,
> -                           qid.type, qid.version, qid.path, iounit);
>     complete_pdu(s, pdu, err);
>  }
>
> @@ -1759,11 +1757,11 @@ static void v9fs_lcreate(void *opaque)
>     stat_to_qid(&stbuf, &qid);
>     offset += pdu_marshal(pdu, offset, "Qd", &qid, iounit);
>     err = offset;
> +    trace_v9fs_lcreate_return(pdu->tag, pdu->id,
> +                              qid.type, qid.version, qid.path, iounit);
>  out:
>     put_fid(pdu, fidp);
>  out_nofid:
> -    trace_v9fs_lcreate_return(pdu->tag, pdu->id,
> -                              qid.type, qid.version, qid.path, iounit);
>     complete_pdu(pdu->s, pdu, err);
>     v9fs_string_free(&name);
>  }
> @@ -1978,10 +1976,10 @@ static void v9fs_read(void *opaque)
>     } else {
>         err = -EINVAL;
>     }
> +    trace_v9fs_read_return(pdu->tag, pdu->id, count, err);
>  out:
>     put_fid(pdu, fidp);
>  out_nofid:
> -    trace_v9fs_read_return(pdu->tag, pdu->id, count, err);
>     complete_pdu(s, pdu, err);
>  }
>
> @@ -2090,10 +2088,10 @@ static void v9fs_readdir(void *opaque)
>     retval = offset;
>     retval += pdu_marshal(pdu, offset, "d", count);
>     retval += count;
> +    trace_v9fs_readdir_return(pdu->tag, pdu->id, count, retval);
>  out:
>     put_fid(pdu, fidp);
>  out_nofid:
> -    trace_v9fs_readdir_return(pdu->tag, pdu->id, count, retval);
>     complete_pdu(s, pdu, retval);
>  }
>
> @@ -2202,10 +2200,10 @@ static void v9fs_write(void *opaque)
>     } while (total < count && len > 0);
>     offset += pdu_marshal(pdu, offset, "d", total);
>     err = offset;
> +    trace_v9fs_write_return(pdu->tag, pdu->id, total, err);
>  out:
>     put_fid(pdu, fidp);
>  out_nofid:
> -    trace_v9fs_write_return(pdu->tag, pdu->id, total, err);
>     complete_pdu(s, pdu, err);
>  }
>
> @@ -2362,11 +2360,11 @@ static void v9fs_create(void *opaque)
>     stat_to_qid(&stbuf, &qid);
>     offset += pdu_marshal(pdu, offset, "Qd", &qid, iounit);
>     err = offset;
> +    trace_v9fs_create_return(pdu->tag, pdu->id,
> +                             qid.type, qid.version, qid.path, iounit);
>  out:
>     put_fid(pdu, fidp);
>  out_nofid:
> -   trace_v9fs_create_return(pdu->tag, pdu->id,
> -                            qid.type, qid.version, qid.path, iounit);
>    complete_pdu(pdu->s, pdu, err);
>    v9fs_string_free(&name);
>    v9fs_string_free(&extension);
> @@ -2401,11 +2399,11 @@ static void v9fs_symlink(void *opaque)
>     stat_to_qid(&stbuf, &qid);
>     offset += pdu_marshal(pdu, offset, "Q", &qid);
>     err = offset;
> +    trace_v9fs_symlink_return(pdu->tag, pdu->id,
> +                              qid.type, qid.version, qid.path);
>  out:
>     put_fid(pdu, dfidp);
>  out_nofid:
> -    trace_v9fs_symlink_return(pdu->tag, pdu->id,
> -                              qid.type, qid.version, qid.path);
>     complete_pdu(pdu->s, pdu, err);
>     v9fs_string_free(&name);
>     v9fs_string_free(&symname);
> @@ -2950,10 +2948,11 @@ static void v9fs_mknod(void *opaque)
>     stat_to_qid(&stbuf, &qid);
>     err = offset;
>     err += pdu_marshal(pdu, offset, "Q", &qid);
> +    trace_v9fs_mknod_return(pdu->tag, pdu->id,
> +                            qid.type, qid.version, qid.path);
>  out:
>     put_fid(pdu, fidp);
>  out_nofid:
> -    trace_v9fs_mknod_return(pdu->tag, pdu->id, qid.type, qid.version, qid.path);
>     complete_pdu(s, pdu, err);
>     v9fs_string_free(&name);
>  }
> @@ -3049,12 +3048,11 @@ static void v9fs_getlock(void *opaque)
>                           glock->start, glock->length, glock->proc_id,
>                           &glock->client_id);
>     err = offset;
> +    trace_v9fs_getlock_return(pdu->tag, pdu->id, glock->type, glock->start,
> +                              glock->length, glock->proc_id);
>  out:
>     put_fid(pdu, fidp);
>  out_nofid:
> -    trace_v9fs_getlock_return(pdu->tag, pdu->id, glock->type, glock->start,
> -                              glock->length, glock->proc_id);
> -
>     complete_pdu(s, pdu, err);
>     v9fs_string_free(&glock->client_id);
>     g_free(glock);
> @@ -3089,11 +3087,11 @@ static void v9fs_mkdir(void *opaque)
>     stat_to_qid(&stbuf, &qid);
>     offset += pdu_marshal(pdu, offset, "Q", &qid);
>     err = offset;
> +    trace_v9fs_mkdir_return(pdu->tag, pdu->id,
> +                            qid.type, qid.version, qid.path, err);
>  out:
>     put_fid(pdu, fidp);
>  out_nofid:
> -    trace_v9fs_mkdir_return(pdu->tag, pdu->id,
> -                            qid.type, qid.version, qid.path, err);
>     complete_pdu(pdu->s, pdu, err);
>     v9fs_string_free(&name);
>  }
> @@ -3183,13 +3181,13 @@ static void v9fs_xattrwalk(void *opaque)
>         offset += pdu_marshal(pdu, offset, "q", size);
>         err = offset;
>     }
> +    trace_v9fs_xattrwalk_return(pdu->tag, pdu->id, size);
>  out:
>     put_fid(pdu, file_fidp);
>     if (xattr_fidp) {
>         put_fid(pdu, xattr_fidp);
>     }
>  out_nofid:
> -    trace_v9fs_xattrwalk_return(pdu->tag, pdu->id, size);
>     complete_pdu(s, pdu, err);
>     v9fs_string_free(&name);
>  }
> @@ -3260,11 +3258,11 @@ static void v9fs_readlink(void *opaque)
>     }
>     offset += pdu_marshal(pdu, offset, "s", &target);
>     err = offset;
> +    trace_v9fs_readlink_return(pdu->tag, pdu->id, target.data);
>     v9fs_string_free(&target);
>  out:
>     put_fid(pdu, fidp);
>  out_nofid:
> -    trace_v9fs_readlink_return(pdu->tag, pdu->id, target.data);
>     complete_pdu(pdu->s, pdu, err);
>  }
>
> diff --git a/scripts/analyse-9p-simpletrace.py b/scripts/analyse-9p-simpletrace.py
> index 4358d6b..b6d58fd 100755
> --- a/scripts/analyse-9p-simpletrace.py
> +++ b/scripts/analyse-9p-simpletrace.py
> @@ -7,11 +7,11 @@
>  import simpletrace
>
>  class VirtFSRequestTracker(simpletrace.Analyzer):
> -       def begin(self):
> -               print "Pretty printing 9p simpletrace log ..."
> +        def begin(self):
> +                print "Pretty printing 9p simpletrace log ..."
>
> -        def complete_pdu(self, tag, id, err):
> -                print "ERROR (tag =", tag, ", id =", id, ",err =", err, ")"
> +        def v9fs_rerror(self, tag, id, err):
> +                print "RERROR (tag =", tag, ", id =", id, ",err =", err, ")"
>
>         def v9fs_version(self, tag, id, msize, version):
>                 print "TVERSION (tag =", tag, ", msize =", msize, ", version =", version, ")"
> @@ -22,121 +22,121 @@ class VirtFSRequestTracker(simpletrace.Analyzer):
>         def v9fs_attach(self, tag, id, fid, afid, uname, aname):
>                 print "TATTACH (tag =", tag, ", fid =", fid, ", afid =", afid, ", uname =", uname, ", aname =", aname, ")"
>
> -       def v9fs_attach_return(self, tag, id, type, verison, path):
> -               print "RATTACH (tag =", tag, ", qid={type =", type, ", version =", version, ", path =", path, "})"
> +        def v9fs_attach_return(self, tag, id, type, version, path):
> +                print "RATTACH (tag =", tag, ", qid={type =", type, ", version =", version, ", path =", path, "})"
>
> -       def v9fs_stat(self, tag, id, fid):
> -               print "TSTAT (tag =", tag, ", fid =", fid, ")"
> +        def v9fs_stat(self, tag, id, fid):
> +                print "TSTAT (tag =", tag, ", fid =", fid, ")"
>
> -       def v9fs_stat_return(self, tag, id, mode, atime, mtime, length):
> -               print "RSTAT (tag =", tag, ", mode =", mode, ", atime =", atime, ", mtime =", mtime, ", length =", length, ")"
> +        def v9fs_stat_return(self, tag, id, mode, atime, mtime, length):
> +                print "RSTAT (tag =", tag, ", mode =", mode, ", atime =", atime, ", mtime =", mtime, ", length =", length, ")"
>
> -       def v9fs_getattr(self, tag, id, fid, request_mask):
> -               print "TGETATTR (tag =", tag, ", fid =", fid, ", request_mask =", hex(request_mask), ")"
> +        def v9fs_getattr(self, tag, id, fid, request_mask):
> +                print "TGETATTR (tag =", tag, ", fid =", fid, ", request_mask =", hex(request_mask), ")"
>
> -       def v9fs_getattr_return(self, tag, id, result_mask, mode, uid, gid):
> -               print "RGETATTR (tag =", tag, ", result_mask =", hex(result_mask), ", mode =", oct(mode), ", uid =", uid, ", gid =", gid, ")"
> +        def v9fs_getattr_return(self, tag, id, result_mask, mode, uid, gid):
> +                print "RGETATTR (tag =", tag, ", result_mask =", hex(result_mask), ", mode =", oct(mode), ", uid =", uid, ", gid =", gid, ")"
>
> -       def v9fs_walk(self, tag, id, fid, newfid, nwnames):
> -               print "TWALK (tag =", tag, ", fid =", fid, ", newfid =", newfid, ", nwnames =", nwnames, ")"
> +        def v9fs_walk(self, tag, id, fid, newfid, nwnames):
> +                print "TWALK (tag =", tag, ", fid =", fid, ", newfid =", newfid, ", nwnames =", nwnames, ")"
>
> -       def v9fs_walk_return(self, tag, id, nwnames, qids):
> -               print "RWALK (tag =", tag, ", nwnames =", nwnames, ", qids =", hex(qids), ")"
> +        def v9fs_walk_return(self, tag, id, nwnames, qids):
> +                print "RWALK (tag =", tag, ", nwnames =", nwnames, ", qids =", hex(qids), ")"
>
> -       def v9fs_open(self, tag, id, fid, mode):
> -               print "TOPEN (tag =", tag, ", fid =", fid, ", mode =", oct(mode), ")"
> +        def v9fs_open(self, tag, id, fid, mode):
> +                print "TOPEN (tag =", tag, ", fid =", fid, ", mode =", oct(mode), ")"
>
> -       def v9fs_open_return(self, tag, id, type, version, path, iounit):
> -               print "ROPEN (tag =", tag,  ", qid={type =", type, ", version =", version, ", path =", path, "}, iounit =", iounit, ")"
> +        def v9fs_open_return(self, tag, id, type, version, path, iounit):
> +                print "ROPEN (tag =", tag,  ", qid={type =", type, ", version =", version, ", path =", path, "}, iounit =", iounit, ")"
>
> -       def v9fs_lcreate(self, tag, id, dfid, flags, mode, gid):
> -               print "TLCREATE (tag =", tag, ", dfid =", dfid, ", flags =", oct(flags), ", mode =", oct(mode), ", gid =", gid, ")"
> +        def v9fs_lcreate(self, tag, id, dfid, flags, mode, gid):
> +                print "TLCREATE (tag =", tag, ", dfid =", dfid, ", flags =", oct(flags), ", mode =", oct(mode), ", gid =", gid, ")"
>
> -       def v9fs_lcreate_return(self, id, type, version, path, iounit):
> -               print "RLCREATE (tag =", tag,  ", qid={type =", type, ", version =", version, ", path =", path, "}, iounit =", iounit, ")"
> +        def v9fs_lcreate_return(self, tag, id, type, version, path, iounit):
> +                print "RLCREATE (tag =", tag,  ", qid={type =", type, ", version =", version, ", path =", path, "}, iounit =", iounit, ")"
>
> -       def v9fs_fsync(self, tag, id, fid, datasync):
> -               print "TFSYNC (tag =", tag, ", fid =", fid, ", datasync =", datasync, ")"
> +        def v9fs_fsync(self, tag, id, fid, datasync):
> +                print "TFSYNC (tag =", tag, ", fid =", fid, ", datasync =", datasync, ")"
>
> -       def v9fs_clunk(self, tag, id, fid):
> -               print "TCLUNK (tag =", tag, ", fid =", fid, ")"
> +        def v9fs_clunk(self, tag, id, fid):
> +                print "TCLUNK (tag =", tag, ", fid =", fid, ")"
>
> -       def v9fs_read(self, tag, id, fid, off, max_count):
> -               print "TREAD (tag =", tag, ", fid =", fid, ", off =", off, ", max_count =", max_count, ")"
> +        def v9fs_read(self, tag, id, fid, off, max_count):
> +                print "TREAD (tag =", tag, ", fid =", fid, ", off =", off, ", max_count =", max_count, ")"
>
> -       def v9fs_read_return(self, tag, id, count, err):
> -               print "RREAD (tag =", tag, ", count =", count, ", err =", err, ")"
> +        def v9fs_read_return(self, tag, id, count, err):
> +                print "RREAD (tag =", tag, ", count =", count, ", err =", err, ")"
>
> -       def v9fs_readdir(self, tag, id, fid, offset, max_count):
> -               print "TREADDIR (tag =", tag, ", fid =", fid, ", offset =", offset, ", max_count =", max_count, ")"
> +        def v9fs_readdir(self, tag, id, fid, offset, max_count):
> +                print "TREADDIR (tag =", tag, ", fid =", fid, ", offset =", offset, ", max_count =", max_count, ")"
>
> -       def v9fs_readdir_return(self, tag, id, count, retval):
> -               print "RREADDIR (tag =", tag, ", count =", count, ", retval =", retval, ")"
> +        def v9fs_readdir_return(self, tag, id, count, retval):
> +                print "RREADDIR (tag =", tag, ", count =", count, ", retval =", retval, ")"
>
> -       def v9fs_write(self, tag, id, fid, off, count, cnt):
> -               print "TWRITE (tag =", tag, ", fid =", fid, ", off =", off, ", count =", count, ", cnt =", cnt, ")"
> +        def v9fs_write(self, tag, id, fid, off, count, cnt):
> +                print "TWRITE (tag =", tag, ", fid =", fid, ", off =", off, ", count =", count, ", cnt =", cnt, ")"
>
> -       def v9fs_write_return(self, tag, id, total, err):
> -               print "RWRITE (tag =", tag, ", total =", total, ", err =", err, ")"
> +        def v9fs_write_return(self, tag, id, total, err):
> +                print "RWRITE (tag =", tag, ", total =", total, ", err =", err, ")"
>
> -       def v9fs_create(self, tag, id, fid, perm, name, mode):
> -               print "TCREATE (tag =", tag, ", fid =", fid, ", perm =", oct(perm), ", name =", name, ", mode =", oct(mode), ")"
> +        def v9fs_create(self, tag, id, fid, name, perm, mode):
> +                print "TCREATE (tag =", tag, ", fid =", fid, ", perm =", oct(perm), ", name =", name, ", mode =", oct(mode), ")"
>
> -       def v9fs_create_return(self, tag, id, type, verison, path, iounit):
> -               print "RCREATE (tag =", tag,  ", qid={type =", type, ", version =", version, ", path =", path, "}, iounit =", iounit, ")"
> +        def v9fs_create_return(self, tag, id, type, version, path, iounit):
> +                print "RCREATE (tag =", tag,  ", qid={type =", type, ", version =", version, ", path =", path, "}, iounit =", iounit, ")"
>
> -       def v9fs_symlink(self, tag, id, fid, name, symname, gid):
> -               print "TSYMLINK (tag =", tag, ", fid =", fid, ", name =", name, ", symname =", symname, ", gid =", gid, ")"
> +        def v9fs_symlink(self, tag, id, fid, name, symname, gid):
> +                print "TSYMLINK (tag =", tag, ", fid =", fid, ", name =", name, ", symname =", symname, ", gid =", gid, ")"
>
> -       def v9fs_symlink_return(self, tag, id, type, version, path):
> -               print "RSYMLINK (tag =", tag,  ", qid={type =", type, ", version =", version, ", path =", path, "})"
> +        def v9fs_symlink_return(self, tag, id, type, version, path):
> +                print "RSYMLINK (tag =", tag,  ", qid={type =", type, ", version =", version, ", path =", path, "})"
>
> -       def v9fs_flush(self, tag, id, flush_tag):
> -               print "TFLUSH (tag =", tag, ", flush_tag =", flush_tag, ")"
> +        def v9fs_flush(self, tag, id, flush_tag):
> +                print "TFLUSH (tag =", tag, ", flush_tag =", flush_tag, ")"
>
> -       def v9fs_link(self, tag, id, dfid, oldfid, name):
> -               print "TLINK (tag =", tag, ", dfid =", dfid, ", oldfid =", oldfid, ", name =", name, ")"
> +        def v9fs_link(self, tag, id, dfid, oldfid, name):
> +                print "TLINK (tag =", tag, ", dfid =", dfid, ", oldfid =", oldfid, ", name =", name, ")"
>
> -       def v9fs_remove(self, tag, id, fid):
> -               print "TREMOVE (tag =", tag, ", fid =", fid, ")"
> +        def v9fs_remove(self, tag, id, fid):
> +                print "TREMOVE (tag =", tag, ", fid =", fid, ")"
>
> -       def v9fs_wstat(self, tag, id, fid, mode, atime, mtime):
> -               print "TWSTAT (tag =", tag, ", fid =", fid, ", mode =", oct(mode), ", atime =", atime, "mtime =", mtime, ")"
> +        def v9fs_wstat(self, tag, id, fid, mode, atime, mtime):
> +                print "TWSTAT (tag =", tag, ", fid =", fid, ", mode =", oct(mode), ", atime =", atime, "mtime =", mtime, ")"
>
> -       def v9fs_mknod(self, tag, id, fid, mode, major, minor):
> -               print "TMKNOD (tag =", tag, ", fid =", fid, ", mode =", oct(mode), ", major =", major, ", minor =", minor, ")"
> +        def v9fs_mknod(self, tag, id, fid, mode, major, minor):
> +                print "TMKNOD (tag =", tag, ", fid =", fid, ", mode =", oct(mode), ", major =", major, ", minor =", minor, ")"
>
> -       def v9fs_lock(self, tag, id, fid, type, start, length):
> -               print "TLOCK (tag =", tag, ", fid =", fid, "type =", type, ", start =", start, ", length =", length, ")"
> +        def v9fs_lock(self, tag, id, fid, type, start, length):
> +                print "TLOCK (tag =", tag, ", fid =", fid, "type =", type, ", start =", start, ", length =", length, ")"
>
> -       def v9fs_lock_return(self, tag, id, status):
> -               print "RLOCK (tag =", tag, ", status =", status, ")"
> +        def v9fs_lock_return(self, tag, id, status):
> +                print "RLOCK (tag =", tag, ", status =", status, ")"
>
> -       def v9fs_getlock(self, tag, id, fid, type, start, length):
> -               print "TGETLOCK (tag =", tag, ", fid =", fid, "type =", type, ", start =", start, ", length =", length, ")"
> +        def v9fs_getlock(self, tag, id, fid, type, start, length):
> +                print "TGETLOCK (tag =", tag, ", fid =", fid, "type =", type, ", start =", start, ", length =", length, ")"
>
> -       def v9fs_getlock_return(self, tag, id, type, start, length, proc_id):
> -               print "RGETLOCK (tag =", tag, "type =", type, ", start =", start, ", length =", length, ", proc_id =", proc_id,  ")"
> +        def v9fs_getlock_return(self, tag, id, type, start, length, proc_id):
> +                print "RGETLOCK (tag =", tag, "type =", type, ", start =", start, ", length =", length, ", proc_id =", proc_id,  ")"
>
> -       def v9fs_mkdir(self, tag, id, fid, name, mode, gid):
> -               print "TMKDIR (tag =", tag, ", fid =", fid, ", name =", name, ", mode =", mode, ", gid =", gid, ")"
> +        def v9fs_mkdir(self, tag, id, fid, name, mode, gid):
> +                print "TMKDIR (tag =", tag, ", fid =", fid, ", name =", name, ", mode =", mode, ", gid =", gid, ")"
>
> -       def v9fs_mkdir_return(self, tag, id, type, version, path, err):
> -               print "RMKDIR (tag =", tag,  ", qid={type =", type, ", version =", version, ", path =", path, "}, err =", err, ")"
> +        def v9fs_mkdir_return(self, tag, id, type, version, path, err):
> +                print "RMKDIR (tag =", tag,  ", qid={type =", type, ", version =", version, ", path =", path, "}, err =", err, ")"
>
> -       def v9fs_xattrwalk(self, tag, id, fid, newfid, name):
> -               print "TXATTRWALK (tag =", tag, ", fid =", fid, ", newfid =", newfid, ", xattr name =", name, ")"
> +        def v9fs_xattrwalk(self, tag, id, fid, newfid, name):
> +                print "TXATTRWALK (tag =", tag, ", fid =", fid, ", newfid =", newfid, ", xattr name =", name, ")"
>
> -       def v9fs_xattrwalk_return(self, tag, id, size):
> -               print "RXATTRWALK (tag =", tag, ", xattrsize  =", size, ")"
> +        def v9fs_xattrwalk_return(self, tag, id, size):
> +                print "RXATTRWALK (tag =", tag, ", xattrsize  =", size, ")"
>
> -       def v9fs_xattrcreate(self, tag, id, fid, name, size, flags):
> -               print "TXATTRCREATE (tag =", tag, ", fid =", fid, ", name =", name, ", xattrsize =", size, ", flags =", flags, ")"
> +        def v9fs_xattrcreate(self, tag, id, fid, name, size, flags):
> +                print "TXATTRCREATE (tag =", tag, ", fid =", fid, ", name =", name, ", xattrsize =", size, ", flags =", flags, ")"
>
> -       def v9fs_readlink(self, tag, id, fid):
> -               print "TREADLINK (tag =", tag, ", fid =", fid, ")"
> +        def v9fs_readlink(self, tag, id, fid):
> +                print "TREADLINK (tag =", tag, ", fid =", fid, ")"
>
> -       def v9fs_readlink_return(self, tag, id, target):
> -               print "RREADLINK (tag =", tag, ", target =", target, ")"
> +        def v9fs_readlink_return(self, tag, id, target):
> +                print "RREADLINK (tag =", tag, ", target =", target, ")"
>
>  simpletrace.run(VirtFSRequestTracker())
> diff --git a/trace-events b/trace-events
> index 7f9cec4..0f0a6b0 100644
> --- a/trace-events
> +++ b/trace-events
> @@ -554,7 +554,7 @@ open_eth_desc_read(uint32_t addr, uint32_t v) "DESC[%04x] -> %08x"
>  open_eth_desc_write(uint32_t addr, uint32_t v) "DESC[%04x] <- %08x"
>
>  # hw/9pfs/virtio-9p.c
> -complete_pdu(uint16_t tag, uint8_t id, int err) "tag %d id %d err %d"
> +v9fs_rerror(uint16_t tag, uint8_t id, int err) "tag %d id %d err %d"
>  v9fs_version(uint16_t tag, uint8_t id, int32_t msize, char* version) "tag %d id %d msize %d version %s"
>  v9fs_version_return(uint16_t tag, uint8_t id, int32_t msize, char* version) "tag %d id %d msize %d version %s"
>  v9fs_attach(uint16_t tag, uint8_t id, int32_t fid, int32_t afid, char* uname, char* aname) "tag %u id %u fid %d afid %d uname %s aname %s"
> --
> 1.7.5.4
>
>
>
diff mbox

Patch

diff --git a/hw/9pfs/virtio-9p.c b/hw/9pfs/virtio-9p.c
index aab3beb..8b6813f 100644
--- a/hw/9pfs/virtio-9p.c
+++ b/hw/9pfs/virtio-9p.c
@@ -969,7 +969,7 @@  static void complete_pdu(V9fsState *s, V9fsPDU *pdu, ssize_t len)
         if (s->proto_version == V9FS_PROTO_2000L) {
             id = P9_RLERROR;
         }
-        trace_complete_pdu(pdu->tag, pdu->id, err); /* Trace ERROR */
+        trace_v9fs_rerror(pdu->tag, pdu->id, err); /* Trace ERROR */
     }
 
     /* fill out the header */
@@ -1332,11 +1332,11 @@  static void v9fs_attach(void *opaque)
     }
     offset += pdu_marshal(pdu, offset, "Q", &qid);
     err = offset;
+    trace_v9fs_attach_return(pdu->tag, pdu->id,
+                             qid.type, qid.version, qid.path);
 out:
     put_fid(pdu, fidp);
 out_nofid:
-    trace_v9fs_attach_return(pdu->tag, pdu->id,
-                             qid.type, qid.version, qid.path);
     complete_pdu(s, pdu, err);
     v9fs_string_free(&uname);
     v9fs_string_free(&aname);
@@ -1371,13 +1371,12 @@  static void v9fs_stat(void *opaque)
     }
     offset += pdu_marshal(pdu, offset, "wS", 0, &v9stat);
     err = offset;
+    trace_v9fs_stat_return(pdu->tag, pdu->id, v9stat.mode,
+                           v9stat.atime, v9stat.mtime, v9stat.length);
     v9fs_stat_free(&v9stat);
 out:
     put_fid(pdu, fidp);
 out_nofid:
-    trace_v9fs_stat_return(pdu->tag, pdu->id, v9stat.mode,
-                           v9stat.atime, v9stat.mtime, v9stat.length);
-
     complete_pdu(s, pdu, err);
 }
 
@@ -1421,13 +1420,12 @@  static void v9fs_getattr(void *opaque)
     }
     retval = offset;
     retval += pdu_marshal(pdu, offset, "A", &v9stat_dotl);
-out:
-    put_fid(pdu, fidp);
-out_nofid:
     trace_v9fs_getattr_return(pdu->tag, pdu->id, v9stat_dotl.st_result_mask,
                               v9stat_dotl.st_mode, v9stat_dotl.st_uid,
                               v9stat_dotl.st_gid);
-
+out:
+    put_fid(pdu, fidp);
+out_nofid:
     complete_pdu(s, pdu, retval);
 }
 
@@ -1605,6 +1603,7 @@  static void v9fs_walk(void *opaque)
         v9fs_path_copy(&newfidp->path, &path);
     }
     err = v9fs_walk_marshal(pdu, nwnames, qids);
+    trace_v9fs_walk_return(pdu->tag, pdu->id, nwnames, qids);
 out:
     put_fid(pdu, fidp);
     if (newfidp) {
@@ -1613,7 +1612,6 @@  out:
     v9fs_path_free(&dpath);
     v9fs_path_free(&path);
 out_nofid:
-    trace_v9fs_walk_return(pdu->tag, pdu->id, nwnames, qids);
     complete_pdu(s, pdu, err);
     if (nwnames && nwnames <= P9_MAXWELEM) {
         for (name_idx = 0; name_idx < nwnames; name_idx++) {
@@ -1648,10 +1646,10 @@  static int32_t get_iounit(V9fsPDU *pdu, V9fsPath *path)
 static void v9fs_open(void *opaque)
 {
     int flags;
-    int iounit;
     int32_t fid;
     int32_t mode;
     V9fsQID qid;
+    int iounit = 0;
     ssize_t err = 0;
     size_t offset = 7;
     struct stat stbuf;
@@ -1709,11 +1707,11 @@  static void v9fs_open(void *opaque)
         offset += pdu_marshal(pdu, offset, "Qd", &qid, iounit);
         err = offset;
     }
+    trace_v9fs_open_return(pdu->tag, pdu->id,
+                           qid.type, qid.version, qid.path, iounit);
 out:
     put_fid(pdu, fidp);
 out_nofid:
-    trace_v9fs_open_return(pdu->tag, pdu->id,
-                           qid.type, qid.version, qid.path, iounit);
     complete_pdu(s, pdu, err);
 }
 
@@ -1759,11 +1757,11 @@  static void v9fs_lcreate(void *opaque)
     stat_to_qid(&stbuf, &qid);
     offset += pdu_marshal(pdu, offset, "Qd", &qid, iounit);
     err = offset;
+    trace_v9fs_lcreate_return(pdu->tag, pdu->id,
+                              qid.type, qid.version, qid.path, iounit);
 out:
     put_fid(pdu, fidp);
 out_nofid:
-    trace_v9fs_lcreate_return(pdu->tag, pdu->id,
-                              qid.type, qid.version, qid.path, iounit);
     complete_pdu(pdu->s, pdu, err);
     v9fs_string_free(&name);
 }
@@ -1978,10 +1976,10 @@  static void v9fs_read(void *opaque)
     } else {
         err = -EINVAL;
     }
+    trace_v9fs_read_return(pdu->tag, pdu->id, count, err);
 out:
     put_fid(pdu, fidp);
 out_nofid:
-    trace_v9fs_read_return(pdu->tag, pdu->id, count, err);
     complete_pdu(s, pdu, err);
 }
 
@@ -2090,10 +2088,10 @@  static void v9fs_readdir(void *opaque)
     retval = offset;
     retval += pdu_marshal(pdu, offset, "d", count);
     retval += count;
+    trace_v9fs_readdir_return(pdu->tag, pdu->id, count, retval);
 out:
     put_fid(pdu, fidp);
 out_nofid:
-    trace_v9fs_readdir_return(pdu->tag, pdu->id, count, retval);
     complete_pdu(s, pdu, retval);
 }
 
@@ -2202,10 +2200,10 @@  static void v9fs_write(void *opaque)
     } while (total < count && len > 0);
     offset += pdu_marshal(pdu, offset, "d", total);
     err = offset;
+    trace_v9fs_write_return(pdu->tag, pdu->id, total, err);
 out:
     put_fid(pdu, fidp);
 out_nofid:
-    trace_v9fs_write_return(pdu->tag, pdu->id, total, err);
     complete_pdu(s, pdu, err);
 }
 
@@ -2362,11 +2360,11 @@  static void v9fs_create(void *opaque)
     stat_to_qid(&stbuf, &qid);
     offset += pdu_marshal(pdu, offset, "Qd", &qid, iounit);
     err = offset;
+    trace_v9fs_create_return(pdu->tag, pdu->id,
+                             qid.type, qid.version, qid.path, iounit);
 out:
     put_fid(pdu, fidp);
 out_nofid:
-   trace_v9fs_create_return(pdu->tag, pdu->id,
-                            qid.type, qid.version, qid.path, iounit);
    complete_pdu(pdu->s, pdu, err);
    v9fs_string_free(&name);
    v9fs_string_free(&extension);
@@ -2401,11 +2399,11 @@  static void v9fs_symlink(void *opaque)
     stat_to_qid(&stbuf, &qid);
     offset += pdu_marshal(pdu, offset, "Q", &qid);
     err = offset;
+    trace_v9fs_symlink_return(pdu->tag, pdu->id,
+                              qid.type, qid.version, qid.path);
 out:
     put_fid(pdu, dfidp);
 out_nofid:
-    trace_v9fs_symlink_return(pdu->tag, pdu->id,
-                              qid.type, qid.version, qid.path);
     complete_pdu(pdu->s, pdu, err);
     v9fs_string_free(&name);
     v9fs_string_free(&symname);
@@ -2950,10 +2948,11 @@  static void v9fs_mknod(void *opaque)
     stat_to_qid(&stbuf, &qid);
     err = offset;
     err += pdu_marshal(pdu, offset, "Q", &qid);
+    trace_v9fs_mknod_return(pdu->tag, pdu->id,
+                            qid.type, qid.version, qid.path);
 out:
     put_fid(pdu, fidp);
 out_nofid:
-    trace_v9fs_mknod_return(pdu->tag, pdu->id, qid.type, qid.version, qid.path);
     complete_pdu(s, pdu, err);
     v9fs_string_free(&name);
 }
@@ -3049,12 +3048,11 @@  static void v9fs_getlock(void *opaque)
                           glock->start, glock->length, glock->proc_id,
                           &glock->client_id);
     err = offset;
+    trace_v9fs_getlock_return(pdu->tag, pdu->id, glock->type, glock->start,
+                              glock->length, glock->proc_id);
 out:
     put_fid(pdu, fidp);
 out_nofid:
-    trace_v9fs_getlock_return(pdu->tag, pdu->id, glock->type, glock->start,
-                              glock->length, glock->proc_id);
-
     complete_pdu(s, pdu, err);
     v9fs_string_free(&glock->client_id);
     g_free(glock);
@@ -3089,11 +3087,11 @@  static void v9fs_mkdir(void *opaque)
     stat_to_qid(&stbuf, &qid);
     offset += pdu_marshal(pdu, offset, "Q", &qid);
     err = offset;
+    trace_v9fs_mkdir_return(pdu->tag, pdu->id,
+                            qid.type, qid.version, qid.path, err);
 out:
     put_fid(pdu, fidp);
 out_nofid:
-    trace_v9fs_mkdir_return(pdu->tag, pdu->id,
-                            qid.type, qid.version, qid.path, err);
     complete_pdu(pdu->s, pdu, err);
     v9fs_string_free(&name);
 }
@@ -3183,13 +3181,13 @@  static void v9fs_xattrwalk(void *opaque)
         offset += pdu_marshal(pdu, offset, "q", size);
         err = offset;
     }
+    trace_v9fs_xattrwalk_return(pdu->tag, pdu->id, size);
 out:
     put_fid(pdu, file_fidp);
     if (xattr_fidp) {
         put_fid(pdu, xattr_fidp);
     }
 out_nofid:
-    trace_v9fs_xattrwalk_return(pdu->tag, pdu->id, size);
     complete_pdu(s, pdu, err);
     v9fs_string_free(&name);
 }
@@ -3260,11 +3258,11 @@  static void v9fs_readlink(void *opaque)
     }
     offset += pdu_marshal(pdu, offset, "s", &target);
     err = offset;
+    trace_v9fs_readlink_return(pdu->tag, pdu->id, target.data);
     v9fs_string_free(&target);
 out:
     put_fid(pdu, fidp);
 out_nofid:
-    trace_v9fs_readlink_return(pdu->tag, pdu->id, target.data);
     complete_pdu(pdu->s, pdu, err);
 }
 
diff --git a/scripts/analyse-9p-simpletrace.py b/scripts/analyse-9p-simpletrace.py
index 4358d6b..b6d58fd 100755
--- a/scripts/analyse-9p-simpletrace.py
+++ b/scripts/analyse-9p-simpletrace.py
@@ -7,11 +7,11 @@ 
 import simpletrace
 
 class VirtFSRequestTracker(simpletrace.Analyzer):
-	def begin(self):
-		print "Pretty printing 9p simpletrace log ..."
+        def begin(self):
+                print "Pretty printing 9p simpletrace log ..."
 
-        def complete_pdu(self, tag, id, err):
-                print "ERROR (tag =", tag, ", id =", id, ",err =", err, ")"
+        def v9fs_rerror(self, tag, id, err):
+                print "RERROR (tag =", tag, ", id =", id, ",err =", err, ")"
 
         def v9fs_version(self, tag, id, msize, version):
                 print "TVERSION (tag =", tag, ", msize =", msize, ", version =", version, ")"
@@ -22,121 +22,121 @@  class VirtFSRequestTracker(simpletrace.Analyzer):
         def v9fs_attach(self, tag, id, fid, afid, uname, aname):
                 print "TATTACH (tag =", tag, ", fid =", fid, ", afid =", afid, ", uname =", uname, ", aname =", aname, ")"
 
-	def v9fs_attach_return(self, tag, id, type, verison, path):
-		print "RATTACH (tag =", tag, ", qid={type =", type, ", version =", version, ", path =", path, "})"
+        def v9fs_attach_return(self, tag, id, type, version, path):
+                print "RATTACH (tag =", tag, ", qid={type =", type, ", version =", version, ", path =", path, "})"
 
-	def v9fs_stat(self, tag, id, fid):
-		print "TSTAT (tag =", tag, ", fid =", fid, ")"
+        def v9fs_stat(self, tag, id, fid):
+                print "TSTAT (tag =", tag, ", fid =", fid, ")"
 
-	def v9fs_stat_return(self, tag, id, mode, atime, mtime, length):
-		print "RSTAT (tag =", tag, ", mode =", mode, ", atime =", atime, ", mtime =", mtime, ", length =", length, ")"
+        def v9fs_stat_return(self, tag, id, mode, atime, mtime, length):
+                print "RSTAT (tag =", tag, ", mode =", mode, ", atime =", atime, ", mtime =", mtime, ", length =", length, ")"
 
-	def v9fs_getattr(self, tag, id, fid, request_mask):
-		print "TGETATTR (tag =", tag, ", fid =", fid, ", request_mask =", hex(request_mask), ")"
+        def v9fs_getattr(self, tag, id, fid, request_mask):
+                print "TGETATTR (tag =", tag, ", fid =", fid, ", request_mask =", hex(request_mask), ")"
 
-	def v9fs_getattr_return(self, tag, id, result_mask, mode, uid, gid):
-		print "RGETATTR (tag =", tag, ", result_mask =", hex(result_mask), ", mode =", oct(mode), ", uid =", uid, ", gid =", gid, ")"
+        def v9fs_getattr_return(self, tag, id, result_mask, mode, uid, gid):
+                print "RGETATTR (tag =", tag, ", result_mask =", hex(result_mask), ", mode =", oct(mode), ", uid =", uid, ", gid =", gid, ")"
 
-	def v9fs_walk(self, tag, id, fid, newfid, nwnames):
-		print "TWALK (tag =", tag, ", fid =", fid, ", newfid =", newfid, ", nwnames =", nwnames, ")"
+        def v9fs_walk(self, tag, id, fid, newfid, nwnames):
+                print "TWALK (tag =", tag, ", fid =", fid, ", newfid =", newfid, ", nwnames =", nwnames, ")"
 
-	def v9fs_walk_return(self, tag, id, nwnames, qids):
-		print "RWALK (tag =", tag, ", nwnames =", nwnames, ", qids =", hex(qids), ")"
+        def v9fs_walk_return(self, tag, id, nwnames, qids):
+                print "RWALK (tag =", tag, ", nwnames =", nwnames, ", qids =", hex(qids), ")"
 
-	def v9fs_open(self, tag, id, fid, mode):
-		print "TOPEN (tag =", tag, ", fid =", fid, ", mode =", oct(mode), ")"
+        def v9fs_open(self, tag, id, fid, mode):
+                print "TOPEN (tag =", tag, ", fid =", fid, ", mode =", oct(mode), ")"
 
-	def v9fs_open_return(self, tag, id, type, version, path, iounit):
-		print "ROPEN (tag =", tag,  ", qid={type =", type, ", version =", version, ", path =", path, "}, iounit =", iounit, ")"
+        def v9fs_open_return(self, tag, id, type, version, path, iounit):
+                print "ROPEN (tag =", tag,  ", qid={type =", type, ", version =", version, ", path =", path, "}, iounit =", iounit, ")"
 
-	def v9fs_lcreate(self, tag, id, dfid, flags, mode, gid):
-		print "TLCREATE (tag =", tag, ", dfid =", dfid, ", flags =", oct(flags), ", mode =", oct(mode), ", gid =", gid, ")"
+        def v9fs_lcreate(self, tag, id, dfid, flags, mode, gid):
+                print "TLCREATE (tag =", tag, ", dfid =", dfid, ", flags =", oct(flags), ", mode =", oct(mode), ", gid =", gid, ")"
 
-	def v9fs_lcreate_return(self, id, type, version, path, iounit):
-		print "RLCREATE (tag =", tag,  ", qid={type =", type, ", version =", version, ", path =", path, "}, iounit =", iounit, ")"
+        def v9fs_lcreate_return(self, tag, id, type, version, path, iounit):
+                print "RLCREATE (tag =", tag,  ", qid={type =", type, ", version =", version, ", path =", path, "}, iounit =", iounit, ")"
 
-	def v9fs_fsync(self, tag, id, fid, datasync):
-		print "TFSYNC (tag =", tag, ", fid =", fid, ", datasync =", datasync, ")"
+        def v9fs_fsync(self, tag, id, fid, datasync):
+                print "TFSYNC (tag =", tag, ", fid =", fid, ", datasync =", datasync, ")"
 
-	def v9fs_clunk(self, tag, id, fid):
-		print "TCLUNK (tag =", tag, ", fid =", fid, ")"
+        def v9fs_clunk(self, tag, id, fid):
+                print "TCLUNK (tag =", tag, ", fid =", fid, ")"
 
-	def v9fs_read(self, tag, id, fid, off, max_count):
-		print "TREAD (tag =", tag, ", fid =", fid, ", off =", off, ", max_count =", max_count, ")"
+        def v9fs_read(self, tag, id, fid, off, max_count):
+                print "TREAD (tag =", tag, ", fid =", fid, ", off =", off, ", max_count =", max_count, ")"
 
-	def v9fs_read_return(self, tag, id, count, err):
-		print "RREAD (tag =", tag, ", count =", count, ", err =", err, ")"
+        def v9fs_read_return(self, tag, id, count, err):
+                print "RREAD (tag =", tag, ", count =", count, ", err =", err, ")"
 
-	def v9fs_readdir(self, tag, id, fid, offset, max_count):
-		print "TREADDIR (tag =", tag, ", fid =", fid, ", offset =", offset, ", max_count =", max_count, ")"
+        def v9fs_readdir(self, tag, id, fid, offset, max_count):
+                print "TREADDIR (tag =", tag, ", fid =", fid, ", offset =", offset, ", max_count =", max_count, ")"
 
-	def v9fs_readdir_return(self, tag, id, count, retval):
-		print "RREADDIR (tag =", tag, ", count =", count, ", retval =", retval, ")"
+        def v9fs_readdir_return(self, tag, id, count, retval):
+                print "RREADDIR (tag =", tag, ", count =", count, ", retval =", retval, ")"
 
-	def v9fs_write(self, tag, id, fid, off, count, cnt):
-		print "TWRITE (tag =", tag, ", fid =", fid, ", off =", off, ", count =", count, ", cnt =", cnt, ")"
+        def v9fs_write(self, tag, id, fid, off, count, cnt):
+                print "TWRITE (tag =", tag, ", fid =", fid, ", off =", off, ", count =", count, ", cnt =", cnt, ")"
 
-	def v9fs_write_return(self, tag, id, total, err):
-		print "RWRITE (tag =", tag, ", total =", total, ", err =", err, ")"
+        def v9fs_write_return(self, tag, id, total, err):
+                print "RWRITE (tag =", tag, ", total =", total, ", err =", err, ")"
 
-	def v9fs_create(self, tag, id, fid, perm, name, mode):
-		print "TCREATE (tag =", tag, ", fid =", fid, ", perm =", oct(perm), ", name =", name, ", mode =", oct(mode), ")"
+        def v9fs_create(self, tag, id, fid, name, perm, mode):
+                print "TCREATE (tag =", tag, ", fid =", fid, ", perm =", oct(perm), ", name =", name, ", mode =", oct(mode), ")"
 
-	def v9fs_create_return(self, tag, id, type, verison, path, iounit):
-		print "RCREATE (tag =", tag,  ", qid={type =", type, ", version =", version, ", path =", path, "}, iounit =", iounit, ")"
+        def v9fs_create_return(self, tag, id, type, version, path, iounit):
+                print "RCREATE (tag =", tag,  ", qid={type =", type, ", version =", version, ", path =", path, "}, iounit =", iounit, ")"
 
-	def v9fs_symlink(self, tag, id, fid, name, symname, gid):
-		print "TSYMLINK (tag =", tag, ", fid =", fid, ", name =", name, ", symname =", symname, ", gid =", gid, ")"
+        def v9fs_symlink(self, tag, id, fid, name, symname, gid):
+                print "TSYMLINK (tag =", tag, ", fid =", fid, ", name =", name, ", symname =", symname, ", gid =", gid, ")"
 
-	def v9fs_symlink_return(self, tag, id, type, version, path):
-		print "RSYMLINK (tag =", tag,  ", qid={type =", type, ", version =", version, ", path =", path, "})"
+        def v9fs_symlink_return(self, tag, id, type, version, path):
+                print "RSYMLINK (tag =", tag,  ", qid={type =", type, ", version =", version, ", path =", path, "})"
 
-	def v9fs_flush(self, tag, id, flush_tag):
-		print "TFLUSH (tag =", tag, ", flush_tag =", flush_tag, ")"
+        def v9fs_flush(self, tag, id, flush_tag):
+                print "TFLUSH (tag =", tag, ", flush_tag =", flush_tag, ")"
 
-	def v9fs_link(self, tag, id, dfid, oldfid, name):
-		print "TLINK (tag =", tag, ", dfid =", dfid, ", oldfid =", oldfid, ", name =", name, ")"
+        def v9fs_link(self, tag, id, dfid, oldfid, name):
+                print "TLINK (tag =", tag, ", dfid =", dfid, ", oldfid =", oldfid, ", name =", name, ")"
 
-	def v9fs_remove(self, tag, id, fid):
-		print "TREMOVE (tag =", tag, ", fid =", fid, ")"
+        def v9fs_remove(self, tag, id, fid):
+                print "TREMOVE (tag =", tag, ", fid =", fid, ")"
 
-	def v9fs_wstat(self, tag, id, fid, mode, atime, mtime):
-		print "TWSTAT (tag =", tag, ", fid =", fid, ", mode =", oct(mode), ", atime =", atime, "mtime =", mtime, ")"
+        def v9fs_wstat(self, tag, id, fid, mode, atime, mtime):
+                print "TWSTAT (tag =", tag, ", fid =", fid, ", mode =", oct(mode), ", atime =", atime, "mtime =", mtime, ")"
 
-	def v9fs_mknod(self, tag, id, fid, mode, major, minor):
-		print "TMKNOD (tag =", tag, ", fid =", fid, ", mode =", oct(mode), ", major =", major, ", minor =", minor, ")"
+        def v9fs_mknod(self, tag, id, fid, mode, major, minor):
+                print "TMKNOD (tag =", tag, ", fid =", fid, ", mode =", oct(mode), ", major =", major, ", minor =", minor, ")"
 
-	def v9fs_lock(self, tag, id, fid, type, start, length):
-		print "TLOCK (tag =", tag, ", fid =", fid, "type =", type, ", start =", start, ", length =", length, ")"
+        def v9fs_lock(self, tag, id, fid, type, start, length):
+                print "TLOCK (tag =", tag, ", fid =", fid, "type =", type, ", start =", start, ", length =", length, ")"
 
-	def v9fs_lock_return(self, tag, id, status):
-		print "RLOCK (tag =", tag, ", status =", status, ")"
+        def v9fs_lock_return(self, tag, id, status):
+                print "RLOCK (tag =", tag, ", status =", status, ")"
 
-	def v9fs_getlock(self, tag, id, fid, type, start, length):
-		print "TGETLOCK (tag =", tag, ", fid =", fid, "type =", type, ", start =", start, ", length =", length, ")"
+        def v9fs_getlock(self, tag, id, fid, type, start, length):
+                print "TGETLOCK (tag =", tag, ", fid =", fid, "type =", type, ", start =", start, ", length =", length, ")"
 
-	def v9fs_getlock_return(self, tag, id, type, start, length, proc_id):
-		print "RGETLOCK (tag =", tag, "type =", type, ", start =", start, ", length =", length, ", proc_id =", proc_id,  ")"
+        def v9fs_getlock_return(self, tag, id, type, start, length, proc_id):
+                print "RGETLOCK (tag =", tag, "type =", type, ", start =", start, ", length =", length, ", proc_id =", proc_id,  ")"
 
-	def v9fs_mkdir(self, tag, id, fid, name, mode, gid):
-		print "TMKDIR (tag =", tag, ", fid =", fid, ", name =", name, ", mode =", mode, ", gid =", gid, ")"
+        def v9fs_mkdir(self, tag, id, fid, name, mode, gid):
+                print "TMKDIR (tag =", tag, ", fid =", fid, ", name =", name, ", mode =", mode, ", gid =", gid, ")"
 
-	def v9fs_mkdir_return(self, tag, id, type, version, path, err):
-		print "RMKDIR (tag =", tag,  ", qid={type =", type, ", version =", version, ", path =", path, "}, err =", err, ")"
+        def v9fs_mkdir_return(self, tag, id, type, version, path, err):
+                print "RMKDIR (tag =", tag,  ", qid={type =", type, ", version =", version, ", path =", path, "}, err =", err, ")"
 
-	def v9fs_xattrwalk(self, tag, id, fid, newfid, name):
-		print "TXATTRWALK (tag =", tag, ", fid =", fid, ", newfid =", newfid, ", xattr name =", name, ")"
+        def v9fs_xattrwalk(self, tag, id, fid, newfid, name):
+                print "TXATTRWALK (tag =", tag, ", fid =", fid, ", newfid =", newfid, ", xattr name =", name, ")"
 
-	def v9fs_xattrwalk_return(self, tag, id, size):
-		print "RXATTRWALK (tag =", tag, ", xattrsize  =", size, ")"
+        def v9fs_xattrwalk_return(self, tag, id, size):
+                print "RXATTRWALK (tag =", tag, ", xattrsize  =", size, ")"
 
-	def v9fs_xattrcreate(self, tag, id, fid, name, size, flags):
-		print "TXATTRCREATE (tag =", tag, ", fid =", fid, ", name =", name, ", xattrsize =", size, ", flags =", flags, ")"
+        def v9fs_xattrcreate(self, tag, id, fid, name, size, flags):
+                print "TXATTRCREATE (tag =", tag, ", fid =", fid, ", name =", name, ", xattrsize =", size, ", flags =", flags, ")"
 
-	def v9fs_readlink(self, tag, id, fid):
-		print "TREADLINK (tag =", tag, ", fid =", fid, ")"
+        def v9fs_readlink(self, tag, id, fid):
+                print "TREADLINK (tag =", tag, ", fid =", fid, ")"
 
-	def v9fs_readlink_return(self, tag, id, target):
-		print "RREADLINK (tag =", tag, ", target =", target, ")"
+        def v9fs_readlink_return(self, tag, id, target):
+                print "RREADLINK (tag =", tag, ", target =", target, ")"
 
 simpletrace.run(VirtFSRequestTracker())
diff --git a/trace-events b/trace-events
index 7f9cec4..0f0a6b0 100644
--- a/trace-events
+++ b/trace-events
@@ -554,7 +554,7 @@  open_eth_desc_read(uint32_t addr, uint32_t v) "DESC[%04x] -> %08x"
 open_eth_desc_write(uint32_t addr, uint32_t v) "DESC[%04x] <- %08x"
 
 # hw/9pfs/virtio-9p.c
-complete_pdu(uint16_t tag, uint8_t id, int err) "tag %d id %d err %d"
+v9fs_rerror(uint16_t tag, uint8_t id, int err) "tag %d id %d err %d"
 v9fs_version(uint16_t tag, uint8_t id, int32_t msize, char* version) "tag %d id %d msize %d version %s"
 v9fs_version_return(uint16_t tag, uint8_t id, int32_t msize, char* version) "tag %d id %d msize %d version %s"
 v9fs_attach(uint16_t tag, uint8_t id, int32_t fid, int32_t afid, char* uname, char* aname) "tag %u id %u fid %d afid %d uname %s aname %s"