Skip to content

Commit

Permalink
In ltop ensure MDT and OST windows have 3 rows
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ofaaland committed Sep 17, 2018
1 parent f780089 commit e6860fb
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion utils/ltop.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down

0 comments on commit e6860fb

Please sign in to comment.