summaryrefslogtreecommitdiffstats
path: root/src/ioq.h
diff options
context:
space:
mode:
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