trace: fix calculation of histories_size

The last lcore_offsets value already marks the total
size of the histories file - we don't need to also
add sizeof(struct spdk_trace_flags).

Note that this only affected the amount of memory that
was mmap'ed.  It did not result in any observable
failure.

Fixes issue #997.

Reported-by: tinnfu (GitHub submitter)
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I70fef16241cf00228bc515678cca1721f440c925

Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/473049
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: tinnfu <tinnfu@gmail.com>
This commit is contained in:
Jim Harris 2019-11-01 10:49:39 -07:00
parent 4036f95bf8
commit 8f8a56af64

View File

@ -91,7 +91,7 @@ spdk_trace_init(const char *shm_name, uint64_t num_entries)
for (i = 1; i < (int)SPDK_COUNTOF(lcore_offsets); i++) {
lcore_offsets[i] = spdk_get_trace_history_size(num_entries) + lcore_offsets[i - 1];
}
histories_size = sizeof(struct spdk_trace_flags) + lcore_offsets[SPDK_TRACE_MAX_LCORE];
histories_size = lcore_offsets[SPDK_TRACE_MAX_LCORE];
snprintf(g_shm_name, sizeof(g_shm_name), "%s", shm_name);