stat: remove duplicated code in show_mixed_ddir_status()
authorNiklas Cassel <niklas.cassel@wdc.com>
Mon, 17 Jan 2022 15:50:53 +0000 (15:50 +0000)
committerJens Axboe <axboe@kernel.dk>
Mon, 17 Jan 2022 23:21:36 +0000 (16:21 -0700)
commit53d966f8177e0ada3bf52930f75f7b30817ea8c2
tree26539f2e1f6a0e087656b51c6eae04d5b8d1ef28
parentef37053efdfb8c3b8b6deef43c0969753e6adb44
stat: remove duplicated code in show_mixed_ddir_status()

When using unified_rw_reporting=mixed, show_ddir_status() is called,
and is solely responsible for printing the mixed stats.

When using unified_rw_reporting=both, show_ddir_status() is called
and prints the regular output, after that, show_mixed_ddir_status()
is called to print the mixed stats.

The way that show_mixed_ddir_status_terse() and
add_mixed_ddir_status_json() is implemented, is to alloc a new local ts
that will hold the mixed result, and then simply call the regular non-mixed
print function show_ddir_status_terse()/add_ddir_status_json() with this
local ts.

show_mixed_ddir_status() also allocates a new local ts, but fails to
initialize the lat percentiles and the percentile_list in the new local ts.
Therefore, show_mixed_ddir_status() has duplicated all the code from
show_ddir_status(), except that it uses the lat percentiles and the
percentile_list from the original ts.

Simplify show_mixed_ddir_status(), to behave in the same way as
show_mixed_ddir_status_terse() and add_mixed_ddir_status_json().

In other words, initialize the lat percentiles and the percentile_list in
the new local ts, and replace all the duplicated code with a simple call to
the regular non-mixed print function (show_ddir_status()).

Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Link: https://lore.kernel.org/r/20220117155045.311453-2-Niklas.Cassel@wdc.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
stat.c