summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAge
* 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>
* Btrfs-progs: check, ability to detect and fix outdated snapshot root itemsFilipe Manana2014-10-17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change adds code to detect and fix the issue introduced in the kernel release 3.17, where creation of read-only snapshots lead to a corrupted filesystem if they were created at a moment when the source subvolume/snapshot had orphan items. The issue was that the on-disk root items became incorrect, referring to the pre orphan cleanup root node instead of the post orphan cleanup root node. A test filesystem can be generated with the test case recently submitted for xfstests/fstests, which is essencially the following (bash script): workout() { ops=$1 procs=$2 num_snapshots=$3 _scratch_mkfs >> $seqres.full 2>&1 _scratch_mount snapshot_cmd="$BTRFS_UTIL_PROG subvolume snapshot -r $SCRATCH_MNT" snapshot_cmd="$snapshot_cmd $SCRATCH_MNT/snap_\`date +'%H_%M_%S_%N'\`" run_check $FSSTRESS_PROG -p $procs \ -x "$snapshot_cmd" -X $num_snapshots -d $SCRATCH_MNT -n $ops } ops=10000 procs=4 snapshots=500 workout $ops $procs $snapshots Example of btrfsck's (btrfs check) behaviour against such filesystem: $ btrfsck /dev/loop0 root item for root 311, current bytenr 44630016, current gen 60, current level 1, new bytenr 44957696, new gen 61, new level 1 root item for root 1480, current bytenr 1003569152, current gen 1271, current level 1, new bytenr 1004175360, new gen 1272, new level 1 root item for root 1509, current bytenr 1037434880, current gen 1300, current level 1, new bytenr 1038467072, new gen 1301, new level 1 root item for root 1562, current bytenr 33636352, current gen 1354, current level 1, new bytenr 34455552, new gen 1355, new level 1 root item for root 3094, current bytenr 1011712000, current gen 2935, current level 1, new bytenr 1008484352, new gen 2936, new level 1 root item for root 3716, current bytenr 80805888, current gen 3578, current level 1, new bytenr 73515008, new gen 3579, new level 1 root item for root 4085, current bytenr 714031104, current gen 3958, current level 1, new bytenr 716816384, new gen 3959, new level 1 Found 7 roots with an outdated root item. Please run a filesystem check with the option --repair to fix them. $ echo $? 1 $ btrfsck --repair /dev/loop0 enabling repair mode fixing root item for root 311, current bytenr 44630016, current gen 60, current level 1, new bytenr 44957696, new gen 61, new level 1 fixing root item for root 1480, current bytenr 1003569152, current gen 1271, current level 1, new bytenr 1004175360, new gen 1272, new level 1 fixing root item for root 1509, current bytenr 1037434880, current gen 1300, current level 1, new bytenr 1038467072, new gen 1301, new level 1 fixing root item for root 1562, current bytenr 33636352, current gen 1354, current level 1, new bytenr 34455552, new gen 1355, new level 1 fixing root item for root 3094, current bytenr 1011712000, current gen 2935, current level 1, new bytenr 1008484352, new gen 2936, new level 1 fixing root item for root 3716, current bytenr 80805888, current gen 3578, current level 1, new bytenr 73515008, new gen 3579, new level 1 fixing root item for root 4085, current bytenr 714031104, current gen 3958, current level 1, new bytenr 716816384, new gen 3959, new level 1 Fixed 7 roots. Checking filesystem on /dev/loop0 UUID: 2186e9b9-c977-4a35-9c7b-69c6609d4620 checking extents checking free space cache cache and super generation don't match, space cache will be invalidated checking fs roots checking csums checking root refs found 618537000 bytes used err is 0 total csum bytes: 130824 total tree bytes: 601620480 total fs tree bytes: 580288512 total extent tree bytes: 18464768 btree space waste bytes: 136939144 file data blocks allocated: 34150318080 referenced 27815415808 Btrfs v3.17-rc3-2-gbbe1dd8 $ echo $? 0 Signed-off-by: Filipe Manana <fdmanana@suse.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: fix show super unknown flag outputZach Brown2014-10-16
| | | | | | | | | | | coverity pointed out that unknown flag printing in show super had some dead code. It turns out that first was reset when the first flag was tested, not when it was output. We only want to clear it if the first matching bit is output. If there are no matching bits then we'll want to output the unknown flag first. Signed-off-by: Zach Brown <zab@zabbo.net> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: check sscanf return codeZach Brown2014-10-16
| | | | | | | | coverity warned that the return code from sscanf() assigned to 'i' wasn't checked before being assigned again. Check it. Signed-off-by: Zach Brown <zab@zabbo.net> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: open RW to register device using btrfs-controlAnand Jain2014-10-16
| | | | | | | | We are passing device path to be registered with in kernel, so we need to open with RW Signed-off-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: introduce a proper structure on which cli will call ↵Anand Jain2014-10-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | register-device ioctl As of now commands mentioned below (with in [..]) are calling call register-device ioctl BTRFS_IOC_SCAN_DEV for all the devices in the system. Some issues with it: BTRFS_IOC_SCAN_DEV: ioctl is a write operation, we don't want command like btrfs-debug-tree threads to do that.. eg: ---- $ cat /proc/fs/btrfs/devlist | egrep fsid | wc -l 0 $ btrfs-debug-tree /dev/sde (num_device > 1) $ cat /proc/fs/btrfs/devlist | egrep fsid | wc -l 5 ---- btrfs_scan_fs_devices() ends up calling this ioctl only when num_device > 1. That's inconsistency with in feature/bug. We don't have to register _all_ the btrfs devices (again) in the system without user consent. Why its inconsistent: function btrfs_scan_fs_devices() calls btrfs_scan_lblkid only when num_devices is > 1, which in turn calls BTRFS_IOC_SCAN_DEV ioctl, if conditions are met. But main issue is we have too many consumers of btrfs_scan_fs_devices() the names below with in [] is the cli leading to this function. open_ctree_broken() [btrfs-find-root] recover_prepare() [btrfs rescue super-recover] __open_ctree_fd (updates always except when flag OPEN_CTREE_RECOVER_SUPER is set and flag OPEN_CTREE_RECOVER_SUPER is set only by 'btrfs rescue super- recover' but still this thread sneaks through the open_ctree function to call register-device-ioctl as show below). open_ctree_fs_info [btrfs-debug-tree] [btrfs-image -r] [btrfs check] open_fs [btrfs restore] open_ctree [calc-size] [btrfs-corrupt-block] [btrfs-image] (create) [btrfs-map-logical] [btrfs-select-super] [btrfstune] [btrfs-zero-log] [tester] [mkfs] [quick-test.c] [btrfs label set unmounted] [btrfs get label unmounted] [btrfs rescue super-recover] open_ctree_fd [btrfs-convert] Fix: In an effort to make register-device consistent, all calls to btrfs_scan_fs_devices() will have 5th parameter set to 0. that means we don't need 5th parameter at all. And with this function not calling the register ioctl at all, finally we will have following two cli to call the ioctl BTRFS_IOC_SCAN_DEV. btrfs dev scan and mkfs.btrfs Threads needing to update kernel about a device would have to use btrfs_register_one_device() separately. Signed-off-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: mkfs should be consistent in calling register deviceAnand Jain2014-10-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | When we have one device we don't call register device. (in fact not mandatory, but to make it consistent) And when we have more than one we call register device. reproducer: Nothing in the kernel device list cat /proc/fs/btrfs/devlist | egrep fsid | wc -l 0 mkfs.btrfs will automatically call register device when devices is more than 1. mkfs.btrfs -f /dev/sdb /dev/sdc cat /proc/fs/btrfs/devlist | egrep fsid | wc -l 1 But it does not when there is only one device mkfs.btrfs -f /dev/sdb cat /proc/fs/btrfs/devlist | egrep fsid | wc -l 0 Signed-off-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* Btrfs-progs: check, fix return value check of is_child_root()Filipe Manana2014-10-16
| | | | | | | | | | | | | | | | | | | | | | The following commit: "btrfs-progs: fsck: remove unfriendly BUG_ON() for searching tree failure" f495a2ac66116f0a1b15e73380c8cbca6e0a4ca0 introduced a regression, detected through xfstests/btrfs/054, where previously a negative return value (-1) was used to mean a particular root didn't had any parent root, and now, after that change, a negative value is also used to mean that an error happened. That change also made the only caller of is_child_root() interpret any negative return value as an error and therefore incorrectly made the caller leave with an error, instead of continuing. This affects only the 3.17 release candidates (3.16 and older releases don't have this issue). Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: Wang Shilong <wangshilong1991@gmail.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: fix uninitialized warning in btrfs_calc_stripe_indexAnand Jain2014-10-14
| | | | | | | | chunk-recover.c: In function btrfs_calc_stripe_index chunk-recover.c:1481: warning: index may be used uninitialized in this function Signed-off-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* Btrfs-progs: lookup all roots that point to a corrupt blockJosef Bacik2014-10-14
| | | | | | | | | | | If we have a corrupt block that multiple snapshots point to we will only fix the guy who originally pointed to the block, and then simply loop forever because we keep finding the same bad block. So instead lookup all roots that point to this block, and then search down to the block for each root and fix the block in all snapshots. Thanks, Signed-off-by: Josef Bacik <jbacik@fb.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: make fsck deal with bogus itemsJosef Bacik2014-10-14
| | | | | | | | | | We can deal with corrupt items by deleting them in a few cases. Fsck can easily recover from a missing extent item or a dir index item. So if we notice a item is completely bogus and it is of a key that we know we can repair then just delete it and carry on. Thanks, Signed-off-by: Josef Bacik <jbacik@fb.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: check blocks when checking fs rootsJosef Bacik2014-10-14
| | | | | | | | | | | Usually if we find a bad block during the extent tree stuff we will error out, but if the bad block is in an fs tree and doens't have extents in it then fsck may still pass even though the block was complete garbage. So add the check block logic to the fs root checking so we actually error out of fsck if there is a bad block. Thanks, Signed-off-by: Josef Bacik <jbacik@fb.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: add the ability to fix shifted item offsetsJosef Bacik2014-10-14
| | | | | | | | | | | A user had a corrupted fs where the items had been shifted improperly. This patch adds the ability to fix this sort of problem within fsck. We will simply shift the item over to the proper offset and update the offsets to make sure they are correct. I tested this with a hand crafted fs that was broken in the same way as the user, and I've included the file as a new test. Thanks, Signed-off-by: Josef Bacik <jbacik@fb.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: add shift_items to btrfs-corrupt-blockJosef Bacik2014-10-14
| | | | | | | | | A user had a corrupted fs where his items where shifted oddly. This adds the functionality I needed to btrfs-corrupt-block in order to reproduce this corruption in order to make fsck fix this sort of problem. Thanks, Signed-off-by: Josef Bacik <jbacik@fb.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: corrupt btrfs items in btrfs-corrup-blockJosef Bacik2014-10-14
| | | | | | | For testing fsck against completely broken btrfs_items. Signed-off-by: Josef Bacik <jbacik@fb.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* Btrfs-progs: add ability to corrupt dir itemsJosef Bacik2014-10-14
| | | | | | | | In order to test the dir index corruption fixing patches in fsck we need to add functionality to btrfs-corrupt-block to corrupt dir item fields. Thanks, Signed-off-by: Josef Bacik <jbacik@fb.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* Btrfs-progs: deal with mismatch index between dir index and inode refJosef Bacik2014-10-14
| | | | | | | | | | Sometimes we have a dir index and an inode ref that don't agree on the index. In this case just assume that the inode ref is the ultimate authority on the subject and delete the dir index. This means we have to not reset index if we find a mismatched inode ref to make sure we delete the right dir index. Thanks, Signed-off-by: Josef Bacik <jbacik@fb.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* Btrfs-progs: add a dummy backref if our location is wrongJosef Bacik2014-10-14
| | | | | | | | | | If our location is bogus in our dir item we were just skipping the thing. However in this case we want to just delete the dir index, so create a dummy inode rec using BTRFS_MULTIPLE_OBJECTIDS and just add every backref we find to the list so we know to straight up delete all of these items. Thanks, Signed-off-by: Josef Bacik <jbacik@fb.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* Btrfs-progs: delete bogus dir indexesJosef Bacik2014-10-14
| | | | | | | | | | | | | | We may run across dir indexes that are corrupt in such a way that it makes them useless, such as having a bad location key or a bad name. In this case we can just delete dir indexes that don't show up properly and then re-create what we need. When we delete dir indexes however we need to restart scanning the fs tree as we could have greated bogus inode recs if the location key was bad, so set it up so that if we had to delete an dir index we go ahead and free up our inode recs and return -EAGAIN to check_fs_roots so it knows to restart the loop. Thanks, Signed-off-by: Josef Bacik <jbacik@fb.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* Btrfs-progs: re-search tree root if it changesJosef Bacik2014-10-14
| | | | | | | | If we change something while scanning fs-roots we need to redo our search so that we get valid root items and have valid root cache. Thanks, Signed-off-by: Josef Bacik <jbacik@fb.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* Btrfs-progs: reset chunk state if we restart checkJosef Bacik2014-10-14
| | | | | | | | | | | | If we hid a corrupt block that we fix and we restart the fsck loop you will get lots of noise about duplicate block groups and such. This is because we don't clear the block group and chunk cache when we do this restart. This patch fixes that, which is a little tricky since the structs are linked together with various linked lists, but this passed with a user who was hitting this problem. Thanks, Signed-off-by: Josef Bacik <jbacik@fb.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* Btrfs-progs: update rbtree libsJosef Bacik2014-10-14
| | | | | | | | | | While debugging a broken fs we were seeing hangs in the rb_erase loops. The rbtree was simple and wasn't corrupted so it appeared to be a bug in our rbtree library. Updating to the kernels latest rbtree code made the infinite loop go away, so pull it back. Thanks, Signed-off-by: Josef Bacik <jbacik@fb.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* Btrfs-progs: break out rbtree util functionsJosef Bacik2014-10-14
| | | | | | | | | These were added to deal with duplicated functionality within btrfs-progs, but we specifically copied rbtree.c from the kernel, so move these functions out into their own file. This will make it easier to keep rbtree.c in sync. Thanks, Signed-off-by: Josef Bacik <jbacik@fb.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* Btrfs-progs: pull back backref.c and fix it upJosef Bacik2014-10-14
| | | | | | | | | This patch pulls back backref.c, adds a couple of helpers everywhere that it needs, and cleans up backref.c to fit in btrfs-progs. Thanks, Signed-off-by: Josef Bacik <jbacik@fb.com> [removed free_some_buffers after "do not reclaim extent buffer"] Signed-off-by: David Sterba <dsterba@suse.cz>
* Btrfs-progs: repair missing dir indexJosef Bacik2014-10-13
| | | | | | | | | | | If we have an inode backref entry then we know enough to add back a missing dir index. When messing with the inode backrefs we need to do all of that first before we process the inode recs themselves as we may clear errors on the inode recs as we fix the directory indexes. This adds the framework for fixing backref errors and fixes missing dir index issues. Thanks, Signed-off-by: Josef Bacik <jbacik@fb.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: document the limit balance filterDavid Sterba2014-10-10
| | | | Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: convert: set label or copy from originDavid Sterba2014-10-10
| | | | Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: add options to tune units for fi df outputDavid Sterba2014-10-10
| | | | | | | | | | | | | The size unit format is a longstanding annoyance. This patch is based on the work of Nils and Alexandre and enhances the options. It's possible to select raw bytes, SI-based or IEC-based compact units (human frientdly) or a fixed base from kilobytes to terabytes. The default is compact human readable IEC-based, no change to current version. CC: Nils Steinger <nst@voidptr.de> CC: Alexandre Oliva <oliva@gnu.org> Reviewed-by: Hugo Mills <hugo@carfax.org.uk> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: Remove extra 'const' modifiers; they don't do anything.Adam Buchbinder2014-10-10
| | | | | | | | | | | | | 'const int const *x' means the same thing as 'const int *x' or 'int const *x'; the intent was probably 'const int * const x'. However, this won't work for the 'suffix' variable, as it has to be assigned, and making the static tables into const pointers to const chars leads to a mismatch there. This was found with clang's duplicate-decl-specifier warning. Signed-off-by: Adam Buchbinder <abuchbinder@google.com> Signed-off-by: David Sterba <dsterba@suse.cz>