From 2fe71558c9718e88f6a1f243f2de0560e0c44aa0 Mon Sep 17 00:00:00 2001 From: Luis Useche Date: Wed, 15 Jun 2022 15:44:54 -0700 Subject: [PATCH] Init file_cache to invalid (maj, min) In the very unlikely case that the trace was taken from a device with major and minor zeroes, the cache will wrongly hit the first time. We are hitting this problem when trying to replay generated traces with major and minor zeroes. Initializing with ~0U fixes this problem. Signed-off-by: Luis Useche --- blktrace.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/blktrace.c b/blktrace.c index 619121c7..00e5f9a9 100644 --- a/blktrace.c +++ b/blktrace.c @@ -442,7 +442,10 @@ err: bool read_blktrace(struct thread_data* td) { struct blk_io_trace t; - struct file_cache cache = { }; + struct file_cache cache = { + .maj = ~0U, + .min = ~0U, + }; unsigned long ios[DDIR_RWDIR_SYNC_CNT] = { }; unsigned long long rw_bs[DDIR_RWDIR_CNT] = { }; unsigned long skipped_writes; -- 2.25.1