Re: [PATCH V2 1/2] Btrfs-progs: make pretty_sizes() work less error prone

2013-07-10 Thread David Sterba
On Tue, Jul 09, 2013 at 01:24:43PM -0700, Zach Brown wrote: The original codes don't handle error gracefully and some places forget to free memory. We can allocate memory before calling pretty_sizes(), for example, we can use static memory allocation and we don't have to deal with memory

Re: [PATCH V2 1/2] Btrfs-progs: make pretty_sizes() work less error prone

2013-07-10 Thread Zach Brown
Neat trick! A few neat-picks below. Indeed, those are all good fixes. As these are only trivial changes I'll fix them at commit time. Great, thanks David! - z -- To unsubscribe from this list: send the line unsubscribe linux-btrfs in the body of a message to majord...@vger.kernel.org More

Re: [PATCH V2 1/2] Btrfs-progs: make pretty_sizes() work less error prone

2013-07-09 Thread Zach Brown
The original codes don't handle error gracefully and some places forget to free memory. We can allocate memory before calling pretty_sizes(), for example, we can use static memory allocation and we don't have to deal with memory allocation fails. I agree that callers shouldn't have to know to

Re: [PATCH V2 1/2] Btrfs-progs: make pretty_sizes() work less error prone

2013-07-09 Thread Wang Shilong
Hello, Zach The original codes don't handle error gracefully and some places forget to free memory. We can allocate memory before calling pretty_sizes(), for example, we can use static memory allocation and we don't have to deal with memory allocation fails. I agree that callers shouldn't

[PATCH V2 1/2] Btrfs-progs: make pretty_sizes() work less error prone

2013-07-07 Thread Wang Shilong
From: Wang Shilong wangsl-f...@cn.fujitsu.com In the original code, pretty_sizes() may return NULL in two cases: 1 Allocating memory dynamically fails 2 Overflow happens(size exceeds YB) Since we are limited to 16EB both theoretically and practically due to everything being 64bit, we can just