From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796177609; b=qOEs2t43iLJug4cJ3zTL8Mt0LcKTfrql55GIupV4YLLj63Qgmm7LExQpyNHHyXi1qj2l TH2wkkOR1S0ahinVD0FvPvR6xAN19qeNdamS3fsueVAZk45qdbHHlr9OBHGE4HD0NEcMO qI5VPAlK/Z+poVfApzJtFnegYaIYTqjNdBCQW0PtF4Jy5oqz1o9b7BVHp5uB34zrUi4+x QaFJ/V+B7iYdDjcP9A2UsRpw00KQlS5Rc6alpKrRILntRfwMAExs8YW+jx0YAevOUvseG gIZb73cJFBxHpCsobFECaMALIsB9tBgLMYxmernk4P4esGqYbDkNLwpt7PHl623i3mg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796177609; h=Received:DKIM-Signature:From:To:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:MIME-Version:Content-Transfer-Encoding; bh=tbsJZfwEKsKIGcyJl9B41bovtgTMea5Egc5GCvxy6FA=; b=SiA3z7qG1o3It114bkTWY9Fq3OWfGcXaBAFLXgqf8IMll9LhN+DyxlpGiacUbxunJvqN eWxPm7kcRjqFe66sEunPP2Wmr9cdxSfmvlFeS6tEyGpsLkPSy4NFK96kxaombE5aqOZw6 o/FCd+q6cuHPpEa1nt3D0OT9Bd3u/wMq3vNDo5nBOe4KLjkun+K0Ch513SVlfZsn74nmz i+HTIiGa7Us0rKV74q8pEb4ot57NQPy3550mQ5rpuQwewR1hwp78UFtLBgqdn/PuKk+qZ hsfCA6fhqcZ//6EJb13H3yKc7qvfpyN/C0mJuvSY+TEYByxA4m/2JYXYSZiMCTcob+w== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=D7ZpuAaH; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D66A3606A31A for ; Wed, 2 Dec 2026 02:13:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=D7ZpuAaH Received: by smtp.kernel.org (Postfix) with ESMTPSA id 40C041F00893; Wed, 2 Dec 2026 02:13:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796177609; bh=tbsJZfwEKsKIGcyJl9B41bovtgTMea5Egc5GCvxy6FA=; h=From:To:Subject:Date:In-Reply-To:References; b=D7ZpuAaH2NXdc5tCAqeF1nrdRCj1xOI8AX6Q8aiHm7zTt4q1eQws99VnukRQiQkn4 /z49PnyMqnP7nFST4stghMl1JYe9NQH06vQFemYASKstRAmoyZYnBzBV2KYppoWM79 LoTv0OTsNEi5r+xT3ZqbQvOR0jUHfkXRRoOpVGJV4VW9LyNxBt5pwrUnoIfAuOuFUq iSGj5mM0GDvwPilH/uQ7jzSGXHL1zkn6VvAyHT5LjbBGvZx43TpkblEVP7FboZ3jn0 XiEDMAqos3SnPAygddG6393jerec/b7iEOOyhz+O4Ij/S8qawfupwo6lPF+O51JXNe EjfEDJyc21tGQ== From: Damien Le Moal To: fio@vger.kernel.org, Vincent Fu , Jens Axboe Subject: [PATCH v2 3/3] iolog: fix iolog_items_to_fetch() Date: Wed, 2 Dec 2026 11:13:24 +0900 Message-ID: <20261202021324.419440-4-dlemoal@kernel.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261202021324.419440-1-dlemoal@kernel.org> References: <20261202021324.419440-1-dlemoal@kernel.org> X-Mailing-List: fio@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit When replaying an iolog with read_iolog_chunked=true, if the iolog describes a workload hat has very low IOPS intervals (IOPS < 1), iolog_items_to_fetch() may return 0 due to the rate calculation it does based on the last time the iolog file was read (td->io_log_highmark_time). This causes read_iolog() to do nothing and the job to end, even if the iolog file is not yet fully replayed. Avoid this by returning the default 10 items (now defined as IOLOG_DEFAULT_ITEMS_TO_FETCH) when the calculation leads to a value that is 0 or less. When the iolog file is fully replayed, read_iolog() will still do nothing and the job ends normally after replaying the entire iolog file. Signed-off-by: Damien Le Moal --- iolog.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/iolog.c b/iolog.c index 288df27f7760..8026d5e87296 100644 --- a/iolog.c +++ b/iolog.c @@ -418,6 +418,8 @@ void write_iolog_close(struct thread_data *td) td->iolog_buf = NULL; } +#define IOLOG_DEFAULT_ITEMS_TO_FETCH 10 + int64_t iolog_items_to_fetch(struct thread_data *td) { struct timespec now; @@ -425,7 +427,7 @@ int64_t iolog_items_to_fetch(struct thread_data *td) int64_t items_rate, items_to_fetch, items_consumed; if (!td->io_log_highmark) - return 10; + return IOLOG_DEFAULT_ITEMS_TO_FETCH; fio_gettime(&now, NULL); elapsed = ntime_since(&td->io_log_highmark_time, &now); @@ -433,8 +435,8 @@ int64_t iolog_items_to_fetch(struct thread_data *td) items_consumed = td->io_log_highmark - td->io_log_current; items_rate = items_consumed * 1000000000LL / elapsed; items_to_fetch = items_rate - td->io_log_current; - if (items_to_fetch < 0) - items_to_fetch = 0; + if (items_to_fetch <= 0) + items_to_fetch = IOLOG_DEFAULT_ITEMS_TO_FETCH; } else { items_to_fetch = 0; } -- 2.56.1