From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
To: Wei Liu <wei.liu2@citrix.com>, qemu-devel@nongnu.org
Cc: "Michael S. Tsirkin" <mst@redhat.com>,
Alexander Graf <agraf@suse.de>,
Christian Borntraeger <borntraeger@de.ibm.com>,
Cornelia Huck <cornelia.huck@de.ibm.com>,
Greg Kurz <gkurz@linux.vnet.ibm.com>,
Richard Henderson <rth@twiddle.net>
Subject: Re: [Qemu-devel] [PATCH v2 27/27] 9pfs: disentangle V9fsState
Date: Fri, 08 Jan 2016 11:39:37 +0530 [thread overview]
Message-ID: <87poxca9ge.fsf@linux.vnet.ibm.com> (raw)
In-Reply-To: <1452196584-17259-28-git-send-email-wei.liu2@citrix.com>
Wei Liu <wei.liu2@citrix.com> writes:
> V9fsState now only contains generic fields. Introduce V9fsVirtioState
> for virtio transport. Change virtio-pci and virtio-ccw to use
> V9fsVirtioState. Handle transport enumeration in generic routines.
>
Few comments below
> Signed-off-by: Wei Liu <wei.liu2@citrix.com>
> ---
> hw/9pfs/9p.c | 41 ++++++++++++++++++-----
> hw/9pfs/9p.h | 19 +++++++----
> hw/9pfs/virtio-9p-device.c | 82 ++++++++++++++++++++++++++++------------------
> hw/9pfs/virtio-9p.h | 12 ++++++-
> hw/s390x/virtio-ccw.h | 2 +-
> hw/virtio/virtio-pci.h | 2 +-
> 6 files changed, 109 insertions(+), 49 deletions(-)
>
> diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c
> index 6858b21..2cf8580 100644
> --- a/hw/9pfs/9p.c
> +++ b/hw/9pfs/9p.c
> @@ -45,7 +45,13 @@ ssize_t pdu_marshal(V9fsPDU *pdu, size_t offset, const char *fmt, ...)
> va_list ap;
>
> va_start(ap, fmt);
> - ret = virtio_pdu_vmarshal(pdu, offset, fmt, ap);
> + switch (pdu->transport) {
> + case VIRTIO:
> + ret = virtio_pdu_vmarshal(pdu, offset, fmt, ap);
> + break;
> + default:
> + ret = -1;
> + }
> va_end(ap);
>
All that switch(pdu->transport) can go in the next series along with Xen
support. It is not really needed now and when we complete Xen transport
we will pull that.
> return ret;
> @@ -57,7 +63,13 @@ ssize_t pdu_unmarshal(V9fsPDU *pdu, size_t offset, const char *fmt, ...)
> va_list ap;
>
> va_start(ap, fmt);
> - ret = virtio_pdu_vunmarshal(pdu, offset, fmt, ap);
> + switch (pdu->transport) {
> + case VIRTIO:
> + ret = virtio_pdu_vunmarshal(pdu, offset, fmt, ap);
> + break;
> + default:
> + ret = -1;
> + }
> va_end(ap);
>
> return ret;
> @@ -65,7 +77,11 @@ ssize_t pdu_unmarshal(V9fsPDU *pdu, size_t offset, const char *fmt, ...)
>
> static void pdu_push_and_notify(V9fsPDU *pdu)
> {
> - virtio_9p_push_and_notify(pdu);
> + switch (pdu->transport) {
> + case VIRTIO:
> + virtio_9p_push_and_notify(pdu);
> + break;
> + }
> }
>
> static int omode_to_uflags(int8_t mode)
> @@ -1696,7 +1712,11 @@ static void v9fs_init_qiov_from_pdu(QEMUIOVector *qiov, V9fsPDU *pdu,
> struct iovec *iov;
> unsigned int niov;
>
> - virtio_init_iov_from_pdu(pdu, &iov, &niov, is_write);
> + switch (pdu->transport) {
> + case VIRTIO:
> + virtio_init_iov_from_pdu(pdu, &iov, &niov, is_write);
> + break;
> + }
>
> qemu_iovec_init_external(&elem, iov, niov);
> qemu_iovec_init(qiov, niov);
> @@ -3272,8 +3292,10 @@ void pdu_submit(V9fsPDU *pdu)
> }
>
> /* Returns 0 on success, 1 on failure. */
> -int v9fs_device_realize_common(V9fsState *s, Error **errp)
> +int v9fs_device_realize_common(V9fsState *s, enum p9_transport transport,
> + Error **errp)
> {
> + V9fsVirtioState *v = container_of(s, V9fsVirtioState, state);
> int i, len;
> struct stat stat;
> FsDriverEntry *fse;
> @@ -3284,8 +3306,10 @@ int v9fs_device_realize_common(V9fsState *s, Error **errp)
> QLIST_INIT(&s->free_list);
> QLIST_INIT(&s->active_list);
> for (i = 0; i < (MAX_REQ - 1); i++) {
> - QLIST_INSERT_HEAD(&s->free_list, &s->pdus[i], next);
> - s->pdus[i].s = s;
> + QLIST_INSERT_HEAD(&s->free_list, &v->pdus[i], next);
> + v->pdus[i].s = s;
> + v->pdus[i].idx = i;
> + v->pdus[i].transport = transport;
> }
>
> v9fs_path_init(&path);
> @@ -3360,7 +3384,8 @@ out:
> return rc;
> }
>
> -void v9fs_device_unrealize_common(V9fsState *s, Error **errp)
> +void v9fs_device_unrealize_common(V9fsState *s, enum p9_transport transport,
> + Error **errp)
> {
> g_free(s->ctx.fs_root);
> g_free(s->tag);
> diff --git a/hw/9pfs/9p.h b/hw/9pfs/9p.h
> index 3fe4da4..bd8588d 100644
> --- a/hw/9pfs/9p.h
> +++ b/hw/9pfs/9p.h
> @@ -14,6 +14,10 @@
> #include "qemu/thread.h"
> #include "qemu/coroutine.h"
>
> +enum p9_transport {
> + VIRTIO = 0x1,
> +};
> +
> enum {
> P9_TLERROR = 6,
> P9_RLERROR,
> @@ -131,9 +135,10 @@ struct V9fsPDU
> uint8_t id;
> uint8_t cancelled;
> CoQueue complete;
> - VirtQueueElement elem;
> struct V9fsState *s;
> QLIST_ENTRY(V9fsPDU) next;
> + uint32_t idx; /* index inside the array */
> + enum p9_transport transport;
> };
>
Can you do this change as a separate patch ? ie, Make V9fsPDU
independent of virtio . Also introduce V9fsVirtioState
>
> @@ -205,16 +210,12 @@ struct V9fsFidState
>
-aneesh
next prev parent reply other threads:[~2016-01-08 6:10 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-07 19:55 [Qemu-devel] [PATCH v2 00/27] 9pfs: disentangling virtio and generic code Wei Liu
2016-01-07 19:55 ` [Qemu-devel] [PATCH v2 01/27] 9pfs: rename virtio-9p-coth.{c, h} to coth.{c, h} Wei Liu
2016-01-07 19:55 ` [Qemu-devel] [PATCH v2 02/27] 9pfs: rename virtio-9p-handle.c to 9p-handle.c Wei Liu
2016-01-07 19:56 ` [Qemu-devel] [PATCH v2 03/27] 9pfs: rename virtio-9p-local.c to 9p-local.c Wei Liu
2016-01-07 19:56 ` [Qemu-devel] [PATCH v2 04/27] 9pfs: rename virtio-9p-posix-acl.c to 9p-posix-acl.c Wei Liu
2016-01-07 19:56 ` [Qemu-devel] [PATCH v2 05/27] 9pfs: rename virtio-9p-proxy.{c, h} to 9p-proxy.{c, h} Wei Liu
2016-01-07 19:56 ` [Qemu-devel] [PATCH v2 06/27] 9pfs: rename virtio-9p-synth.{c, h} to 9p-synth.{c, h} Wei Liu
2016-01-07 19:56 ` [Qemu-devel] [PATCH v2 07/27] 9pfs: rename virtio-9p-xattr{, -user}.{c, h} to 9p-xattr{, -user}.{c, h} Wei Liu
2016-01-07 19:56 ` [Qemu-devel] [PATCH v2 08/27] 9pfs: merge hw/virtio/virtio-9p.h into hw/9pfs/virtio-9p.h Wei Liu
2016-01-07 19:56 ` [Qemu-devel] [PATCH v2 09/27] 9pfs: remove dead code Wei Liu
2016-01-07 19:56 ` [Qemu-devel] [PATCH v2 10/27] fsdev: break out 9p-marshal.{c, h} from virtio-9p-marshal.{c, h} Wei Liu
2016-01-07 19:56 ` [Qemu-devel] [PATCH v2 11/27] fsdev: 9p-marshal: introduce V9fsBlob Wei Liu
2016-01-07 19:56 ` [Qemu-devel] [PATCH v2 12/27] 9pfs: use V9fsBlob to transmit xattr Wei Liu
2016-01-08 8:30 ` Aneesh Kumar K.V
2016-01-08 17:56 ` Wei Liu
2016-01-08 18:48 ` Aneesh Kumar K.V
2016-01-08 18:54 ` Wei Liu
2016-01-07 19:56 ` [Qemu-devel] [PATCH v2 13/27] fsdev: rename virtio-9p-marshal.{c, h} to 9p-iov-marshal.{c, h} Wei Liu
2016-01-07 19:56 ` [Qemu-devel] [PATCH v2 14/27] 9pfs: PDU processing functions don't need to take V9fsState as argument Wei Liu
2016-01-07 19:56 ` [Qemu-devel] [PATCH v2 15/27] 9pfs: PDU processing functions should start pdu_ prefix Wei Liu
2016-01-07 19:56 ` [Qemu-devel] [PATCH v2 16/27] 9pfs: make pdu_{, un}marshal proper functions Wei Liu
2016-01-07 19:56 ` [Qemu-devel] [PATCH v2 17/27] 9pfs: factor out virtio_pdu_{, un}marshal Wei Liu
2016-01-07 19:56 ` [Qemu-devel] [PATCH v2 18/27] 9pfs: factor out pdu_push_and_notify Wei Liu
2016-01-07 19:56 ` [Qemu-devel] [PATCH v2 19/27] 9pfs: break out virtio_init_iov_from_pdu Wei Liu
2016-01-07 19:56 ` [Qemu-devel] [PATCH v2 20/27] 9pfs: break out 9p.h from virtio-9p.h Wei Liu
2016-01-07 19:56 ` [Qemu-devel] [PATCH v2 21/27] 9pfs: factor out virtio_9p_push_and_notify Wei Liu
2016-01-08 9:57 ` Aneesh Kumar K.V
2016-01-08 17:57 ` Wei Liu
2016-01-07 19:56 ` [Qemu-devel] [PATCH v2 22/27] 9pfs: export pdu_{submit, alloc, free} Wei Liu
2016-01-07 19:56 ` [Qemu-devel] [PATCH v2 23/27] 9pfs: move handle_9p_output and make it static function Wei Liu
2016-01-07 19:56 ` [Qemu-devel] [PATCH v2 24/27] 9pfs: rename virtio_9p_set_fd_limit to use v9fs_ prefix Wei Liu
2016-01-07 19:56 ` [Qemu-devel] [PATCH v2 25/27] 9pfs: rename virtio-9p.c to 9p.c Wei Liu
2016-01-07 19:56 ` [Qemu-devel] [PATCH v2 26/27] 9pfs: factor out v9fs_device_{, un}realize_common Wei Liu
2016-01-07 19:56 ` [Qemu-devel] [PATCH v2 27/27] 9pfs: disentangle V9fsState Wei Liu
2016-01-08 6:09 ` Aneesh Kumar K.V [this message]
2016-01-08 18:54 ` Wei Liu
2016-01-08 10:49 ` [Qemu-devel] [PATCH v2 00/27] 9pfs: disentangling virtio and generic code Aneesh Kumar K.V
2016-01-08 18:54 ` Wei Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87poxca9ge.fsf@linux.vnet.ibm.com \
--to=aneesh.kumar@linux.vnet.ibm.com \
--cc=agraf@suse.de \
--cc=borntraeger@de.ibm.com \
--cc=cornelia.huck@de.ibm.com \
--cc=gkurz@linux.vnet.ibm.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
--cc=wei.liu2@citrix.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).