[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 6/6] nbd: use generic trace subsystem instead
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH v2 6/6] nbd: use generic trace subsystem instead of TRACE macro |
Date: |
Thu, 29 Jun 2017 15:12:54 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0 |
On 06/21/2017 10:34 AM, Vladimir Sementsov-Ogievskiy wrote:
> Starting from this patch to enable traces use -trace option of qemu or
> -T, --trace option of qemu-img, qemu-io and qemu-nbd. For qemu traces
> also can be managed by qmp commands trace-event-{get,set}-state.
Maybe:
Let NBD use the trace mechanisms already present in qemu. Now you can
use the -trace optino of qemu, or the -T/--trace option of qemu-img,
qemu-io, and qemu-nbd, to select nbd traces. For qemu, the QMP commands
trace-event-{get,set}-state can also toggle tracing on the fly.
I also mentioned in v1 that an actual command line example might be
helpful (for example, is it qemu-nbd --trace "nbd_*" to get ALL nbd
traces enabled?)
>
> Recompilation with CFLAGS=-DDEBUG_NBD is no more needed, furthermore,
> DEBUG_NBD macro is removed from the code.
Yay!
>
> Signed-off-by: Vladimir Sementsov-Ogievskiy <address@hidden>
> @@ -462,7 +460,7 @@ int nbd_receive_negotiate(QIOChannel *ioc, const char
> *name, uint16_t *flags,
>
> memcpy(&nbd_magic, buf, 8);
> nbd_magic = be64_to_cpu(nbd_magic);
> - TRACE("Magic is 0x%" PRIx64, nbd_magic);
> + trace_nbd_receive_negotiate_magic(nbd_magic);
Might be some churn based on the resolution to 5/6.
>
> if (memcmp(buf, "NBDMAGIC", 8) != 0) {
> error_setg(errp, "Invalid magic received");
> @@ -474,7 +472,7 @@ int nbd_receive_negotiate(QIOChannel *ioc, const char
> *name, uint16_t *flags,
> goto fail;
> }
> magic = be64_to_cpu(magic);
> - TRACE("Magic is 0x%" PRIx64, magic);
> + trace_nbd_receive_negotiate_magic2(magic);
I'm not sure you need two different trace functions, since the message
is identical. I'd just have trace_nbd_receive_magic(magic) and use that
at both call sites.
But overall worth having, even if we fine-tune it later.
Reviewed-by: Eric Blake <address@hidden>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature
- [Qemu-devel] [PATCH v2 0/6] nbd refactoring part 2, Vladimir Sementsov-Ogievskiy, 2017/06/21
- [Qemu-devel] [PATCH v2 5/6] nbd/client: refactor TRACE of NBD_MAGIC, Vladimir Sementsov-Ogievskiy, 2017/06/21
- [Qemu-devel] [PATCH v2 4/6] nbd/common: nbd_tls_handshake: remove extra TRACE, Vladimir Sementsov-Ogievskiy, 2017/06/21
- [Qemu-devel] [PATCH v2 2/6] nbd/server: use errp instead of LOG, Vladimir Sementsov-Ogievskiy, 2017/06/21
- [Qemu-devel] [PATCH v2 6/6] nbd: use generic trace subsystem instead of TRACE macro, Vladimir Sementsov-Ogievskiy, 2017/06/21
- Re: [Qemu-devel] [PATCH v2 6/6] nbd: use generic trace subsystem instead of TRACE macro,
Eric Blake <=
- [Qemu-devel] [PATCH v2 1/6] nbd/server: nbd_negotiate: return 1 on NBD_OPT_ABORT, Vladimir Sementsov-Ogievskiy, 2017/06/21
- [Qemu-devel] [PATCH v2 3/6] nbd/server: add errp to nbd_send_reply(), Vladimir Sementsov-Ogievskiy, 2017/06/21