summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAge
* btrfs-progs: free eb in fixup_chunk_tree_block()Zach Brown2013-10-16
| | | | | | | | This was found by static analysis. Signed-off-by: Zach Brown <zab@redhat.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* btrfs-progs: remove dead block group checkingZach Brown2013-10-16
| | | | | | | | | Don't carry around dead code. If its needed again, it's only a few git commands away. This was found by static analysis. Signed-off-by: Zach Brown <zab@redhat.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* btrfs-progs: check link_subvol name baseZach Brown2013-10-16
| | | | | | | | | | | | | In principle, link_subvol() can be given an abitrary string as the name of the saved subvolume. It copies it into a fixed-size stack buffer and then uses it as dirent names without testing its length. This limits its length to BTRFS_NAME_LEN. This was found by static analsys. Signed-off-by: Zach Brown <zab@redhat.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* btrfs-progs: don't overflow read buffer in imageZach Brown2013-10-16
| | | | | | | | | | search_for_chunk_blocks() allocates a fixed-size buffer and then reads arbitrary u32 sized buffers in to it. Instead let's fail if the item is bigger than the buffer. This was found by static analysis. Signed-off-by: Zach Brown <zab@redhat.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* btrfs-progs: don't overrun name in find-collisionsZach Brown2013-10-16
| | | | | | | | | find_collision() allocates name_len bytes for its sub array so the index must be less than name_len. This was found by static analysis. Signed-off-by: Zach Brown <zab@redhat.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* btrfs-progs: check path alloc in corrupt blockZach Brown2013-10-16
| | | | | | | | | | btrfs-corrupt-block added some untested path allocations. These showed up in static analysis when they pass their path to btrfs_search_slot() which unconditionally dereferences the path. Signed-off-by: Zach Brown <zab@redhat.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* Btrfs-progs: make pretty_size_snprintf() return lenWang Shilong2013-10-16
| | | | | | | | Sometimes, we need to catch length of snprintf() in pretty_size_snprintf(). Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* Btrfs-progs: enhance btrfs qgroup to print the result as a tableWang Shilong2013-10-16
| | | | | | | | | | | | | | | | | | | | | | | | | | This patch enhance to print the result as a table. You can use it like: btrfs qgroup show <path> However, to table the result better, we make '-p' and '-c' not present at the same time. For example: btrfs qgroup show -pr <path> The result will output as the follow format: qgroupid rfer excl max_excl parent -------- ---- ---- -------- ------ 0/265 1289752576 1289752576 0 --- 1/0 0 0 10999511627776 2/0,3/0 2/0 0 0 0 --- 3/0 0 0 0 --- Signed-off-by: Wang Shilong <wangsl-fnst@cn.fujitsu.com> Signed-off-by: Miao Xie <miaox@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* Btrfs-progs: enhance btrfs qgroup show to sort qgroupsWang Shilong2013-10-16
| | | | | | | | | | | | | | | | | | | | | | | You might want to list qgroups in order of some items, such as 'qgroupid', 'rfer' and so on, you can use '--sort'. Now you can sort the qgroups by 'qgroupid', 'rfer','excl','max_rfer' and 'max_excl'. For example: If you want to list qgroups in order of 'qgroupid'. You can use the option like that: btrfs qgroup show --sort=+/-qgroupid <path> Here, '+' means the result is sorted by ascending order. '-' is by descending order. If you don't specify either '+' nor '-', the result is sorted by default - ascending order. If you want to combine sort items, you do it like that: btrfs qgroup show --sort=-qgroupid,+rfer,max_rfer,excl <path> Signed-off-by: Wang Shilong <wangsl-fnst@cn.fujitsu.com> Signed-off-by: Miao Xie <miaox@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* Btrfs-progs: list all qgroups impact given path(exclude ancestral qgroups)Wang Shilong2013-10-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch introduces '-f' option which can help you filter the qgroups by the path name, you may use it like: btrfs qgroup show -f <path> For example: qgroupid(2/0) / \ / \ qgroupid(1/0) / \ / \ / \ qgroupid(0/1) qgroupid(0/2) sub1 sub2 / \ / \ dir1 file1 If we use the command: btrfs qgroup show -f sub1/dir1 The result will output 0/1 -- -- '-f' option helps you list all qgroups impact given path. (exclude ancestral qgroups) Signed-off-by: Wang Shilong <wangsl-fnst@cn.fujitsu.com> Signed-off-by: Miao Xie <miaox@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* Btrfs-progs: list all qgroups impact given path(include ancestral qgroups)Wang Shilong2013-10-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch introduces '-F' option which can help you filter the qgroups by the path name, you may use it like: btrfs qgroup show -F <path> For example: qgroupid(2/0) / \ / \ qgroupid(1/0) / \ / \ / \ qgroupid(0/1) qgroupid(0/2) sub1 sub2 / \ / \ dir1 file1 If we use the command: btrfs qgroup show -F sub1/dir1 The result will output 0/1 -- -- 1/0 -- -- 2/0 -- -- '-F' option help you list all qgroups impact given path. (include ancestral qgroups). Signed-off-by: Wang Shilong <wangsl-fnst@cn.fujitsu.com> Signed-off-by: Miao Xie <miaox@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* Btrfs-progs: introduce '-e' option to print max exclusive size of qgroupsWang Shilong2013-10-16
| | | | | | | | | | | This patch introduce '-e' option to print max exclusive size of qgroups. You may use it like this: btrfs qgroup -e <path> Signed-off-by: Wang Shilong <wangsl-fnst@cn.fujitsu.com> Signed-off-by: Miao Xie <miaox@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* Btrfs-progs: introduce '-r' option to print max referenced size of qgroupsWang Shilong2013-10-16
| | | | | | | | | | | | This patch introduces '-r' option to print max referenced size of qgroups. You may use it like: btrfs qgroup show -r <path> Signed-off-by: Wang Shilong <wangsl-fnst@cn.fujitsu.com> Signed-off-by: Miao Xie <miaox@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* Btrfs-progs: introduces '-c' option to print the ID of the child qgroupsWang Shilong2013-10-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch introduces '-c' option to print the ID of the child qgroups. You may use it like: btrfs qgroup show -c <path> For Example: qgroupid(2/0) / \ / \ / \ qgroupid(1/0) qgroupid(1/1) \ / \ / qgroupid(0/1) If we use the command: btrfs qgroup show -c <path> The result will output 0/1 -- -- -- 1/0 -- -- 0/1 1/1 -- -- 0/1 2/0 -- -- 1/0,1/1 Signed-off-by: Wang Shilong <wangsl-fnst@cn.fujitsu.com> Signed-off-by: Miao Xie <miaox@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* Btrfs-progs: introduces '-p' option to print the ID of the parent qgroupsWang Shilong2013-10-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch introduces '-p' option to print the ID of the parent qgroups. You may use it like: btrfs qgroup show -p <path> For Example: qgroupid(2/0) / \ / \ / \ qgroupid(1/0) qgroupid(1/1) \ / \ / qgroupid(0/1) If we use the command: btrfs qgroup show -p <path> The result will output 0/1 -- -- 1/0,1/1 1/0 -- -- 2/0 1/1 -- -- 2/0 2/0 -- -- -- Signed-off-by: Wang Shilong <wangsl-fnst@cn.fujitsu.com> Signed-off-by: Miao Xie <miaox@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* Btrfs-progs: restructure show_qgroupsWang Shilong2013-10-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current show_qgroups() just shows a little information, and it is hard to add some functions which the users need in the future, so i restructure it, make it easy to add new functions. In order to improve the scalability of show_qgroups(), i add some important structures: struct qgroup_lookup { struct rb_root root; } /* *store qgroup's information */ struct btrfs_qgroup { struct rb_node rb_node; u64 qgroupid; u64 generation; u64 rfer; u64 rfer_cmpr; u64 excl_cmpr; u64 flags; u64 max_rfer; u64 max_excl; u64 rsv_rfer; u64 rsv_excl; struct list_head qgroups; struct list_head members; } /* *glue structure to represent the relations *between qgroups */ struct btrfs_qgroup_list { struct list_head next_qgroups; struct list_head next_member; struct btrfs_qgroup *qgroup; struct btrfs_qgroup *member; } The above 3 structures are used to manage all the information of qgroups. struct { char *name; char *column_name; int need_print; } btrfs_qgroup_columns[] We define a arrary to manage all the columns that can be outputed, and use a member variant(->need_print) to control the output of the relative column. Some columns are outputed by default. But we can change it according to the requirement of the users. For example: if outputing max referenced size of qgroup is needed,the function 'btrfs_qgroup_setup_column()' will be called, and the parameter 'BTRFS_QGROUP_MAX_RFER' (extend in the future) will be passsed to the function. After the function is done, when showing qgroups, max referenced size of qgroup will be output. Signed-off-by: Wang Shilong <wangsl-fnst@cn.fujitsu.com> Signed-off-by: Miao Xie <miaox@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* btrfs-progs: btrfs_list_find_updated_files: Fix memory leak.chandan2013-10-16
| | | | | | | | | The current code returns from the function when the call to ioctl fails. This may leak cache_dir_name and cache_full_name. Fix it. Signed-off-by: chandan <chandan@linux.vnet.ibm.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* Btrfs-progs: print out human readable errors for inodes and backrefsJosef Bacik2013-10-16
| | | | | | | | | | | | | We usually print out a hex value of any errors on inodes or their backrefs, which is a huge pain for me because I have to put it into a calculator and count the bits to figure out which errors these map to, and usually I get it wrong the first time. To fix this lets just print out a human readable string for each error that way it will be easier to spot the "OH GOD THAT'S AWFUL" errors from "oh yeah thats no big deal, repair will fix that." Thanks, Signed-off-by: Josef Bacik <jbacik@fusionio.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* btrfs-progs: Update manpages for btrfs defrag -rFrank Holton2013-10-16
| | | | | | | | Add the -r option to the manpages for btrfs defragment Signed-off-by: Frank Holton <fholton@gmail.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* Btrfs-progs: keep track of transid failures and fix them if possibleJosef Bacik2013-10-16
| | | | | | | | | | | | | A user was reporting an issue with bad transid errors on his blocks. The thing is that btrfs-progs will ignore transid failures for things like restore and fsck so we can do a best effort to fix a users file system. So fsck can put together a coherent view of the file system with stale blocks. So if everything else is ok in the mind of fsck then we can recow these blocks to fix the generation and the user can get their file system back. Thanks, Signed-off-by: Josef Bacik <jbacik@fusionio.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* Btrfs-progs: add a test image for the transid fixer in btrfsckJosef Bacik2013-10-16
| | | | | | | | | | This is a verification test for the transid recow functionality of btrfsck. I've also adjusted the test script to spit out which image it's testing so I can be sure the image was getting tested. Thanks, Signed-off-by: Josef Bacik <jbacik@fusionio.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* Btrfs-progs: add ability to corrupt metadata block fieldsJosef Bacik2013-10-16
| | | | | | | | | | This patch allows us to garble the generation field of a metadata block. We will search down to the block, set the bogus generation and write the block back out. I used this for verifying a transid fix patch for btrfsck. Thanks, Signed-off-by: Josef Bacik <jbacik@fusionio.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* Btrfs-progs: add make test frameworkJosef Bacik2013-10-16
| | | | | | | | | | | We need to start adding some sanity tests to btrfs-progs to make sure we aren't breaking things with our patches. The most important of these tools is btrfsck. This patch gets things started by adding a basic btrfsck test that makes sure we can fix a corruption problem we know we can fix. Thanks, Signed-off-by: Josef Bacik <jbacik@fusionio.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* btrfs-progs: Add recursive defrag using -r optionFrank Holton2013-10-16
| | | | | | | | Add an option to defrag all files in a directory recursively. Signed-off-by: Frank Holton <fholton@gmail.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* Btrfs-progs: make the repair option a global static varJosef Bacik2013-10-16
| | | | | | | | It's just annoying to have to pass it around everywhere. Thanks, Signed-off-by: Josef Bacik <jbacik@fusionio.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* btrfs-progs: device add should check existing FS before addingAnand Jain2013-10-16
| | | | | | | | | | | | | | | as of now, when 'btrfs device add' adds a device it doesn't check if the given device contains an existing FS. This patch will change that to check the same. which when true add will fail, and ask user to use -f option to overwrite. further, since now we have test_dev_for_mkfs() function to check if a disk can be used, so this patch will also use this function to test the given device before adding. Signed-off-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* btrfs-progs: cmd_find_new: Sync fs before searching for modified files.chandan2013-10-16
| | | | | | | | | The sync makes sure that 'very recently' introduced delayed work is accounted for in the output of 'btrfs subvolume find-new' command. Signed-off-by: chandan <chandan@linux.vnet.ibm.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* btrfs-progs: create helper function to use lblkid to scan for btrfs disksAnand Jain2013-10-16
| | | | | | Signed-off-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* btrfs-progs: move out print in cmd_df to another functionAnand Jain2013-10-16
| | | | | | | | | This is a prepatory work for the btrfs fi show command fixes. So that we have a function get_df to get the fs sizes Signed-off-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* btrfs-progs: Make btrfs_header_fsid() return unsigned longRoss Kirk2013-10-16
| | | | | | | | | | | | | Internally, btrfs_header_fsid() calculates an unsigned long, but casts it to a pointer, while all callers cast it to unsigned long again. Committed to btrfs as fba6aa75654394fccf2530041e9451414c28084f Fix line length issues and match changes to kernelspace Signed-off-by: Ross Kirk <ross.kirk@gmail.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* btrfs-progs: clear_extent_bits: Fix memory leak.chandan2013-10-16
| | | | | | | | | The 'prealloc' extent_state structure is leaked for the case when the 'desired range' encapsulates/covers the 'extent range'. Signed-off-by: chandan <chandan@linux.vnet.ibm.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* Btrfs-progs: fix the min ticks check in print_seek_histogramJosef Bacik2013-10-16
| | | | | | | | | | Before I had been dividing by 5 but that gave me too much output so I changed it to 20 without changing the min seeks test. Fix this to avoid a divide by 0 problem. Thanks, Signed-off-by: Josef Bacik <jbacik@fusionio.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* btrfs-progs: check if device supports trimDavid Sterba2013-10-16
| | | | | | | | | The message about trim was printed unconditionally, we should check if trim is supported at all. Reviewed-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* Btrfs-progs: add a bunch of new statistics to btrfs-calc-sizeJosef Bacik2013-10-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I've been wanting to get back to the allocator and make some changes to try and fix our fragmenation woes with lots of metadata. But in order to make these changes I need to have something to tell me if my changes are making a real measurable difference. So this patch adds a bunch of new statistics to btrfs-calc-size. It will tell me how long it took to read in the trees, how many seeks it had (both forward and backward). It will tell me how far spread out the tree is and spit out a nice histogram of the seeks. Here is some sample output Calculating size of extent tree Total size: 60.74MB Inline data: 0.00 Total seeks: 5020 Forward seeks: 3691 Backward seeks: 1329 Avg seek len: 929.53MB Seek histogram 4096 - 4096: 1043 #### 8192 - 73728: 760 ### 81920 - 52527104: 753 ### 53518336 - 168009728: 753 ### 168591360 - 696045568: 753 ### 696238080 - 7560364032: 753 ### 7560437760 - 8409739264: 178 | Total clusters: 1874 Avg cluster size: 25.17KB Min cluster size: 8.00KB Max cluster size: 472.00KB Total disk spread: 7.90GB Total read time: 0 s 341670 us Levels: 4 This way we can have good numbers to back up any changes we make to the allocator. Thanks, Signed-off-by: Josef Bacik <jbacik@fusionio.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* btrfs-progs: look up the containing tree root idDavid Sterba2013-10-16
| | | | | | | | | | Find the tree id of the containing subvolume for a given file or directory. For subvolume return it's own id. $ btrfs inspect-internal rootid <path> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* btrfs-progs: remove leftovers from hg timesDavid Sterba2013-10-16
| | | | | Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* btrfs-progs: remove unused parameter from btrfs_header_fsidRoss Kirk2013-10-16
| | | | | | | | | | Remove unused parameter, 'eb'. Unused since introduction in 7777e63b425f1444d2472ea05a6b2b9cf865f35b Signed-off-by: Ross Kirk <ross.kirk@gmail.com> Reviewed-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* btrfs-progs: drop unused parameter from btrfs_item_nrRoss Kirk2013-10-16
| | | | | | | | | | Remove unused eb parameter from btrfs_item_nr, unused since introduced in 7777e63b425f1444d2472ea05a6b2b9cf865f35b Signed-off-by: Ross Kirk <ross.kirk@gmail.com> Reviewed-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* Btrfs-progs: add super-recover to recover bad supersWang Shilong2013-10-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Until now if one of device's first superblock is corrupt,btrfs will fail to mount. Luckily, btrfs have at least two superblocks for every disk. In theory, if silent corrupting happens when we are writting superblocks into disk, we must hold at least one good superblock. One side effect is that user must gurantee that the disk must be a btrfs disk. Otherwise, this tool may destroy other fs.(This is also reason why btrfs only use first superblock in every disk to mount) This little program will try to correct bad superblocks from good superblocks with max generation. There will be five kinds of return values: 0: all supers are valid, no need to recover 1: usage or syntax error 2: recover all bad superblocks successfully 3: fail to recover bad superblocks 4: abort to recover bad superblocks Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* Btrfs-progs: move ask_user() to utils.cWang Shilong2013-10-16
| | | | | | Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* Btrfs-progs: pass flag to control whether run ioctl in btrfs_scan_for_fsid()Wang Shilong2013-10-16
| | | | | | | | | If some fatal superblocks are damaged, running ioctl will return failure, in this case, we should avoid run ioctl. Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* Btrfs-progs: do not run ioctls in check_mounted_where()Wang Shilong2013-10-16
| | | | | | | | | We don't need to run ioctls when checking whether btrfs has mounted somewhere. Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* btrfs-progs: add list_sort and use it to sort devices by idDavid Sterba2013-10-16
| | | | | | | | The devices in 'btrfs filesystem show' are now sorted by the device id, currently the order was undefined. Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* btrfs-progs: separate command and implementation of chunk-recover codeDavid Sterba2013-10-16
| | | | | | | | | | | | | The command has been moved and we should rename the files accordingly, so the entry point is now in cmds-rescue.c and the core functionality in it's own file. Return codes of btrfs_recover_chunk_tree have been simplified not to require a define and another file for defintion. CC: Miao Xie <miaox@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* btrfs-progs: move chunk-recover to rescue groupDavid Sterba2013-10-16
| | | | | Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* btrfs-progs: introduce rescue command groupDavid Sterba2013-10-16
| | | | | | | | Add an empty 1st level command namespace that will collect specialized recovery tools like chunk-recover, zero-log, select-super and similar. Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* btrfs-progs: add nodiscard option to device addDavid Sterba2013-10-16
| | | | | | | Same as for mkfs. Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* btrfs-progs: use better name for nodiscard variable and flip the logicDavid Sterba2013-10-16
| | | | | Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* Btrfs-progs: fix magic return value in cmds-balance.cWang Shilong2013-10-16
| | | | | | | | | | | If there is no balance in progress, resume/pause/cancel will return 2. Usage or syntax errors will return 1. And 0 means operations return successfully. Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com> Reviewed-by: Ilya Dryomov <idryomov@gmail.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* btrfs-progs: fix -Wmissing-noreturnChris West (Faux)2013-10-16
| | | | | | Signed-off-by: "Chris West (Faux)" <git@goeswhere.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>