This was found by static analysis.
Signed-off-by: Zach Brown <zab@redhat.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
Before I had been dividing by 5 but that gave me too much output so I changed it
to 20 without changing the min seeks test. Fix this to avoid a divide by 0
problem. Thanks,
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
I've been wanting to get back to the allocator and make some changes to try and
fix our fragmenation woes with lots of metadata. But in order to make these
changes I need to have something to tell me if my changes are making a real
measurable difference. So this patch adds a bunch of new statistics to
btrfs-calc-size. It will tell me how long it took to read in the trees, how
many seeks it had (both forward and backward). It will tell me how far spread
out the tree is and spit out a nice histogram of the seeks. Here is some sample
output
Calculating size of extent tree
Total size: 60.74MB
Inline data: 0.00
Total seeks: 5020
Forward seeks: 3691
Backward seeks: 1329
Avg seek len: 929.53MB
Seek histogram
4096 - 4096: 1043 ####
8192 - 73728: 760 ###
81920 - 52527104: 753 ###
53518336 - 168009728: 753 ###
168591360 - 696045568: 753 ###
696238080 - 7560364032: 753 ###
7560437760 - 8409739264: 178 |
Total clusters: 1874
Avg cluster size: 25.17KB
Min cluster size: 8.00KB
Max cluster size: 472.00KB
Total disk spread: 7.90GB
Total read time: 0 s 341670 us
Levels: 4
This way we can have good numbers to back up any changes we make to the
allocator. Thanks,
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
Remove unused eb parameter from btrfs_item_nr, unused since introduced
in 7777e63b42
Signed-off-by: Ross Kirk <ross.kirk@gmail.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
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 <zab@redhat.com>
Acked-by: Wang Shilong <wangs.fnst@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
For any btrfs-$FOO executable, rename the main source file from
$FOO.c to to btrfs-$FOO.c
This makes it slightly more obvious what's building what,
and allows us to write a default rule in the Makefile for
these tools.
(also add btrfs-calc-size to the list of objects to remove
on make clean)
Signed-off-by: Eric Sandeen <sandeen@redhat.com>