summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2025-05-26 10:31:00 -0400
committerTavian Barnes <tavianator@tavianator.com>2025-05-26 10:45:45 -0400
commitf3b8306b3436ed0537558ddb7340534f9e2c42ef (patch)
tree3104c2cad5be54663a1cb9b08312968624449aff
parent89969b4b0bea3bd4cddf97c989ca63f3a1aaa07c (diff)
downloadbfs-f3b8306b3436ed0537558ddb7340534f9e2c42ef.tar.xz
bench/ioq: Don't track the latency of failed requests
This fixes a hang observed with low queue depths like -d32.
-rw-r--r--bench/ioq.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/bench/ioq.c b/bench/ioq.c
index 61c9714..aca97dd 100644
--- a/bench/ioq.c
+++ b/bench/ioq.c
@@ -63,14 +63,8 @@ static void times_init(struct times *times) {
gettime(&times->start);
}
-/** Start timing a single request. */
-static void start_request(struct times *times) {
- gettime(&times->req_start);
- times->timing = true;
-}
-
/** Finish timing a request. */
-static void finish_request(struct times *times) {
+static void track_latency(struct times *times) {
struct timespec elapsed;
gettime(&elapsed);
timespec_sub(&elapsed, &times->req_start);
@@ -127,8 +121,8 @@ static bool push(struct ioq *ioq, enum ioq_nop_type type, struct times *lap) {
// Track latency for a small fraction of requests
if (!lap->timing && (lap->pushed + 1) % 128 == 0) {
- start_request(lap);
ptr = lap;
+ gettime(&lap->req_start);
}
int ret = ioq_nop(ioq, type, ptr);
@@ -138,6 +132,9 @@ static bool push(struct ioq *ioq, enum ioq_nop_type type, struct times *lap) {
}
++lap->pushed;
+ if (ptr) {
+ lap->timing = true;
+ }
return true;
}
@@ -149,7 +146,7 @@ static bool pop(struct ioq *ioq, struct times *lap, bool block) {
}
if (ent->ptr) {
- finish_request(lap);
+ track_latency(lap);
}
ioq_free(ioq, ent);