summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAge
* btrfs-progs: move the check_argc_* functions into utils.cGui Hecheng2014-08-22
| | | | | | | | | | | | | | To let the independent tools(e.g. btrfs-image, btrfs-convert, etc.) share the convenience of check_argc_* functions, just move it into utils.c. Also add a new function "set_argv0" to set the correct tool name: *btrfs-image*: too few arguments The original btrfs* tools work as before. Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com> [moved argv0 and check_argc to utils.*] Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: balance filter: add limit of processed chunksDavid Sterba2014-08-22
| | | | | | | | | | | | | | | Add more control to the balance behaviour. Usage filter may not be finegrained enough and can lead to moving too many chunks at once. Another example use is in connection with drange+devid or vrange filters that allow to work with a specific chunk or even with a chunk on a given device. The limit filter applies last, the value of 0 means no limiting. CC: Ilya Dryomov <idryomov@gmail.com> CC: Hugo Mills <hugo@carfax.org.uk> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: add X inode flag to btrfs(5)David Sterba2014-08-22
| | | | | | | | | | After the discussion in http://thread.gmane.org/gmane.comp.file-systems.btrfs/36334 the 'X' will be mentioned in the manpage because new e2fsprogs/lsattr will display it and represents the NOCOMPRESS bit of an inode. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: cleanup unnecessary free if malloc fails in btrfs-imageGui Hecheng2014-08-22
| | | | | | | Don't bother free the buffer if the malloc failed. Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* Btrfs-progs: fsck: reduce memory usage for extents checkWang Shilong2014-08-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | Steps to reproduce: # mkfs.btrfs -f /dev/sda9 -b 2g # mount /dev/sda9 /mnt # dd if=/dev/zero of=/mnt/data bs=4k oflag=direct # btrfs file df /mnt Data, single: total=1.66GiB, used=1.66GiB System, single: total=4.00MiB, used=16.00KiB Metadata, single: total=200.00MiB, used=67.88MiB For a filesystem without snapshots, 70M metadata, extent checking eats max memory about 110M, this is a nightmare for some system with low memory. It is very likely that extent record can be freed quickly for a filesystem without snapshots, improve this by trying if it can free memory after adding data/tree backrefs. This patch reduces max memory cost from 110M to 40M for extents checking for the above case. Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: fix btrfs-image old_restore fsck failureGui Hecheng2014-08-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Steps to reproduce: # mkfs.btrfs -f <dev1> # btrfs-image <dev1> <image_file> # btrfs-image -r -o <image_file> <dev2> # btrfs check <dev2> btrfs check output: : read block failed check_tree_block : Couldn't read tree root : Couldn't open file system The btrfs-image should not mess with the chunk tree under the old_restore way. The new restore way was introduced by: commit d6f7e3da0dae7b60cb7565f8a47c3b9045c52d1d Btrfs-progs: make btrfs-image restore with a valid chunk tree V2 ... And the following commit enhanced the new restore on the valid chunk tree building stuff: commit ef2a8889ef813ba77061f6a92f4954d047a78932 Btrfs-progs: make image restore with the original device offsets ... But the second commit should not effect the old_restore way since the old_restore way doesn't try to build a valid chunk tree at all. Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: Avoid double-free of fs_devices->listSatoru Takeuchi2014-08-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I found the following patch is insufficient. =============================================================================== commit 6e6b32ddf58db54f714d0f263c2589f4859e8b5e Author: Adam Buchbinder <abuchbinder@google.com> Date: Fri Jun 13 16:43:56 2014 -0700 btrfs-progs: Fix a use-after-free in the volumes code. =============================================================================== "btrfs filesystem show <dev>" with this patch causes segmentation fault if "<dev>" is a not-mounted Btrfs filesystem. =============================================================================== Label: none uuid: <cut here> Total devices 1 FS bytes used 112.00KiB devid 1 size 59.12GiB used 2.04GiB path /dev/sdd1 Segmentation fault (core dumped) =============================================================================== It's due to double-free of fs_devices->list as follows. =============================================================================== cmd_show -> list_del(&fs_devices->list) # 1st one. -> btrfs_close_devices(fs_devices) -> list_del(&fs_devices->list) # <- 2nd one introduced at 6e6b32dd. Double-free happens here. =============================================================================== First list_del() can safely be removed because fs_devices->list will be deleted by second one, soon. Signed-off-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com> Cc: Adam Buchbinder <abuchbinder@google.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: use BTRFS_SUPER_INFO_SIZE to replace raw 4096 in btrfs-imageGui Hecheng2014-08-22
| | | | | Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: cleanup possible silent failure in btrfs-imageGui Hecheng2014-08-22
| | | | | | | | | | If the malloc above fails, the btrfs-image will exit directly without any error messages. Now just return the ENOMEM errno and let the caller prompt the error message. Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: deal with malloc failure in btrfs-imageGui Hecheng2014-08-22
| | | | | | | | Handle the malloc failure for dump_worker in the same way as the restore worker. Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: replace BTRFS_NUM_MIRRORS with BTRFS_MAX_MIRRORSGui Hecheng2014-08-22
| | | | | | | | | | | | | | | The chunk-recover.c/BTRFS_NUM_MIRRORS in the userspace means the same thing as ctree.h/BTRFS_MAX_MIRRORS in the kernelspace, so to stay consistent with the kernelspace, just make this movement in the userspace: chunk-recover.c/BTRFS_NUM_MIRRORS ===> ctree.h/BTRFS_MAX_MIRRORS This provides convenience for future use. Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: add supported attr flags to btrfs(5)Eric Sandeen2014-08-22
| | | | | | | | | | | | | | | The chattr(1) manpage suffers from the same problems mount(1) had: many options listed, not kept up to date for various filesystems. I've submitted a manpage update for chattr(1) which says to refer to filesystem-specific manpages for supported attributes; this patch updates btrfs(5) to list the attributes supported by btrfs. Signed-off-by: Eric Sandeen <sandeen@redhat.com> [added some asciidoc markups, adjusted formatting] Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: Add minimum device size checkQu Wenruo2014-08-22
| | | | | | | | | | | | | | | | | | | Btrfs has global block reservation, so even mkfs.btrfs can execute without problem, there is still a possibility that the filesystem can't be mounted. For example when mkfs.btrfs on a 8M file on x86_64 platform, kernel will refuse to mount due to ENOSPC, since system block group takes 4M and mixed block group takes 4M, and global block reservation will takes all the 4M from mixed block group, which makes btrfs unable to create uuid tree. This patch will add minimum device size check before actually mkfs. The minimum size calculation uses a simplified one: minimum_size_for_each_dev = 2 * (system block group + global block rsv) and global block rsv = leafsize << 10 Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: check: Fix wrong level accessHugo Mills2014-08-22
| | | | | | | | | | There's no reason to assume that the bad key order is in a leaf block, so accessing level 0 of the path is going to be an error if it's actually a node block that's bad. Reported-by: Chris Mason <clm@fb.com> Signed-off-by: Hugo Mills <hugo@carfax.org.uk> Signed-off-by: David Sterba <dsterba@suse.cz>
* Btrfs-progs: fsck: add tests for extent tree rebuildingWang Shilong2014-08-22
| | | | | | | | | | | | We need test to verify extent tree rebuilding work, this test create a strange filesystem with some snapshots, destroy extent root node, and run fsck with "--init-extent-tree". Since this tests need btrfs internal tool(btrfs-corrupt-block),so i add this test into btrfs-progs. Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: delete invalid output file when btrfs-image failedGui Hecheng2014-08-22
| | | | | | | | When btrfs-image failed to create an image, the invalid output file had better be deleted to prevent being used mistakenly in the future. Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: deal with invalid option combinations for btrfs-imageGui Hecheng2014-08-22
| | | | | | | | | | | | For btrfs-image, dump may not come with option '-o' -r may not come with option '-c', '-s', '-w', dev_cnt != 1 -m may not come with dev_cnt < 2 All of the above should be regarded as invalid combinations, and the usage will show up. Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: update manpage for btrfs-image with -m option addedGui Hecheng2014-08-22
| | | | | | | The btrfs-image support multiple devices with -m specified. Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: cleanup duplicate assignment of variable leaf for btrfs-imageGui Hecheng2014-08-22
| | | | | | | | The value of variable leaf in while loop don't have to be set for every round. Just move it outside. Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: restore: document updatesWang Shilong2014-08-22
| | | | | | | | Add some missing options, also improve some confusing expressions. Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: restore: don't allow users to specify -r and -f at the same timeWang Shilong2014-08-22
| | | | | | | | These two options are used for same purpose, but they are exclusive with each other. Make it clear to common users. Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: restore: output resason why it fails to read rootWang Shilong2014-08-22
| | | | | | | | | | | | | | Previously if restore could not read users specified fs root, it would output following message: Error reading root With this patch, it will output message like: Fail to read root 1000: No such file or directory Signed-off-byr Wang Shilong <wangsl.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: restore: fix wrong return value if it fails to read specified ↵Wang Shilong2014-08-22
| | | | | | | | | | | | | | fs root Steps to reproduce: # mkfs.btrfs -f /dev/sda9 # btrfs restore -f 1 -o /tmp /dev/sda9 # echo $? Fix to return 1 in this failure path. Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: restore: check if specified root is fs/file tree firstlyWang Shilong2014-08-22
| | | | | | | | | | | | | | | Steps to reproduce: # mkfs.btrfs -f /dev/sda9 # mount /dev/sda9 /mnt # dd if=/dev/zero of=/mnt/data bs=1M count=1 # btrfs restore -r /dev/sda9 -r 2 -o /tmp If users don't input a valid fs/file root objectid, btrfs restore still continue and don't restore anything, this is unfriendly, we could check it firstly. Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* Btrfs-progs: fsck: switch to is_fstree()Wang Shilong2014-08-22
| | | | | Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: restore: check lzo compress lengthVincent Stehlé2014-08-22
| | | | | | | | | When things go wrong for lzo-compressed btrfs, feeding lzo1x_decompress_safe() with corrupt data during restore can lead to crashes. Reduce the risk by adding a check on the input length. Signed-off-by: Vincent Stehlé <vincent.stehle@laposte.net> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: Properly size the leafsize field in the mdrestore_struct structAdam Buchbinder2014-08-22
| | | | | | | | | | It's 32 bits as defined in ctree.h, but the struct had it as 64 bits. Found using MemorySanitizer. Signed-off-by: Adam Buchbinder <abuchbinder@google.com> Reviewed-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: Use sparse files for filesystem conversion testsAdam Buchbinder2014-08-22
| | | | | | | | | | On my system, this brings the FS conversion test suite's runtime from over ten seconds down to under two. Thanks to Julien Muchembled for the suggestion. Signed-off-by: Adam Buchbinder <abuchbinder@google.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: clean fsck noise for free inode generation 0Gui Hecheng2014-08-22
| | | | | | | | | | | | | | | | When we write a btrfs to full and then we have no space left for free space cache. The btrfs check will output msg as follows which is noise indeed: # free space inode generation (0) did not match free space cache generation (XXX) When the free space cache is not written out normally, the free inode generation will be 0. In this condition, no noise should be outputed. Also, check 0-sized inode eariler together with 0-generationed inode. Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: Improve the parse_size() error messageQu Wenruo2014-08-22
| | | | | | | | | | | | | | | | | When using parse_size(), even non-numeric value is passed, it will only give error message "ERROR: size value is empty", which is quite confusing for end users. This patch will introduce more meaningful error message for the following new cases 1) Invalid size string (non-numeric string) 2) Minus size value (like "-1K") Also this patch will take full use of endptr returned by strtoll() to reduce unneeded loop. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: show meaningful msgs for replace cmd upon raid56Gui Hecheng2014-08-22
| | | | | | | | | | | | This depends on the kernel patch: [PATCH] btrfs:replace EINVAL with EOPNOTSUPP for dev_replace This catches the EOPNOTSUPP and output msg that says dev_replace raid56 is not currently supported. Note that the msg will only be shown when run dev_replace not in background. Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: fix max mirror number error for chunk-recoverGui Hecheng2014-08-22
| | | | | | | | | | | | | | | When run chunk-recover on a health btrfs(data profile raid0, with plenty of data), the program has a chance to abort on the number of mirrors of an extent. According to the kernel code, the max mirror number of an extent is 3 not 2: ctree.h: BTRFS_MAX_MIRRORS 3 chunk-recover.c : BTRFS_NUM_MIRRORS 2 just change BTRFS_NUM_MIRRORS to 3, and everything goes well. Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: fix missing parity stripe for raid6 in chunk-recoverGui Hecheng2014-08-22
| | | | | | | | | | When deal with the p & q stripes for data profile raid6, chunk-recover forgets to insert them into the chunk record. Just insert them back freely. Also wrap the insert procedure into a new function, fill_chunk_up. Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: Add some simple end-to-end tests for btrfs-convertAdam Buchbinder2014-08-22
| | | | | | | | | | | | These use the system's mke2fs, and don't require loop devices or root privileges. They don't pick up anything with the default flags right now, but they do pick up some sanitizer issues when the tools are compiled with any of -fsanitize={address,memory,thread}. Signed-off-by: Adam Buchbinder <abuchbinder@google.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: Add human readable flags output for chunk/block group type.Qu Wenruo2014-08-22
| | | | | | | | | | | Current btrfs-debug-tree output chunk/block group type as numbers, which makes it hard to understand and need to check the source to understand the meaning. This patch will convert numeric type output to human readable strings. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: Add human readable flags output string for extent flags.Qu Wenruo2014-08-22
| | | | | | | | | | | Current btrfs-debug-tree outputs extent flags as numbers, which makes it hard to understand and need to check the source to understand the meaning. This patch will convert numberic flags output to human readable strings. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: update manpage for btrfs resize support size unit t/p/eGui Hecheng2014-08-22
| | | | | | | | btrfs resize now support size unit parse of k/m/g/t/p/e in kernel space, adopt the changes in userspace manpage. Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: Fix a use-after-free in the volumes code.Adam Buchbinder2014-08-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a struct btrfs_fs_devices was being torn down by btrfs_close_devices(), there was an invalidated pointer in the global list fs_uuids which still pointed to it; if a device was closed and then reopened (which btrfs-convert does), freed memory would be accessed. This was found using ThreadSanitizer (pretty much doing what AddressSanitizer would, but not exiting after the first failure). To reproduce, build with -fsanitize=thread and run 'make test'. Representative output is below. This change makes the current tests TSan-clean. WARNING: ThreadSanitizer: heap-use-after-free (pid=29161) Read of size 8 at 0x7d180000eee0 by main thread: #0 memcmp ??:0 #1 find_fsid .../volumes.c:81 #2 device_list_add .../volumes.c:95 #3 btrfs_scan_one_device .../volumes.c:259 #4 btrfs_scan_fs_devices .../disk-io.c:1002 #5 __open_ctree_fd .../disk-io.c:1090 #6 open_ctree_fd .../disk-io.c:1191 #7 do_convert .../btrfs-convert.c:2317 #8 main .../btrfs-convert.c:2745 Previous write of size 8 at 0x7d180000eee0 by main thread: #0 free ??:0 #1 btrfs_close_devices .../volumes.c:191 #2 close_ctree .../disk-io.c:1401 #3 do_convert .../btrfs-convert.c:2300 #4 main .../btrfs-convert.c:2745 Location is heap block of size 96 at 0x7d180000eee0 allocated by main thread: #0 calloc ??:0 (exe+0x00000002acc6) #1 device_list_add .../volumes.c:97 #2 btrfs_scan_one_device .../volumes.c:259 #3 btrfs_scan_fs_devices .../disk-io.c:1002 #4 __open_ctree_fd .../disk-io.c:1090 #5 open_ctree_fd .../disk-io.c:1191 #6 do_convert .../btrfs-convert.c:2256 #7 main .../btrfs-convert.c:2745 Signed-off-by: Adam Buchbinder <abuchbinder@google.com> Reviewed-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: Fix undefined behavior in radix-tree.c.Adam Buchbinder2014-08-22
| | | | | | | | | | | | | | | | | | When running with UndefinedBehaviorSanitizer, the tests produce the following error: radix-tree.c:836:30: runtime error: shift exponent 18446744073709551613 is too large for 64-bit type 'unsigned long' (That's a negative shift exponent represented as an unsigned long.) Even though the value is discarded in those cases, it's still undefined behavior; see the C99 standard, section 6.5.7, paragraph three: "If the value of the right operand is negative [...] the behavior is undefined." Signed-off-by: Adam Buchbinder <abuchbinder@google.com> Reviewed-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: rename btrfs-mount.5 to btrfs.5David Sterba2014-08-22
| | | | | | | We'd like to keep the name of category 5 page same as the filesystem to be consistent with the rest. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: add mount options to btrfs-mount.5Eric Sandeen2014-08-22
| | | | | | | | | | | | | | | | | | | This is a straight cut and paste from the util-linux mount manpage into btrfs-mount.5 It's pretty much impossible for util-linux to keep up with every filesystem out there, and Karel has more than once expressed a wish that mount options move into fs-specific manpages. So, here we go. The way btrfs asciidoc is generated, there's not a trivial way to have both btrfs(5) and btrfs(8) so I named it btrfs-mount(5) for now. A bit ick and I'm open to suggestions. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: cleanup unused assignment for chunk-recoverGui Hecheng2014-08-22
| | | | | | | | The 'num_unordered' will be recounted after 'goto out', just remove it. Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: canonicalize pathnames for device commandsJeff Mahoney2014-08-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | mount(8) will canonicalize pathnames before passing them to the kernel. Links to e.g. /dev/sda will be resolved to /dev/sda. Links to /dev/dm-# will be resolved using the name of the device mapper table to /dev/mapper/<name>. Btrfs will use whatever name the user passes to it, regardless of whether it is canonical or not. That means that if a 'btrfs device ready' is issued on any device node pointing to the original device, it will adopt the new name instead of the name that was used during mount. Mounting using /dev/sdb2 will result in df: /dev/sdb2 209715200 39328 207577088 1% /mnt lrwxrwxrwx 1 root root 4 Jun 4 13:36 /dev/whatever-i-like -> sdb2 /dev/whatever-i-like 209715200 39328 207577088 1% /mnt Likewise, mounting with /dev/mapper/whatever and using /dev/dm-0 with a btrfs device command results in df showing /dev/dm-0. This can happen with multipath devices with friendly names enabled and doing something like 'partprobe' which (at least with our version) ends up issuing a 'change' uevent on the sysfs node. That *always* uses the dm-# name, and we get confused users. This patch does the same canonicalization of the paths that mount does so that we don't end up having inconsistent names reported by ->show_devices later. Signed-off-by: Jeff Mahoney <jeffm@suse.com> [use PATH_MAX in canonicalize_dm_name] Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: make pretty Documentation/ build match the restEric Sandeen2014-08-22
| | | | | | | | | | | | | | | | | | | | | | | | | This is the most important patch ever. ;) I found this to be less aesthetically pleasing than it was before: [CC] btrfstune.o Making all in Documentation ASCIIDOC btrfs-convert.xml [LD] btrfstune XMLTO btrfs-convert.8 [CC] btrfs-show-super.o GZIP btrfs-convert.8.gz [LD] btrfs-show-super ASCIIDOC btrfs-debug-tree.xml XMLTO btrfs-debug-tree.8 so I shortened the pretty-text to match what we had before. Also, make clean "quiet" like it is in the top dir. Signed-off-by: Eric Sandeen <sandeen@redhat.com> [Changed to ASCII and XMLTO] Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: Documentation: Add filter section for btrfs-balance.Qu Wenruo2014-08-22
| | | | | | | | | | | | Man page for 'btrfs-balance' mentioned <filters> but does not explain them, which make end users hard to use '-d', '-m' or '-s options. This patch will use the explanations from https://btrfs.wiki.kernel.org/index.php/Balance_Filters to enrich the man page. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: update man page for btrfs-show-superGui Hecheng2014-08-22
| | | | | | | | | Add '-f' option for btrfs-show-super manpage, This option implies that sys chunk array and backup roots info will show up. Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* Btrfs-progs: fsck: add an option to check data csumsWang Shilong2014-08-22
| | | | | | | | This patch adds an option '--check-data-csum' to verify data checksums. fsck won't check data csums unless users specify this option explictly. Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* Btrfs-progs: fsck: fix wrong check for btrfs_read_fs_root()Wang Shilong2014-08-22
| | | | | | | | | | | | | | | | | | | | | | | When encountering a corrupted fs root node, fsck hit following message: Check tree block failed, want=29360128, have=0 Check tree block failed, want=29360128, have=0 Check tree block failed, want=29360128, have=0 Check tree block failed, want=29360128, have=0 Check tree block failed, want=29360128, have=0 read block failed check_tree_block Checking filesystem on /dev/sda9 UUID: 0d295d80-bae2-45f2-a106-120dbfd0e173 checking extents Segmentation fault (core dumped) This is because in btrfs_setup_all_roots(), we check btrfs_read_fs_root() return value by verifing whether it is NULL pointer, this is wrong since btrfs_read_fs_root() return PTR_ERR(ret), fix it. Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: fix blindly goto failure for chunk-recoverGui Hecheng2014-08-22
| | | | | | | | | | | If the csum of one stripe is not able to judge the order of two device extents, the stripe may happen to belong to the device extent that is already kicked out as ordered. Take this condition into consideration, don't report failure and give more tries with the stripes following. Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: fix uninitialized number count in chunk-recoverGui Hecheng2014-08-22
| | | | | | | | | When count the number of unordered device extents in chunk-recover, the counter should be reinitialized to be used. Also, introduce a new function for the counting job. Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>