From e6860fb3ba7a892912ad523bd4623b45da10ab29 Mon Sep 17 00:00:00 2001 From: Olaf Faaland Date: Mon, 17 Sep 2018 12:32:21 -0700 Subject: [PATCH] In ltop ensure MDT and OST windows have 3 rows If there is room for ltop to display individual MDTs and OSTs, always give each of those windows at least 3 rows - 1 for the header and 2 for the targets or servers. Fixes a bug on servers with more MDTs than OSTs, where the OST window might be given only 1 row, which would display the header, and have no room to show targets. --- utils/ltop.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/utils/ltop.c b/utils/ltop.c index 93e3c84..07547e8 100644 --- a/utils/ltop.c +++ b/utils/ltop.c @@ -319,12 +319,17 @@ size_windows(int total_size, int mdts, int osts, } else { int detail_size = total_size - TOPWIN_LINES; /* - * OST and MDT section sizes proportional to target counts, + * OST and MDT window sizes proportional to target counts, * except that we allow space for at least 2 MDTs since we know * there is more than one MDT. */ *mdtlines = 2 + ((float)detail_size*mdts) / ((float)mdts+osts); + + /* + * Make sure both MDT and OST windows have at least 2 rows. + */ *mdtlines = (*mdtlines < 3 ? 3 : *mdtlines); + *mdtlines = ((detail_size - *mdtlines) < 3 ? (detail_size - 3) : *mdtlines); *mdtlines = (*mdtlines > (mdts+2) ? (mdts+2) : *mdtlines); } }