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=1796168286; b=RwxlEXPcSSqN0/QZ7b4uX1lrhV9HHGdMcyiMsR8yS3S0Kei0a3KjUqCOMZGxMjK/cu92 CLqyZgrUgB24DXj/UIW2lfWe0XGCB0Lz3lHyAWZ2whk6Vo3tBq0gDGk+celuU4MzQE26i fjYduYf03EKMmq+eAcagovu1trR2VkLeo23Tojh+ebGjDVUqodoAqi4ZiF25Oq2Q4W8SD NxfW6ZHCGBXTugdHdLC2NY8ph/e9Hz3RO2dEuCEJCRmIj00urvj3FIvxQe/UMLzjWZ9gt awOhR8UlYoL+AcQapgboWUjuUNvois7vaYG5vZ53gexpswKstCMKRj3JtImBpCXjJRg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796168286; h=Received:DKIM-Signature:From:To:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:MIME-Version:Content-Transfer-Encoding; bh=HReml4ZU3kD9TvB6Agp2McwkRmH9qqPCjjPt4IbiGXA=; b=K30nuadrK7SdmJIGc+44K2op/MTYz5JpVOLUo5MAgGfQqabR2xcA9Uuaq1Gx23GGqGcC 1kqML2s885err/F++tzev1eHuLHZjvJy0lJh7kYqIISk3580BNT9RIvcSSK0qS+FIE0SG GeNhviQHgqYznLygJF2+0ZO54jtsmtM/E+x8Ox4SkGAWKueERSGTFKLfLW6XAabg0JdQt sbmRtg2VF6s4T6qaNTDp0S7jCV+a/x3fyamjK1ny8ycolt1BWZbbVG3I+Oss10zVqUdoZ lRiudTeHL+7KUqYLto2W2bvyhPzXH1b7nVJv+DenzwI2ZH7bosZM0Pf1bzbsXvTRzGQ== 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=SesS6bfY; 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 F3EF2606A31A for ; Tue, 1 Dec 2026 23:38:05 +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=SesS6bfY Received: by smtp.kernel.org (Postfix) with ESMTPSA id 214381F00893; Tue, 1 Dec 2026 23:38:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796168285; bh=HReml4ZU3kD9TvB6Agp2McwkRmH9qqPCjjPt4IbiGXA=; h=From:To:Subject:Date:In-Reply-To:References; b=SesS6bfYQ4stt6Fsr1/R7c6c3OZ9lIQSBvOla2issBexPcTDh9UGX6zqC+oZ6CNxx 7Fi2z0f6FcV9JQ0t6AQfoV/8djR7FZZCvSEvuvimouMIKkEg9FxZ/knTQ7Gh1HQ3HV EfBUETXiA7Uk6hIfmFMD19x56+M8iCbrcVDO64/N7lmxQkwMoS+pmHYfiy0lGYbSSm /t0eMGfxkgA60mOTN+oXSu3427BY799cN+sYvlJ7Z8zefg4hg+WSgU6MTGJUzE5x3X 4C/hYLp+ARTkyDZE+oLM5UCzShFujndlCP91XNfnw8kLQuzFWJNGstYc97RfBplghC ku2utegifX8kA== From: Damien Le Moal To: fio@vger.kernel.org, Vincent Fu , Jens Axboe Subject: [PATCH 2/2] iolog: fix iolog_items_to_fetch() Date: Wed, 2 Dec 2026 08:38:01 +0900 Message-ID: <20261201233801.400379-3-dlemoal@kernel.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261201233801.400379-1-dlemoal@kernel.org> References: <20261201233801.400379-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 ithat has very low IOPS intervals (IOPS < 1), iolog_items_to_fetch() may return 0 due to the IOPS 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 defualt 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 end normally after replaying the entire iolog file. Signed-off-by: Damien Le Moal --- iolog.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/iolog.c b/iolog.c index 54fb8283b766..824764bf34a6 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; @@ -426,18 +428,18 @@ int64_t iolog_items_to_fetch(struct thread_data *td) int64_t items_to_fetch; 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); if (elapsed) { for_1s = (td->io_log_highmark - td->io_log_current) * 1000000000 / elapsed; items_to_fetch = for_1s - td->io_log_current; - if (items_to_fetch < 0) - items_to_fetch = 0; - } else + if (items_to_fetch <= 0) + items_to_fetch = IOLOG_DEFAULT_ITEMS_TO_FETCH; + } else { items_to_fetch = 0; + } td->io_log_highmark = td->io_log_current + items_to_fetch; td->io_log_checkmark = (td->io_log_highmark + 1) / 2; -- 2.56.1