mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-06 17:23:56 -06:00
virtiofsd: Add a helper to stop all queues
Use a helper to stop all the queues. Later in the patch series I am planning to use this helper at one more place later in the patch series. Signed-off-by: Vivek Goyal <vgoyal@redhat.com> Message-Id: <20210930153037.1194279-6-vgoyal@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
This commit is contained in:
parent
c68276556a
commit
50cf6d6cb7
1 changed files with 13 additions and 9 deletions
|
@ -740,6 +740,18 @@ static void fv_queue_cleanup_thread(struct fv_VuDev *vud, int qidx)
|
||||||
vud->qi[qidx] = NULL;
|
vud->qi[qidx] = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void stop_all_queues(struct fv_VuDev *vud)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < vud->nqueues; i++) {
|
||||||
|
if (!vud->qi[i]) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
fuse_log(FUSE_LOG_INFO, "%s: Stopping queue %d thread\n", __func__, i);
|
||||||
|
fv_queue_cleanup_thread(vud, i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Callback from libvhost-user on start or stop of a queue */
|
/* Callback from libvhost-user on start or stop of a queue */
|
||||||
static void fv_queue_set_started(VuDev *dev, int qidx, bool started)
|
static void fv_queue_set_started(VuDev *dev, int qidx, bool started)
|
||||||
{
|
{
|
||||||
|
@ -870,15 +882,7 @@ int virtio_loop(struct fuse_session *se)
|
||||||
* Make sure all fv_queue_thread()s quit on exit, as we're about to
|
* Make sure all fv_queue_thread()s quit on exit, as we're about to
|
||||||
* free virtio dev and fuse session, no one should access them anymore.
|
* free virtio dev and fuse session, no one should access them anymore.
|
||||||
*/
|
*/
|
||||||
for (int i = 0; i < se->virtio_dev->nqueues; i++) {
|
stop_all_queues(se->virtio_dev);
|
||||||
if (!se->virtio_dev->qi[i]) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
fuse_log(FUSE_LOG_INFO, "%s: Stopping queue %d thread\n", __func__, i);
|
|
||||||
fv_queue_cleanup_thread(se->virtio_dev, i);
|
|
||||||
}
|
|
||||||
|
|
||||||
fuse_log(FUSE_LOG_INFO, "%s: Exit\n", __func__);
|
fuse_log(FUSE_LOG_INFO, "%s: Exit\n", __func__);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue