Page MenuHomeFreeBSD

D46295.id149165.diff
No OneTemporary

D46295.id149165.diff

diff --git a/sys/dev/virtio/fs/virtio_fs.h b/sys/dev/virtio/fs/virtio_fs.h
--- a/sys/dev/virtio/fs/virtio_fs.h
+++ b/sys/dev/virtio/fs/virtio_fs.h
@@ -1,7 +1,7 @@
/*
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
*
- * All rights reserved.
+ * Copyright (c) 2024, Emil Tsalapatis <emil@etsalapatis.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/sys/dev/virtio/fs/virtio_fs.c b/sys/dev/virtio/fs/virtio_fs.c
--- a/sys/dev/virtio/fs/virtio_fs.c
+++ b/sys/dev/virtio/fs/virtio_fs.c
@@ -1,7 +1,7 @@
/*
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
*
- * All rights reserved.
+ * Copyright (c) 2024, Emil Tsalapatis <emil@etsalapatis.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -41,6 +41,7 @@
#include <sys/mutex.h>
#include <sys/selinfo.h>
#include <sys/sglist.h>
+#include <sys/sysctl.h>
#include <sys/taskqueue.h>
#include <machine/bus.h>
@@ -53,9 +54,23 @@
#include "virtio_if.h"
#include "virtio_fs_internal.h"
-/* Methods for the vtfs device. */
+SYSCTL_NODE(_dev, OID_AUTO, vtfs, CTLFLAG_RW | CTLFLAG_MPSAFE, 0,
+ "Virtio FS paravirt device");
-struct vtfs_softc;
+bool vtfs_debug = false;
+SYSCTL_BOOL(_dev_vtfs, OID_AUTO, debug, CTLFLAG_RW, &vtfs_debug, false,
+ "vtfs debug logging");
+
+#define VTFS_DEBUG(fmt, ...) \
+ do { \
+ if (vtfs_debug) \
+ printf("(%s:%d) " fmt "\n", __func__, __LINE__, ##__VA_ARGS__); \
+ } while (0)
+
+#define VTFS_ERR(fmt, ...) \
+ do { \
+ printf("[VTFS] (%s:%d) " fmt "\n", __func__, __LINE__, ##__VA_ARGS__); \
+ } while (0)
/* Module-wide device list. */
@@ -294,6 +309,7 @@
vtfs_fini_fsq(&sc->vtfs_fsqs[i]);
free(sc->vtfs_fsqs, M_DEVBUF);
+ sc->vtfs_fsqs = NULL;
}
static int
@@ -547,8 +563,10 @@
error = virtqueue_enqueue(vq, ftick, sg, readable, writable);
}
- if (error != 0)
+ if (error != 0) {
+ FSQ_UNLOCK(fsq);
return (error);
+ }
virtqueue_notify(vq);
diff --git a/sys/dev/virtio/fs/virtio_fs_internal.h b/sys/dev/virtio/fs/virtio_fs_internal.h
--- a/sys/dev/virtio/fs/virtio_fs_internal.h
+++ b/sys/dev/virtio/fs/virtio_fs_internal.h
@@ -5,16 +5,6 @@
#define TAG_SIZE (36)
#define FSQ_NAME_SIZE (16)
-#define VTFS_DEBUG(fmt, ...) \
- do { \
- printf("(%s:%d) " fmt "\n", __func__, __LINE__, ##__VA_ARGS__); \
- } while (0)
-
-#define VTFS_ERR(fmt, ...) \
- do { \
- printf("[ERROR] (%s:%d) " fmt "\n", __func__, __LINE__, ##__VA_ARGS__); \
- } while (0)
-
/* Struct for the file system instance. Provided by the host. */
struct vtfs_config {
/* UTF-8 File system tag. */

File Metadata

Mime Type
text/plain
Expires
Sun, Feb 8, 8:36 PM (12 h, 28 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28495575
Default Alt Text
D46295.id149165.diff (2 KB)

Event Timeline