Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

common/types: make numbers a bit nicer when displaying space usage #17126

Merged
merged 1 commit into from Aug 25, 2017

Conversation

Projects
None yet
4 participants
@xiexingguo
Copy link
Member

commented Aug 22, 2017

Was:

----------------------------------------------------------------------------
GLOBAL:
    SIZE       AVAIL      RAW USED     %RAW USED
    30911M     27050M        3861M         12.49
POOLS:
    NAME                  ID     USED        %USED     MAX AVAIL     OBJECTS
    rbd                   0      101216k      1.10         8913M        1178
    cephfs_data_a         1            0         0         8913M           0
    cephfs_metadata_a     2          892         0         8913M          21
----------------------------------------------------------------------------

Now:

----------------------------------------------------------------------------
GLOBAL:
    SIZE      AVAIL     RAW USED     %RAW USED
    30.2G     26.4G        3.77G         12.50
POOLS:
    NAME                  ID     USED      %USED     MAX AVAIL     OBJECTS
    rbd                   0      99.2M      1.10         8.70G        1180
    cephfs_data_a         1          0         0         8.70G           0
    cephfs_metadata_a     2        892         0         8.70G          21
----------------------------------------------------------------------------

Signed-off-by: xie xingguo xie.xingguo@zte.com.cn

@xiexingguo

This comment has been minimized.

Copy link
Member Author

commented Aug 22, 2017

replace #15215 with various QA fixes

char buffer[32];
uint64_t n = b.v;
int index = 0;
char u;

This comment has been minimized.

Copy link
@tchaikov

tchaikov Aug 22, 2017

Contributor

nit, move the definition of u to where it is used for the first time.

u = " KMGTPE"[index];

if (index == 0) {
(void) snprintf(buffer, sizeof(buffer), "%llu", (unsigned long long)n);

This comment has been minimized.

Copy link
@tchaikov

tchaikov Aug 22, 2017

Contributor

better off using

(void)snprintf(buffer, sizeof(buffer), "%" PRId64, n);
(void) snprintf(buffer, sizeof(buffer), "%llu", (unsigned long long)n);
} else if ((b.v & ((1ULL << 10 * index) - 1)) == 0) {
// If this is an even multiple of the base, always display
// without any decimal precision.

This comment has been minimized.

Copy link
@tchaikov

tchaikov Aug 22, 2017

Contributor

s/decimal precision/fraction/

@xiexingguo xiexingguo force-pushed the xiexingguo:wip-nicenum branch from 84bddd1 to 1ea448a Aug 22, 2017

common/types: make numbers a bit nicer when displaying space usage
Was:
----------------------------------------------------------------------------
GLOBAL:
    SIZE       AVAIL      RAW USED     %RAW USED
    30911M     27050M        3861M         12.49
POOLS:
    NAME                  ID     USED        %USED     MAX AVAIL     OBJECTS
    rbd                   0      101216k      1.10         8913M        1178
    cephfs_data_a         1            0         0         8913M           0
    cephfs_metadata_a     2          892         0         8913M          21
----------------------------------------------------------------------------

Now:
----------------------------------------------------------------------------
GLOBAL:
    SIZE      AVAIL     RAW USED     %RAW USED
    30.2G     26.4G        3.77G         12.50
POOLS:
    NAME                  ID     USED      %USED     MAX AVAIL     OBJECTS
    rbd                   0      99.2M      1.10         8.70G        1180
    cephfs_data_a         1          0         0         8.70G           0
    cephfs_metadata_a     2        892         0         8.70G          21
----------------------------------------------------------------------------

Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>

@xiexingguo xiexingguo requested a review from liewegas Aug 23, 2017

@liewegas liewegas added the needs-qa label Aug 24, 2017

@liewegas

This comment has been minimized.

Copy link
Member

commented Aug 24, 2017

Yes!

@liewegas liewegas merged commit 5db94f4 into ceph:master Aug 25, 2017

5 checks passed

Docs: build check OK - docs built
Details
Signed-off-by all commits in this PR are signed
Details
Unmodified Submodules submodules for project are unmodified
Details
make check make check succeeded
Details
make check (arm64) make check succeeded
Details

@xiexingguo xiexingguo deleted the xiexingguo:wip-nicenum branch Aug 26, 2017

@dillaman

This comment has been minimized.

Copy link
Contributor

commented Aug 30, 2017

This appears to have broken upgrade tests that relied on specific CLI output

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.