9pfs: improve v9fs_walk() tracing
authorChristian Schoenebeck <qemu_oss@crudebyte.com>
Fri, 6 Dec 2024 15:56:40 +0000 (16:56 +0100)
committerChristian Schoenebeck <qemu_oss@crudebyte.com>
Thu, 6 Feb 2025 16:10:45 +0000 (17:10 +0100)
commit0ad7cb925edff3f14bd47fdb7ef3c0b6186960d4
treecc7e6cb307e8e825af3e16aa312259ee74bd24b9
parentd922088eb4ba6bc31a99f17b32cf75e59dd306cd
9pfs: improve v9fs_walk() tracing

'Twalk' is the most important request type in the 9p protocol to look out
for when debugging 9p communication. That's because it is the only part
of the 9p protocol which actually deals with human-readable path names,
whereas all other 9p request types work on numeric file IDs (FIDs) only.

Improve tracing of 'Twalk' requests, e.g. let's say client wanted to walk
to "/home/bob/src", then improve trace output from:

  v9fs_walk tag 0 id 110 fid 0 newfid 1 nwnames 3

to:

  v9fs_walk tag=0 id=110 fid=0 newfid=1 nwnames=3 wnames={home, bob, src}

To achieve this, add a new helper function trace_v9fs_walk_wnames() which
converts the received V9fsString array of individual path elements into a
comma-separated string presentation for being passed to the tracing system.
As this conversion is somewhat expensive, this conversion function is only
called if tracing of event 'v9fs_walk' is currently enabled.

Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
Reviewed-by: Greg Kurz <groug@kaod.org>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-Id: <E1tJamT-007Cqk-9E@kylie.crudebyte.com>
hw/9pfs/9p.c
hw/9pfs/trace-events