summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAge
* 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>
* btrfs-progs: libbtrfs, make exported headers compatible with C++David Sterba2014-11-03
| | | | | | Add externs and don't use a reserved keyword. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: optimize btrfs_scan_lblkid() for multiple callsAnand Jain2014-11-03
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | btrfs_scan_lblikd() is called by most the device related command functions. And btrfs_scan_lblkid() is most expensive function and it becomes more expensive as number of devices in the system increase. Further some threads call this function more than once for absolutely no extra benefit and the real waste of resources. Below list of threads and number of times btrfs_scan_lblkid() is called in that thread. btrfs-find-root 1 btrfs rescue super-recover 2 btrfs-debug-tree 1 btrfs-image -r 2 btrfs check 2 btrfs restore 2 calc-size NC btrfs-corrupt-block NC btrfs-image NC btrfs-map-logical 1 btrfs-select-super NC btrfstune 2 btrfs-zero-log NC tester NC quick-test.c NC btrfs-convert 0 mkfs #number of devices to be mkfs btrfs label set unmounted 2 btrfs get label unmounted 2 This patch will: move out calling register_one_device with in btrfs_scan_lblkid() and so function setting the BTRFS_UPDATE_KERNEL to yes will call btrfs_register_all_devices() separately. introduce a global variable scan_done, which is set when scan is done succssfully per thread. So that following calls to this function will just return success. Further if any function needs to force scan after scan_done is set, then it can be done when there is such a requirement, but as of now there isn't any such requirement. Signed-off-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: introduce btrfs_register_all_device()Anand Jain2014-11-03
| | | | | | | | | | | | This function is to register all devices found after scanning the system. Before we had this functionality with in the btrfs_scan_lblkid(), however scanning and registering are two different distinct operation its better keep them separate. Also we want to optimize btrfs_scan_lblkid and avoid multiple system scans unless needed. As of now device scan uses this function. Signed-off-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: fix linking with libbtrfsDavid Sterba2014-11-03
| | | | | | | | | Reported at https://github.com/openSUSE/snapper/issues/128 Commit cdb9e22e292275237c added another rbtree file that defines functions that libbtrfs uses. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: Fix the argument requirement for '--subvol-extents'Qu Wenruo2014-11-03
| | | | | | | | | | | | | The following commit changed the argument requirement for '--subvol-extents', which causes it to call arg_strtou64() on NULL, resulting a segfault. d34cbe76 btrfs-progs: check: do not require argument for --subvol-extents This patch revert the patch and change the help string and man page to make it no longer confusing. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: skip mounted fs when deal with umounted ones for fi showGui Hecheng2014-11-03
| | | | | | | | | | | | | | | | | | Stalling problems may happen when exec balance & fi show cmds concurrently. With the following commit: commit 915902c500 btrfs-progs: fix device missing of btrfs fi show with seed devices The fi show cmd will bother the mounted fs when only umounted fs should be handled after @btrfs_can_kernel() has finished showing all mounted ones. We could skip the mounted fs after @btrfs_can_kernel() is done, then tasks keeps going on mounted fs while fi show continues on umounted ones separately. Reported-by: Petr Janecek <janecek@ucw.cz> Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* revert btrfs-progs: do a separate probe for _transient_ replacing deviceAnand Jain2014-11-03
| | | | | | | | | | | | | | There is a compatibility issue with older kernel with the progs commit id as below. d0588bfa479409b2a0f6243f894338a01a56221a btrfs-progs: do a separate probe for _transient_ replacing device So as of now writing to revert the above commit id. The brewing sysfs interface would help to fix the impending issue, which is seed device would fail show in 'btrfs fi show' output of a sprout device. Signed-off-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: Fix number of arguments check of 'btrfs fi df'Qu Wenruo2014-11-03
| | | | | | | | | | | | | | | | 'btrfs fi df' needs exactly one arguments as mount option, but as 3.17 we can run 'btrfs fi df' without any argument, and it will error as "ERROR: can't access '%s'" which means the argument number does not do what it should. The bug is caused by manually modify the optind and use check_argc_max() instead of the original check_argc_exact(). This patch fixes it by not modifying the optind and use check_argc_exact() again. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: fix csum root copy-n-paste errorZach Brown2014-11-03
| | | | | | | | | | | btrfs_setup_all_roots() had some copy and pasted code for trying to setup a root and then creating a blank node if that failed. The copy for the csum_root created the blank node in the extent_root. So we create a function to use a consistent root. Signed-off-by: Zach Brown <zab@zabbo.net> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: check read extent errors when mappingZach Brown2014-11-03
| | | | | | | | | | | | | | coverity barked out a warning that btrfs-map-logical was storing but ignoring errors from read_extent_from_disk(). So don't ignore 'em. I made extent reading errors fatal to match the fatal errors from mapping mirrors above. And while we're at it have read_extent_from_disk() return -errno pread errors instead of -EIO or -1 (-EPERM). The only other caller who tests errors clobbers them with -EIO. Signed-off-by: Zach Brown <zab@zabbo.net> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: code optimize cmd_scan_dev() use btrfs_register_one_device()Anand Jain2014-11-03
| | | | | | | | cmd_scan_dev() has it own code to register device (calling ioctl BTRFS_IOC_SCAN_DEV), apparently it could use btrfs_register_one_device(). Signed-off-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: only report internal dev replace result if there's a resultEryu Guan2014-11-03
| | | | | | | | | | | | | | | | | | If BTRFS_IOC_DEV_REPLACE ioctl failed, args.result usually won't be updated by the ioctl. And the arg has been initialized with 0, the result is always 0, which is BTRFS_IOCTL_DEV_REPLACE_RESULT_NO_ERROR, and the resulting error message looks confusing: ERROR: ioctl(DEV_REPLACE_START) failed on "/mnt/btrfs": No such file or directory, no error But in case there's an internal result returned in future, don't drop the result completely, instead print dev replace result message only if the result is updated by a failed ioctl call. Signed-off-by: Eryu Guan <guaneryu@gmail.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* Btrfs progs v3.17David Sterba2014-10-17
| | | | Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: run fsck image tests in filename orderDavid Sterba2014-10-17
| | | | Signed-off-by: David Sterba <dsterba@suse.cz>