Commit Graph

11 Commits (65ac3b27586e6733191f941480f9348963dab9a9)

Author SHA1 Message Date
David Sterba 07ce7005fc btrfs-progs: unify header file inclusion protections
There are missing ifdefs or defines with very generic names.

Signed-off-by: David Sterba <dsterba@suse.cz>
2015-01-21 17:49:26 +01:00
David Sterba 182f41909f btrfs-progs: unify unit mode parameters and variables
Use unsigned type and a common name everywhere.

Signed-off-by: David Sterba <dsterba@suse.cz>
2014-12-18 15:24:45 +01:00
David Sterba 4ed59c256a btrfs-progs: replace df_pretty_sizes with pretty_size_mode
Signed-off-by: David Sterba <dsterba@suse.cz>
2014-12-04 16:48:11 +01:00
David Sterba 0c67867530 btrfs-progs: cleanup filesystem/device usage code
The main point of this is to load the device and chunk infos at one
place and pass down to the printers. The EPERM is handled separately, in
case kernel does not give us all the information about chunks or
devices, but we want to warn and print at least something.

For non-root users, 'filesystem usage' prints only the overall stats and
warns about RAID5/6.

The sole cleanup changes affect mostly the modified code and the related
functions, should be reasonably small.

Signed-off-by: David Sterba <dsterba@suse.cz>
2014-12-04 16:48:11 +01:00
David Sterba da28664bf7 btrfs-progs: compare unallocated space against the correct value
The device may not be fully occupied by the filesystem, the value of
Unallocated should not be calculated against the device size but the
size provided by DEV_INFO.

Signed-off-by: David Sterba <dsterba@suse.cz>
2014-12-04 16:48:11 +01:00
David Sterba c7b5293d8d btrfs-progs: Print more info about device sizes
The entire device size may not be available to the filesystem, eg. if
it's modified via resize. Print this information if it can be obtained
from the DEV_INFO ioctl.

Print the device ID on the same line as the device name and move size to
the next line.

Sample:
/dev/sda7, ID: 3
   Device size:            10.00GiB
   FS occupied:             5.00GiB
   Data,RAID10:           512.00MiB
   Metadata,RAID10:       512.00MiB
   System,RAID10:           4.00MiB
   Unallocated:             9.00GiB

Signed-off-by: David Sterba <dsterba@suse.cz>
2014-12-04 16:48:11 +01:00
David Sterba f4e73c060d btrfs-progs: move device usage to cmds-device, more cleanups
Move the command definitions where they belong, keep common 'usage'
functions in cmds-fi-disk_usage.c and add exports.

Rename structures containing 'disk' to 'device'.

Fix whitespace in the modified code.

Signed-off-by: David Sterba <dsterba@suse.cz>
2014-12-04 16:48:10 +01:00
David Sterba 84bd55c9cf btrfs-progs: add original 'df' and rename 'disk_usage' to 'usage'
Add back the original output of the 'btrfs fi df' command for backward
compatibility. The rich output is moved from 'disk_usage' to 'usage'.

Agreed in http://www.spinics.net/lists/linux-btrfs/msg31698.html

Signed-off-by: David Sterba <dsterba@suse.cz>
2014-12-04 16:48:10 +01:00
Goffredo Baroncelli 330903d4ee btrfs-progs: Add btrfs device disk-usage command
Signed-off-by: Goffredo Baroncelli <kreijack@inwind.it>
Signed-off-by: David Sterba <dsterba@suse.cz>
2014-12-04 16:48:09 +01:00
Goffredo Baroncelli 9002666a2b btrfs-progs: Add command btrfs filesystem disk-usage
Signed-off-by: Goffredo Baroncelli <kreijack@inwind.it>
Signed-off-by: David Sterba <dsterba@suse.cz>
2014-12-04 16:48:09 +01:00
Goffredo Baroncelli e12e91e859 btrfs-progs: Enhance the command btrfs filesystem df
Enhance the command "btrfs filesystem df" to show space usage information
for a mount point(s). It shows also an estimation of the space available,
on the basis of the current one used.

Signed-off-by: Goffredo Baroncelli <kreijack@inwind.it>
[code moved under #if 0 instead of deletion]
Signed-off-by: David Sterba <dsterba@suse.cz>
2014-12-04 16:48:09 +01:00