summaryrefslogtreecommitdiff
path: root/cmds-fi-usage.c
Commit message (Collapse)AuthorAge
* btrfs-progs: fi usage: improved error handling in load_device_infoDavid Sterba2016-09-21
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: do not set optind if not necessaryDavid Sterba2016-07-13
| | | | | | | In the subcommand callbacks that are called just once, we don't need to explicitly reset optind. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: device usage: report slack spaceDavid Sterba2016-06-01
| | | | | | | | | The total filesystem space on a given device might be smaller than the device size. We should report that space as well. The original idea was to report the 'occupied' size but the term was not all clear, so the logic was reversed to report the slack space. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: typo review of strings and commentsNicholas D Steeves2016-06-01
| | | | | Signed-off-by: Nicholas D Steeves <nsteeves@gmail.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: use ioctl search headers everywhereDavid Sterba2016-05-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Generated by following semantic patch and manually tweaked. <SmPL> @@ struct btrfs_ioctl_search_header *SH; @@ ( - SH->objectid + btrfs_search_header_objectid(SH) | - SH->offset + btrfs_search_header_offset(SH) | - SH->transid + btrfs_search_header_transid(SH) | - SH->len + btrfs_search_header_len(SH) | - SH->type + btrfs_search_header_type(SH) ) </SmPL> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=112131 Reported-and-tested-by: Anatoly Pugachev <matorola@gmail.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: fi usage: support mixed blockgroupsDavid Sterba2016-01-13
| | | | | | | | Properly account the duplicated block groups and global reserve. Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=110111 Reported-by: Chris Murphy <bugzilla@colorremedies.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-porgs: fi usage: rename variable to avoid shadowingDavid Sterba2016-01-12
| | | | | | Reported by gcc -Wshadow . Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: check for negative return value from ioctlDavid Sterba2016-01-12
| | | | | | | Handle only negative values returned by ioctl syscalls, with exception of the device remove. It returns positive values that are handled later. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: remove unnecessary errno temp variablesDavid Sterba2016-01-12
| | | | | | | We can read errno directly if it's not clobbered by any intermediate calls. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: cmd fi usage: switch to common error message wrapperDavid Sterba2016-01-12
| | | | | | Message texts were adjusted. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: use NULL instead of 0Byongho Lee2016-01-12
| | | | | | | Fix the code assigning 0 to pointer instead of NULL. Signed-off-by: Byongho Lee <bhlee.kernel@gmail.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: utils: rename helpinfo unit vairablesDavid Sterba2015-11-06
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: fi usage: print header and footer separation lineDavid Sterba2015-11-03
| | | | | | | Print the full row width and change to '-' as we're not using '=' anywhere. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: string table: add specifier for fillup charDavid Sterba2015-11-03
| | | | | | | Currently it's one by a single "=", but we might want to use a different filler, let's make it explicit by "*". Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: fi usage: print device id column in the tabular output<F2>David Sterba2015-11-03
| | | | | | | | | | | | | | | Example output: Data Metadata System Id Path single RAID1 RAID1 Unallocated 1 /dev/sdc2 44.94GiB 7.93GiB 32.00MiB 1.00GiB 2 /dev/sde1 44.94GiB 7.93GiB 32.00MiB 1.00GiB ======== ======== ======== =========== Total 89.88GiB 7.93GiB 32.00MiB 2.00GiB Used 74.28GiB 4.44GiB 20.00KiB Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: fi usage: cleanup, replace space info starting column constantDavid Sterba2015-11-03
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: fi usage: cleanup, replace header constantDavid Sterba2015-11-03
| | | | | | | The size of the header is not obvious, let's make it more visible by replacing it with a varaible. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: fi usage: properly count real space infosDavid Sterba2015-11-03
| | | | | | | | We did not account the column for path but abused the skipped global block reserve colum instead. Properly count the real infos and manually added headers. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: fi usage: print path header in the tabular modeDavid Sterba2015-11-02
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: fi usage: cleanup, print header in one goDavid Sterba2015-11-02
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: fi usage: do not print global block reserveDavid Sterba2015-11-02
| | | | | | | Global block reserve is inherently part of metadata and should not be listed separately in the output of 'fi usage' in the tabular output. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: filesystem: use btrfs_open_dir for btrfs filesystem commandZhao Lei2015-11-02
| | | | | | | | | | | | | | | | | | | | | | We can use btrfs_open_dir() to check whether target dir is in btrfs's mount point before open, instead of checking it in kernel space of ioctl, and return fuzzy error message. Before patch: # (/mnt/tmp is not btrfs mountpoint) # # btrfs filesystem df /mnt/tmp ERROR: couldn't get space info - Inappropriate ioctl for device ERROR: get_df failed Inappropriate ioctl for device # After patch: # ./btrfs filesystem df /mnt/tmp ERROR: not btrfs filesystem: /mnt/tmp # Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: fix error checking in load_device_infoDavid Sterba2015-10-02
| | | | | | | | | | | load_device_info queries the FS_INFO ioctl and this may fail with EPERM on older kernels. The check did not verify the ioctl return value and incorrectly returned EPERM if it was previously stored in errno. This fixes 'btrfs fi usage' that will print the overall summary for all users (provided that the FS_INFO ioctl is already unprivileged). Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: Use common unit parser for btrfs filesystem commandZhao Lei2015-09-01
| | | | | | | | | | Move to use get_unit_mode_from_arg() for cmds-filesystem.c, to make "btrfs filesystem df/show/usage"'s unit argument same. Also have cleanup effect: 19 insertions(+), 181 deletions(-) Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: cleanup, rename *disk_usage* files to usageDavid Sterba2015-04-22
Signed-off-by: David Sterba <dsterba@suse.cz>