summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAge
...
* btrfs-progs: move global reserve to overall summaryDavid Sterba2014-12-04
| | | | | | | | | | | | | | | | | It looks confusing among the chunks, it is not in fact a chunk type. Sample: Overall: Device size: 35.00GiB Device allocated: 8.07GiB Device unallocated: 26.93GiB Used: 1.12MiB Free (Estimated): 17.57GiB (Max: 30.98GiB, min: 17.52GiB) Data to device ratio: 50 % Global reserve: 16.00MiB (used: 0.00B) ... Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: clean up return codes and pathsDavid Sterba2014-12-04
| | | | | | Use the common patterns with one return statement at the end, pass down error Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: replace df_pretty_sizes with pretty_size_modeDavid Sterba2014-12-04
| | | | Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: cleanup filesystem/device usage codeDavid Sterba2014-12-04
| | | | | | | | | | | | | | | 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>
* btrfs-progs: add section of overall filesystem usageDavid Sterba2014-12-04
| | | | | | | | | | | | | | | | | The 'fi usage' lacks an overall report, this used to be in the enhanced df command. Add it back. Sample: Overall: Device size: 35.00GiB Device allocated: 8.07GiB Device unallocated: 26.93GiB Used: 1.12MiB Free (Estimated): 17.57GiB (Max: 30.98GiB, min: 17.52GiB) Data to device ratio: 50 % ... Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: compare unallocated space against the correct valueDavid Sterba2014-12-04
| | | | | | | | 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>
* btrfs-progs: Print more info about device sizesDavid Sterba2014-12-04
| | | | | | | | | | | | | | | | | | | | 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>
* btrfs-progs: zero out structures before calling ioctlDavid Sterba2014-12-04
| | | | Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: check if we can't get info from ioctls due to permissionsDavid Sterba2014-12-04
| | | | | | | The TREE_SEARCH ioctl is root-only, FS_INFO will be available for non-root users with an updated kernel, let the user know. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: move device usage to cmds-device, more cleanupsDavid Sterba2014-12-04
| | | | | | | | | | | 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>
* btrfs-progs: add original 'df' and rename 'disk_usage' to 'usage'David Sterba2014-12-04
| | | | | | | | | 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>
* Btrfs-progs: fi usage: free memory if realloc failsRakesh Pandit2014-12-04
| | | | | | | | | Lets not assign *info_ptr to 0 before calling free on it and lose track of already allocated memory if realloc fails in add_info_to_list. Lets call free first. Signed-off-by: Rakesh Pandit <rakesh@tuxera.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: Fix memleak in get_raid56_used()Qu Wenruo2014-12-04
| | | | | | | Fix memleak in get_raid56_used(). Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: cleanup dead return after usage() for fi-disk_usageGui Hecheng2014-12-04
| | | | | | | The usage() calls exit() internally, so remove the return after it. Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: Add btrfs device disk-usage commandGoffredo Baroncelli2014-12-04
| | | | | Signed-off-by: Goffredo Baroncelli <kreijack@inwind.it> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: Add command btrfs filesystem disk-usageGoffredo Baroncelli2014-12-04
| | | | | Signed-off-by: Goffredo Baroncelli <kreijack@inwind.it> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: Add helpers functions to handle the printing of data in tabular ↵Goffredo Baroncelli2014-12-04
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | format This patch adds some functions to manage the printing of the data in tabular format. The function struct string_table *table_create(int columns, int rows) creates an (empty) table. The functions char *table_printf(struct string_table *tab, int column, int row, char *fmt, ...) char *table_vprintf(struct string_table *tab, int column, int row, char *fmt, va_list ap) populate the table with text. To align the text to the left, the text shall be prefixed with '<', otherwise the text shall be prefixed by a '>'. If the first character is a '=', the the text is replace by a sequence of '=' to fill the column width. The function void table_free(struct string_table *) frees all the data associated to the table. The function void table_dump(struct string_table *tab) prints the table on stdout. Signed-off-by: Goffredo Baroncelli <kreijack@inwind.it> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: Enhance the command btrfs filesystem dfGoffredo Baroncelli2014-12-04
| | | | | | | | | | 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>
* btrfs-progs: move group type and profile pretty printers to utilsDavid Sterba2014-12-04
| | | | | | Move and add the btrfs_ prefix. Signed-off-by: David Sterba <dsterba@suse.cz>
* Btrfs progs 3.17.3David Sterba2014-12-04
| | | | Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: print root dir verbose error in fsckQu Wenruo2014-12-04
| | | | | | | | | | | Before this patch, when btrfsck found an error in root dir, it will only output the following message "root %llu root dir %llu error" without any detailed error. Just add print_inode_error() to print out the whole error. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* Btrfs-progs: add_refs_for_implied: Use root_id instead of root_bytenr.Chandan Rajendra2014-11-27
| | | | | | | | resolve_one_root() returns the objectid of a tree rather than the logical address of the root node. Hence using root_bytenr is misleading. Fix this. Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: apply realpath for btrfs fi show when mount point is givenGui Hecheng2014-11-27
| | | | | | | | | | | | | | | | For now, # btrfs fi show /mnt/btrfs gives info correctly, while # btrfs fi show /mnt/btrfs/ gives nothing. This implies that the @realpath() function should be applied to unify the behavior. Made a more clear comment right above the call as well. Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: fix return value problem for btrfs sub showGui Hecheng2014-11-27
| | | | | | | | | | | | | | | | If you exec: # btrfs sub show <dir> <== non-subvolume dir The cmd print error messages as expected, but returns 0. By convetion, it should return non-zero and we should explicitly set it before it goto out. With other pieces adopted: 1) removed a unnecessary return value set -EINVAL 2) fixed another code branch which may return 0 upon error. 3) with 2) applied, the ret = 0 follows can be removed Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: fix spacing in error messagesDavid Sterba2014-11-25
| | | | Signed-off-by: David Sterba <dsterba@suse.cz>
* Btrfs-progs: fix a bug of converting sparse ext2/3/4Liu Bo2014-11-25
| | | | | | | | | | | | When converting a sparse ext* filesystem, btrfs-convert adds checksum extents for empty extents, whose disk_bytenr = 0, and this can end up with some weird problems, one of them is the failure of reading free space cache inode on mounting converted btrfs. The fix is simple, just to skip making checksum on empty extents. Signed-off-by: Liu Bo <bo.li.liu@oracle.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: add new dev replace resultEryu Guan2014-11-25
| | | | | | | | | | | A new dev replace result was introduced by kernel commit Btrfs: return failure if btrfs_dev_replace_finishing() failed Make the userspace know about the new result too. Signed-off-by: Eryu Guan <guaneryu@gmail.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* Btrfs progs v3.17.2David Sterba2014-11-19
| | | | Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: use system attr instead of attr libraryDavid Sterba2014-11-19
| | | | | | | We use the attr version provided by system in other places already, now we can remove dependency on the separate attr library. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: fix compiler warningChristian Hesse2014-11-18
| | | | | | | | | | | | | | gcc 4.9.0 gives a warning: array subscript is above array bounds Checking for "greater or equal" instead of just "equal" fixes this. The warning is a false positive, appears with -ftree-vrp, but we'd rather fix it to avoid noise during build. http://www.mail-archive.com/linux-btrfs%40vger.kernel.org/msg34338.html Signed-off-by: Christian Hesse <mail@eworm.de> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: use proper size for argv0 substitutionDavid Sterba2014-11-18
| | | | | | | | | | | | Make run from a long base path will overflow the argv0 buffer during tests. Otherwise, this would happen for all the standalone binaries that use set_argv0. Original report: https://bbs.archlinux.org/viewtopic.php?id=189861 Reported-by: WorMzy Tykashi <wormzy.tykashi@gmail.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: use canonical name for device in btrfs fi show when mountedGui Hecheng2014-11-14
| | | | | | | | | | | | | | | | When using lvm volumes to check fstests: btrfs/006, it fails like: Label: 'TestLabel.006' uuid: <UUID> Total devices <EXACTNUM> FS bytes used <SIZE> devid <DEVID> size <SIZE> used <SIZE> path SCRATCH_DEV + devid <DEVID> size <SIZE> used <SIZE> path /dev/dm-4 + devid <DEVID> size <SIZE> used <SIZE> path /dev/dm-5 + devid <DEVID> size <SIZE> used <SIZE> path /dev/dm-6 The /dev/dm-* points to lvm volumes, use @canonicalize_path() to convert them and we will make it through. Of course we should do the same thing for dev stat. Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: Check sb_bytenr with device size before scanning one device.Qu Wenruo2014-11-14
| | | | | | | | | | | | When using btrfs check with -s option, if using '-s 2' on a small device which doesn't have the third superblock, "No valid Btrfs found" will be output, but it is not appropriate. So check sb_bytenr against device size before scanning a device and output proper error message. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* Btrfs-progs: test images for new btrfsck functionalityJosef Bacik2014-11-14
| | | | | | | These test the recreating of missing dir item/dir index pairs, fixing the no rootdir inode item and no inode item for normal files. Thanks, Signed-off-by: Josef Bacik <jbacik@fb.com>
* Btrfs-progs: create missing root diridJosef Bacik2014-11-14
| | | | | | | | If we just don't have the root dirid stuff go ahead and re-create it, since it is easily recreated. Thanks, Signed-off-by: Josef Bacik <jbacik@fb.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* Btrfs-progs: fix missing inode itemsJosef Bacik2014-11-14
| | | | | | | | | If we have all the other items but no inode item we can recreate it for the most part, with the exception of the permissions and ownership. Add this ability to btrfsck. Thanks, Signed-off-by: Josef Bacik <jbacik@fb.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* Btrfs-progs: add ability to replace missing dir item/dir indexesJosef Bacik2014-11-14
| | | | | | | | If we have everything except the dir item and dir index we can easily replace them, so add this ability to btrfsck. Thanks, Signed-off-by: Josef Bacik <jbacik@fb.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* Btrfs-progs: add a message to know zero log ran successfullyJosef Bacik2014-11-14
| | | | | | | | | If there are errors when opening the fs because of PARTIAL we could think that the zero-log didn't actually work. Add a printf so we know that it was successfull. Thanks, Signed-off-by: Josef Bacik <jbacik@fb.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* Btrfs-progs: make zero-log use partial openJosef Bacik2014-11-14
| | | | | | | Because seriously, we only want to kill the tree log. Thanks, Signed-off-by: Josef Bacik <jbacik@fb.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* Btrfs-progs: spit out the broken file when ignoring errorsJosef Bacik2014-11-14
| | | | | | | | It's nice to ignore errors on restore, but spit out the filename so the user knows which files of his aren't going to look right. Thanks, Signed-off-by: Josef Bacik <jbacik@fb.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* Btrfs-progs: don't fail on log tree opening with PARTIALJosef Bacik2014-11-14
| | | | | | | | | We were failing to fsck a volume because we couldn't open the log tree, which is not helpful. Make us skip erroring out if we are using OPEN_CTREE_PARTIAL since it isn't a mandatory tree. Thanks, Signed-off-by: Josef Bacik <jbacik@fb.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* Btrfs-progs: add the ability to delete itemsJosef Bacik2014-11-14
| | | | | | | | Somtetimes you just need to delete an item, add that functionality to btrfs-corrupt-block. Thanks, Signed-off-by: Josef Bacik <jbacik@fb.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: fix compiler warningChristian Hesse2014-11-07
| | | | | | | | | | | gcc 4.9.0 gives warnings about possibly uninitialized values when compiling with function inlining and optimization level two enabled (CFLAGS="-finline-functions -O2"). Initializing the values fixes the warning. Hope this is correct. Signed-off-by: Christian Hesse <mail@eworm.de> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: update .gitignoreDavid Sterba2014-11-07
| | | | Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: build, update the clean ruleDavid Sterba2014-11-07
| | | | | | Remove duplicate files, add extra progs, add library test binaries. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: build, gather utilities that are not built by defaultDavid Sterba2014-11-07
| | | | | | Add them to build test and to clean rules. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: build, add make target for a build testDavid Sterba2014-11-07
| | | | | | A quick check that everything still builds. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: build, add basic build test for libraryDavid Sterba2014-11-07
| | | | | | Basic test based on snapper code that uses the send stream API. Signed-off-by: David Sterba <dsterba@suse.cz>
* Btrfs progs v3.17.1David Sterba2014-11-04
| | | | Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: use the correct SI prefixesDavid Sterba2014-11-04
| | | | | | The SI standard defines lowercase 'k' and uppercase for the rest. Signed-off-by: David Sterba <dsterba@suse.cz>