From 876e3f9380d373ba76f9b6d4c08ff84327956abf Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Tue, 9 Jul 2013 13:24:43 -0700 Subject: btrfs-progs: per-thread, per-call pretty buffer We don't need callers to manage string storage for each pretty_sizes() call. We can use a macro to have per-thread and per-call static storage so that pretty_sizes() can be used as many times as needed in printf() arguments without requiring a bunch of supporting variables. This lets us have a natural interface at the cost of requiring __thread and TLS from gcc and a small amount of static storage. This seems better than the current code or doing something with illegible format specifier macros. Signed-off-by: Zach Brown Acked-by: Wang Shilong Signed-off-by: David Sterba Signed-off-by: Chris Mason --- btrfs-fragments.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'btrfs-fragments.c') diff --git a/btrfs-fragments.c b/btrfs-fragments.c index a012fe1b..7ec77e78 100644 --- a/btrfs-fragments.c +++ b/btrfs-fragments.c @@ -87,7 +87,7 @@ print_bg(FILE *html, char *name, u64 start, u64 len, u64 used, u64 flags, fprintf(html, "

%s chunk starts at %lld, size is %s, %.2f%% used, " "%.2f%% fragmented

\n", chunk_type(flags), start, - pretty_sizes(len), 100.0 * used / len, 100.0 * frag); + pretty_size(len), 100.0 * used / len, 100.0 * frag); fprintf(html, "\n", name); } -- cgit v1.2.1