summaryrefslogtreecommitdiffstats
path: root/src/ioq.h
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2024-11-27 20:10:19 -0500
committerTavian Barnes <tavianator@tavianator.com>2024-12-02 16:39:16 -0500
commit35c7c72601cee9692846de13117411d80b3d13f6 (patch)
treec111329c85ef972e536d32d1ff0c00f5f0990142 /src/ioq.h
parentbac8214e90488fd562d29f6fea18ae75ecd9029e (diff)
downloadbfs-35c7c72601cee9692846de13117411d80b3d13f6.tar.xz
ioq: Add an ioq_nop() operation for benchmarking
Diffstat (limited to 'src/ioq.h')
-rw-r--r--src/ioq.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/ioq.h b/src/ioq.h
index cb14be4..fce1d7f 100644
--- a/src/ioq.h
+++ b/src/ioq.h
@@ -22,6 +22,8 @@ struct ioq;
* I/O queue operations.
*/
enum ioq_op {
+ /** ioq_nop(). */
+ IOQ_NOP,
/** ioq_close(). */
IOQ_CLOSE,
/** ioq_opendir(). */
@@ -33,6 +35,16 @@ enum ioq_op {
};
/**
+ * ioq_nop() types.
+ */
+enum ioq_nop_type {
+ /** A lightweight nop that avoids syscalls. */
+ IOQ_NOP_LIGHT,
+ /** A heavyweight nop that involves a syscall. */
+ IOQ_NOP_HEAVY,
+};
+
+/**
* The I/O queue implementation needs two tag bits in each pointer to a struct
* ioq_ent, so we need to ensure at least 4-byte alignment. The natural
* alignment is enough on most architectures, but not m68k, so over-align it.
@@ -54,6 +66,10 @@ struct ioq_ent {
/** Operation-specific arguments. */
union {
+ /** ioq_nop() args. */
+ struct ioq_nop {
+ enum ioq_nop_type type;
+ } nop;
/** ioq_close() args. */
struct ioq_close {
int fd;
@@ -98,6 +114,20 @@ struct ioq *ioq_create(size_t depth, size_t nthreads);
size_t ioq_capacity(const struct ioq *ioq);
/**
+ * A no-op, for benchmarking.
+ *
+ * @ioq
+ * The I/O queue.
+ * @type
+ * The type of operation to perform.
+ * @ptr
+ * An arbitrary pointer to associate with the request.
+ * @return
+ * 0 on success, or -1 on failure.
+ */
+int ioq_nop(struct ioq *ioq, enum ioq_nop_type type, void *ptr);
+
+/**
* Asynchronous close().
*
* @ioq