qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] virtio_blk_load() question
@ 2010-03-18  4:30 OHMURA Kei
  2010-03-18  7:37 ` [Qemu-devel] " Juan Quintela
  0 siblings, 1 reply; 5+ messages in thread
From: OHMURA Kei @ 2010-03-18  4:30 UTC (permalink / raw)
  To: kvm@vger.kernel.org, qemu-devel@nongnu.org
  Cc: ohmura.kei, Avi Kivity, Yoshiaki Tamura

Hi,

I have a question regarding virtio_blk_load().
(qemu-kvm.git d1fa468c1cc03ea362d8fe3ed9269bab4d197510)

VirtIOBlockReq structure is linked list of requests, but it doesn't seem to be
properly linked in virtio_blk_load().
...
req->next = s->rq;
s->rq = req->next;
...
In this case, we're losing req, and s->rq always point to be same entry.
If I'm understanding correctly, s->rq is NULL initially,
and this would be kept.

Although I'm not sure how these requests should be ordered, if the requests
should be added to the head of list to restore the saved status by
virtio_blk_save(), I think the following code is correct.  However, it seems to
reverse the order of the requests, and I'm wondering whether that is
appropriate.

Would somebody tell me how virtio_blk_load() is working?

diff --git a/hw/virtio-blk.c b/hw/virtio-blk.c
index b80402d..267b16f 100644
--- a/hw/virtio-blk.c
+++ b/hw/virtio-blk.c
@@ -457,7 +457,7 @@ static int virtio_blk_load(QEMUFile *f, void *opaque, int version_id)
        VirtIOBlockReq *req = virtio_blk_alloc_request(s);
        qemu_get_buffer(f, (unsigned char*)&req->elem, sizeof(req->elem));
        req->next = s->rq;
-        s->rq = req->next;
+        s->rq = req;
    }

    return 0;

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-03-19  2:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-18  4:30 [Qemu-devel] virtio_blk_load() question OHMURA Kei
2010-03-18  7:37 ` [Qemu-devel] " Juan Quintela
2010-03-18  9:42   ` OHMURA Kei
2010-03-18 12:07     ` Juan Quintela
2010-03-19  2:53       ` OHMURA Kei

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).