Merge commit 'refs/top-bases/linux-have-libdiskmgt' into linux-have-libdiskmgt
This commit is contained in:
commit
4bf744b498
|
@ -509,7 +509,7 @@ void
|
||||||
zfs_nicenum(uint64_t num, char *buf, size_t buflen)
|
zfs_nicenum(uint64_t num, char *buf, size_t buflen)
|
||||||
{
|
{
|
||||||
uint64_t n = num;
|
uint64_t n = num;
|
||||||
int i = 0;
|
int i = 0, j;
|
||||||
char u;
|
char u;
|
||||||
|
|
||||||
while (n >= 1024) {
|
while (n >= 1024) {
|
||||||
|
@ -537,10 +537,9 @@ zfs_nicenum(uint64_t num, char *buf, size_t buflen)
|
||||||
* develop some complex heuristics for this, but it's much
|
* develop some complex heuristics for this, but it's much
|
||||||
* easier just to try each combination in turn.
|
* easier just to try each combination in turn.
|
||||||
*/
|
*/
|
||||||
int i;
|
for (j = 2; j >= 0; j--) {
|
||||||
for (i = 2; i >= 0; i--) {
|
if (snprintf(buf, buflen, "%.*f%c", j,
|
||||||
if (snprintf(buf, buflen, "%.*f%c", i,
|
(double)num / (1ULL << 10 * j), u) <= 5)
|
||||||
(double)num / (1ULL << 10 * i), u) <= 5)
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue