Skip to content

Commit cbf4bf4

Browse files
committed
eta: add cache invalidation status
Signed-off-by: Sitsofe Wheeler <sitsofe@yahoo.com>
1 parent 9bc59a6 commit cbf4bf4

9 files changed

Lines changed: 23 additions & 2 deletions

File tree

HOWTO.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4712,6 +4712,8 @@ forth. The possible values (in typical life cycle order) are:
47124712
+------+-----+-----------------------------------------------------------+
47134713
| | p | Thread running pre-reading file(s). |
47144714
+------+-----+-----------------------------------------------------------+
4715+
| | # | Thread is invalidating the buffer/page cache of a file. |
4716+
+------+-----+-----------------------------------------------------------+
47154717
| | / | Thread is in ramp period. |
47164718
+------+-----+-----------------------------------------------------------+
47174719
| | R | Running, doing sequential reads. |

client.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1299,6 +1299,7 @@ static void convert_jobs_eta(struct jobs_eta *je)
12991299
int i;
13001300

13011301
je->nr_running = le32_to_cpu(je->nr_running);
1302+
je->nr_invalidating = le32_to_cpu(je->nr_invalidating);
13021303
je->nr_ramp = le32_to_cpu(je->nr_ramp);
13031304
je->nr_pending = le32_to_cpu(je->nr_pending);
13041305
je->nr_setting_up = le32_to_cpu(je->nr_setting_up);

eta.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,9 @@ static void check_str_update(struct thread_data *td)
9090
c = 'D';
9191
}
9292
break;
93+
case TD_INVALIDATING_CACHE:
94+
c = '#';
95+
break;
9396
case TD_PRE_READING:
9497
c = 'p';
9598
break;
@@ -464,6 +467,9 @@ static bool calc_thread_status(struct jobs_eta *je, int force)
464467
}
465468

466469
je->files_open += td->nr_open_files;
470+
} else if (td->runstate == TD_INVALIDATING_CACHE) {
471+
je->nr_running++;
472+
je->nr_invalidating++;
467473
} else if (td->runstate == TD_RAMP) {
468474
je->nr_running++;
469475
je->nr_ramp++;
@@ -645,7 +651,8 @@ void display_thread_status(struct jobs_eta *je)
645651
int ddir;
646652
int linelen;
647653

648-
if ((!je->eta_sec && !eta_good) || je->nr_ramp == je->nr_running ||
654+
if ((!je->eta_sec && !eta_good) ||
655+
je->nr_ramp + je->nr_invalidating == je->nr_running ||
649656
je->eta_sec == -1)
650657
strcpy(perc_str, "-.-%");
651658
else {

filesetup.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -574,6 +574,7 @@ static int __file_invalidate_cache(struct thread_data *td, struct fio_file *f,
574574
unsigned long long len)
575575
{
576576
int errval = 0, ret = 0;
577+
int old_state;
577578

578579
#ifdef CONFIG_ESX
579580
return 0;
@@ -587,6 +588,7 @@ static int __file_invalidate_cache(struct thread_data *td, struct fio_file *f,
587588
if (len == -1ULL || off == -1ULL)
588589
return 0;
589590

591+
old_state = td_bump_runstate(td, TD_INVALIDATING_CACHE);
590592
if (td->io_ops->invalidate) {
591593
dprint(FD_IO, "invalidate %s cache %s\n", td->io_ops->name,
592594
f->file_name);
@@ -640,6 +642,7 @@ static int __file_invalidate_cache(struct thread_data *td, struct fio_file *f,
640642
log_info("fio: cache invalidation of %s failed: %s\n",
641643
f->file_name, strerror(errval));
642644

645+
td_restore_runstate(td, old_state);
643646
return 0;
644647

645648
}

fio.1

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4352,6 +4352,9 @@ Thread initialized, waiting or generating necessary data.
43524352
.B p
43534353
Thread running pre-reading file(s).
43544354
.TP
4355+
.B #
4356+
Thread is invalidating the buffer/page cache of a file.
4357+
.TP
43554358
.B /
43564359
Thread is in ramp period.
43574360
.TP

fio.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -716,6 +716,7 @@ enum {
716716
TD_RAMP,
717717
TD_SETTING_UP,
718718
TD_RUNNING,
719+
TD_INVALIDATING_CACHE,
719720
TD_PRE_READING,
720721
TD_VERIFYING,
721722
TD_FSYNCING,

libfio.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ static const char *td_runstates[] = {
199199
"RAMP",
200200
"SETTING_UP",
201201
"RUNNING",
202+
"INVALIDATING_CACHE",
202203
"PRE_READING",
203204
"VERIFYING",
204205
"FSYNCING",
@@ -209,7 +210,7 @@ static const char *td_runstates[] = {
209210

210211
const char *runstate_to_name(int runstate)
211212
{
212-
compiletime_assert(TD_LAST == 12, "td runstate list");
213+
compiletime_assert(TD_LAST == 13, "td runstate list");
213214
if (runstate >= 0 && runstate < TD_LAST)
214215
return td_runstates[runstate];
215216

server.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1044,6 +1044,7 @@ static int handle_send_eta_cmd(struct fio_net_cmd *cmd)
10441044
je = calloc(1, size);
10451045
} else {
10461046
je->nr_running = cpu_to_le32(je->nr_running);
1047+
je->nr_invalidating = cpu_to_le32(je->nr_invalidating);
10471048
je->nr_ramp = cpu_to_le32(je->nr_ramp);
10481049
je->nr_pending = cpu_to_le32(je->nr_pending);
10491050
je->nr_setting_up = cpu_to_le32(je->nr_setting_up);

stat.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,10 +299,12 @@ struct thread_stat {
299299

300300
#define JOBS_ETA { \
301301
uint32_t nr_running; \
302+
uint32_t nr_invalidating; \
302303
uint32_t nr_ramp; \
303304
\
304305
uint32_t nr_pending; \
305306
uint32_t nr_setting_up; \
307+
uint32_t pad3; \
306308
\
307309
uint64_t m_rate[DDIR_RWDIR_CNT]; \
308310
uint64_t t_rate[DDIR_RWDIR_CNT]; \

0 commit comments

Comments
 (0)