From 67379ba4a842b8cad6077c33752ff1783235d155 Mon Sep 17 00:00:00 2001 From: Vincent Fu Date: Mon, 31 Mar 2025 10:01:31 -0400 Subject: [PATCH] verify/trim: stop issuing trims if we run out If we have drained the list of trim operations but its original contents were fewer than a full batch we should zero out the running batch count to make sure that we issue another full set of trim_backlog write operations before considering trims again. Otherwise we will immediately trim after each subsequent write operation until we have met the batch size requirement. Signed-off-by: Vincent Fu --- io_u.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/io_u.c b/io_u.c index f7824717..66cfa16a 100644 --- a/io_u.c +++ b/io_u.c @@ -1749,13 +1749,17 @@ static bool check_get_trim(struct thread_data *td, struct io_u *io_u) { if (!(td->flags & TD_F_TRIM_BACKLOG)) return false; - if (!td->trim_entries) + if (!td->trim_entries) { + td->trim_batch = 0; return false; + } if (td->trim_batch) { td->trim_batch--; if (get_next_trim(td, io_u)) return true; + else + td->trim_batch = 0; } else if (!(td->io_hist_len % td->o.trim_backlog) && td->last_ddir_completed != DDIR_READ) { td->trim_batch = td->o.trim_batch; -- 2.25.1