From b5861a1b4bf523f70fcf572cb4e562f2a7a4489c Mon Sep 17 00:00:00 2001 From: Fabian Keil Date: Thu, 3 Aug 2017 10:42:23 +0200 Subject: [PATCH 217/325] cam_iosched: Use the correct units when logging write limit changes ... for the 'queue_depth' or 'iops' limiter. Previously "kBps" were used unconditionally. Obtained from: ElectroBSD --- sys/cam/cam_iosched.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/sys/cam/cam_iosched.c b/sys/cam/cam_iosched.c index df18d64bc42d..6750c04f2358 100644 --- a/sys/cam/cam_iosched.c +++ b/sys/cam/cam_iosched.c @@ -119,6 +119,9 @@ typedef enum { static const char *cam_iosched_limiter_names[] = { "none", "queue_depth", "iops", "bandwidth" }; +static char *cam_iosched_limiter_units[] = + { "none", "queued ios", "iops", "kBps" }; + /* * Called to initialize the bits of the iop_stats structure relevant to the * limiter. Called just after the limiter is set. @@ -624,6 +627,14 @@ cam_iosched_cl_init(struct control_loop *clp, struct cam_iosched_softc *isc) clp->type = set_max; } +static const char * +cam_iosched_get_limiter_unit_string(enum io_limiter limiter) +{ + + KASSERT(none <= limiter && limiter < limiter_max, "Invalid limiter"); + return cam_iosched_limiter_units[limiter]; +} + static void cam_iosched_cl_maybe_steer(struct control_loop *clp) { @@ -641,8 +652,11 @@ cam_iosched_cl_maybe_steer(struct control_loop *clp) case set_max: if (isc->write_stats.current != isc->write_stats.max && isc->write_stats.limiter != none) { - printf("Steering write from %d kBps to %d kBps\n", - isc->write_stats.current, isc->write_stats.max); + const char *units; + units = cam_iosched_get_limiter_unit_string(isc->write_stats.limiter); + printf("Steering write from %d %s to %d %s\n", + isc->write_stats.current, units, isc->write_stats.max, units); + } isc->read_stats.current = isc->read_stats.max; isc->write_stats.current = isc->write_stats.max; isc->trim_stats.current = isc->trim_stats.max; -- 2.32.0