|
From: | Paolo Bonzini |
Subject: | Re: [Qemu-devel] [PATCH 1/2] iscsi: add support for bdrv_co_is_allocated() |
Date: | Fri, 21 Jun 2013 18:31:09 +0200 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130514 Thunderbird/17.0.6 |
Il 21/06/2013 13:07, Kevin Wolf ha scritto: >>> > > Note that you're blocking here. The preferred way would be something >>> > > involving a yield from the coroutine and a reenter as soon as all >>> > > requests are done. Maybe a CoRwLock does what you need? >> > Is there a document how to use it? Or can you help here? > The idea would be to take a read lock while any request is in flight > (i.e. qemu_co_rwlock_rdlock() before it's started and > qemu_co_rwlock_unlock() when it completes), and to take a write lock > (qemu_co_rwlock_wrlock) for the part of iscsi_co_is_allocated() that > requires that no other request runs in parallel. > You can just send the SCSI command asynchronously and wait for the result. There is an example in block/qed.c, the same would apply for iscsi. Paolo
[Prev in Thread] | Current Thread | [Next in Thread] |