summaryrefslogtreecommitdiffstats
path: root/src/ioq.h
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2024-11-25 15:24:16 -0500
committerTavian Barnes <tavianator@tavianator.com>2024-12-03 14:42:05 -0500
commitcf197cada461d1d442458cbebdd2bb8ba314692e (patch)
tree6f7f2a94231abdc6b9944de9d737b256293b5c5b /src/ioq.h
parent3678c2ee7c11d67f4ea97c85d8564cd386a32bd1 (diff)
downloadbfs-cf197cada461d1d442458cbebdd2bb8ba314692e.tar.xz
ioq: Prefetch pointers before popping them
Also, cache-align struct ioq_ent to avoid false sharing when two workers are handling neighbouring requests.
Diffstat (limited to 'src/ioq.h')
-rw-r--r--src/ioq.h10
1 files changed, 2 insertions, 8 deletions
diff --git a/src/ioq.h b/src/ioq.h
index fce1d7f..da0a525 100644
--- a/src/ioq.h
+++ b/src/ioq.h
@@ -8,6 +8,7 @@
#ifndef BFS_IOQ_H
#define BFS_IOQ_H
+#include "bfs.h"
#include "dir.h"
#include "stat.h"
@@ -45,18 +46,11 @@ enum ioq_nop_type {
};
/**
- * 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.
- */
-#define IOQ_ENT_ALIGN alignas(4)
-
-/**
* An I/O queue entry.
*/
struct ioq_ent {
/** The I/O operation. */
- IOQ_ENT_ALIGN enum ioq_op op;
+ cache_align enum ioq_op op;
/** The return value (on success) or negative error code (on failure). */
int result;