[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 05/13] virtiofsd: Add a helper to stop all queues
From: |
Vivek Goyal |
Subject: |
[PATCH 05/13] virtiofsd: Add a helper to stop all queues |
Date: |
Thu, 30 Sep 2021 11:30:29 -0400 |
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>
---
tools/virtiofsd/fuse_virtio.c | 22 +++++++++++++---------
1 file changed, 13 insertions(+), 9 deletions(-)
diff --git a/tools/virtiofsd/fuse_virtio.c b/tools/virtiofsd/fuse_virtio.c
index fcf12db9cd..baead08b28 100644
--- a/tools/virtiofsd/fuse_virtio.c
+++ b/tools/virtiofsd/fuse_virtio.c
@@ -740,6 +740,18 @@ static void fv_queue_cleanup_thread(struct fv_VuDev *vud,
int qidx)
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 */
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
* free virtio dev and fuse session, no one should access them anymore.
*/
- for (int i = 0; i < se->virtio_dev->nqueues; i++) {
- 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);
- }
-
+ stop_all_queues(se->virtio_dev);
fuse_log(FUSE_LOG_INFO, "%s: Exit\n", __func__);
return 0;
--
2.31.1
- [PATCH 00/13] virtiofsd: Support notification queue and, Vivek Goyal, 2021/09/30
- [PATCH 01/13] virtio_fs.h: Add notification queue feature bit, Vivek Goyal, 2021/09/30
- [PATCH 13/13] virtiofsd, seccomp: Add clock_nanosleep() to allow list, Vivek Goyal, 2021/09/30
- [PATCH 05/13] virtiofsd: Add a helper to stop all queues,
Vivek Goyal <=
- [PATCH 03/13] virtiofsd: Remove unused virtio_fs_config definition, Vivek Goyal, 2021/09/30
- [PATCH 08/13] virtiofsd: Create a notification queue, Vivek Goyal, 2021/09/30
- [PATCH 11/13] virtiofsd: Shutdown notification queue in the end, Vivek Goyal, 2021/09/30
- [PATCH 10/13] virtiofsd: Custom threadpool for remote blocking posix locks requests, Vivek Goyal, 2021/09/30
- [PATCH 02/13] virtiofsd: fuse.h header file changes for lock notification, Vivek Goyal, 2021/09/30
- [PATCH 04/13] virtiofsd: Add a helper to send element on virtqueue, Vivek Goyal, 2021/09/30
- [PATCH 06/13] vhost-user-fs: Use helpers to create/cleanup virtqueue, Vivek Goyal, 2021/09/30
- [PATCH 07/13] virtiofsd: Release file locks using F_UNLCK, Vivek Goyal, 2021/09/30
- [PATCH 09/13] virtiofsd: Specify size of notification buffer using config space, Vivek Goyal, 2021/09/30
- [PATCH 12/13] virtiofsd: Implement blocking posix locks, Vivek Goyal, 2021/09/30