From: Jan Kara <jack@suse.cz>
To: Vincent Fu <vincentfu@gmail.com>
Cc: Jens Axboe <axboe@kernel.dk>,
fio@vger.kernel.org, Jan Kara <jack@suse.cz>,
Damien Le Moal <dlemoal@kernel.org>
Subject: [PATCH v2 2/5] td: Initialize ramp_period_over based on options
Date: Fri, 19 Dec 2025 14:42:36 +0100 [thread overview]
Message-ID: <20251219134247.14195-2-jack@suse.cz> (raw)
In-Reply-To: <20251219133853.8548-1-jack@suse.cz>
Instead of checking whether ramp_time is specified each time we need to
check whether we are in the ramp period, initialize ramp_period_over
based on the ramp_time option. This will simplify things more
significantly later when ramp up period can be defined in a different
way.
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Signed-off-by: Jan Kara <jack@suse.cz>
---
fio_time.h | 1 +
init.c | 2 ++
time.c | 10 ++++++++--
3 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/fio_time.h b/fio_time.h
index 30de7aca4fb1..c67c9450f484 100644
--- a/fio_time.h
+++ b/fio_time.h
@@ -29,6 +29,7 @@ extern void fill_start_time(struct timespec *);
extern void set_genesis_time(void);
extern bool ramp_period_over(struct thread_data *);
extern bool in_ramp_period(struct thread_data *);
+extern void td_ramp_period_init(struct thread_data *);
extern void fio_time_init(void);
extern void timespec_add_msec(struct timespec *, unsigned int);
extern void set_epoch_time(struct thread_data *, clockid_t, clockid_t);
diff --git a/init.c b/init.c
index cf66ac2c51f1..8b7728907c7f 100644
--- a/init.c
+++ b/init.c
@@ -1676,6 +1676,8 @@ static int add_job(struct thread_data *td, const char *jobname, int job_add_num,
init_thread_stat_min_vals(&td->ts);
+ td_ramp_period_init(td);
+
/*
* td->>ddir_seq_nr needs to be initialized to 1, NOT o->ddir_seq_nr,
* so that get_next_offset gets a new random offset the first time it
diff --git a/time.c b/time.c
index 9625e8cd92af..f90f2d9044fc 100644
--- a/time.c
+++ b/time.c
@@ -112,7 +112,7 @@ uint64_t utime_since_genesis(void)
bool in_ramp_period(struct thread_data *td)
{
- return td->o.ramp_time && !td->ramp_period_over;
+ return !td->ramp_period_over;
}
static bool parent_update_ramp(struct thread_data *td)
@@ -130,7 +130,7 @@ static bool parent_update_ramp(struct thread_data *td)
bool ramp_period_over(struct thread_data *td)
{
- if (!td->o.ramp_time || td->ramp_period_over)
+ if (td->ramp_period_over)
return true;
if (utime_since_now(&td->epoch) >= td->o.ramp_time) {
@@ -153,6 +153,12 @@ bool ramp_period_over(struct thread_data *td)
return false;
}
+void td_ramp_period_init(struct thread_data *td)
+{
+ if (!td->o.ramp_time)
+ td->ramp_period_over = true;
+}
+
void fio_time_init(void)
{
int i;
--
2.51.0
next prev parent reply other threads:[~2025-12-19 13:43 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-19 13:42 [PATCH v2 0/5] Add support for specifying ramp up period by amount of IO Jan Kara
2025-12-19 13:42 ` [PATCH v2 1/5] time: rename in_ramp_time() and ramp_time_over() Jan Kara
2025-12-19 13:42 ` Jan Kara [this message]
2025-12-19 13:42 ` [PATCH v2 3/5] eta: Use in_ramp_period() instead of opencoding it Jan Kara
2025-12-19 13:42 ` [PATCH v2 4/5] time: Evaluate ramp up condition once per second Jan Kara
2025-12-19 13:42 ` [PATCH v2 5/5] Add option to specify ramp period by amount of IO Jan Kara
2025-12-24 19:44 ` [PATCH v2 0/5] Add support for specifying ramp up " Vincent Fu
2026-01-07 17:02 ` Jan Kara
2026-01-07 21:26 ` Vincent Fu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251219134247.14195-2-jack@suse.cz \
--to=jack@suse.cz \
--cc=axboe@kernel.dk \
--cc=dlemoal@kernel.org \
--cc=fio@vger.kernel.org \
--cc=vincentfu@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox