Init file_cache to invalid (maj, min)
authorLuis Useche <useche@google.com>
Wed, 15 Jun 2022 22:44:54 +0000 (15:44 -0700)
committerLuis Useche <useche@google.com>
Thu, 16 Jun 2022 00:02:01 +0000 (17:02 -0700)
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 <useche@gmail.com>
blktrace.c

index 619121c704a90f198585293d976dffbe1984ca30..00e5f9a9b7d2b621b80bc50008b1b8f391f6ee76 100644 (file)
@@ -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;