summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAge
* btrfs-progs: compat: define DIV_ROUND_UP if not already definedJeff Mahoney2015-06-05
| | | | | | | DIV_ROUND_UP may not be defined, so define it if it's not already. Signed-off-by: Jeff Mahoney <jeffm@suse.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: convert: rename ext2_root to image_rootJeff Mahoney2015-06-05
| | | | | | | | In preparation to extend to other file systems, rename ext2_root to image_root. Signed-off-by: Jeff Mahoney <jeffm@suse.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: convert: remove unused inode_key in copy_single_inodeJeff Mahoney2015-06-05
| | | | | Signed-off-by: Jeff Mahoney <jeffm@suse.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: convert: remove unused fs argument from block_iterate_procJeff Mahoney2015-06-05
| | | | | | | The fs argument is unused, so let's not pass it. Signed-off-by: Jeff Mahoney <jeffm@suse.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: convert: clean up blk_iterate_data handling wrt record_file_blocksJeff Mahoney2015-06-05
| | | | | | | | Hand off initialization of blk_iterate_data to init_blk_iterate_data and pass the structure when the elements are the only values passed anyway. Signed-off-by: Jeff Mahoney <jeffm@suse.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: qgroup limit: add a check for invalid input of 'T/G/M/K'Dongsheng Yang2015-06-05
| | | | | | | | | | | | | Add a check to error out in the following case: # ./btrfs qgroup limit T /mnt/ Invalid size argument given Without this patch, btrfs-progs would parse the input as 0 and continue. Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: qgroup limit: error out if input value is negativeDongsheng Yang2015-06-05
| | | | | | | | | | | | | If we pass a negative value to command qgroup limit, btrfs-progs would convert it to unsigned long long silently. That's a little confusing to user, why I can limit my quota to a negative value. This patch add a check in parse_limit, if the input value is negative, error out to user. Reported-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com> Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: qgroup: allow user to clear some limitation on qgroup.Dongsheng Yang2015-06-05
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, we can not clear a limitation on a qgroup. Although there is a 'none' choice provided to user to do it, it does not work well. It does not set the flag which user want to clear, then kernel will never know what the user want to do at all. *Without this commit* # ./btrfs qgroup show -re /mnt qgroupid rfer excl max_rfer max_excl -------- ---- ---- -------- -------- 0/5 2.19GiB 2.19GiB 5.00GiB none 0/257 100.02MiB 100.02MiB none none # ./btrfs qgroup limit none /mnt # ./btrfs qgroup show -re /mnt qgroupid rfer excl max_rfer max_excl -------- ---- ---- -------- -------- 0/5 2.19GiB 2.19GiB 5.00GiB none 0/257 100.02MiB 100.02MiB none none This patch will set the flag user want to clear and pass a size=-1 to kernel. Then kernel will clear it correctly. *With this commit* # ./btrfs qgroup show -re /mnt qgroupid rfer excl max_rfer max_excl -------- ---- ---- -------- -------- 0/5 2.19GiB 2.19GiB 5.00GiB none 0/257 100.02MiB 100.02MiB none none # ./btrfs qgroup limit none /mnt # ./btrfs qgroup show -re /mnt qgroupid rfer excl max_rfer max_excl -------- ---- ---- -------- -------- 0/5 2.19GiB 2.19GiB none none 0/257 100.02MiB 100.02MiB none none Reported-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com> Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com> Tested-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: qgroup: show 'none' when we did not limit it on this qgroupDongsheng Yang2015-06-05
| | | | | | | | | | | | | | | | | | | There are two understanding of the '0' value in btrfs qgroup show. (1) is no-limitation on this qgroup. (2) is the max-limitation is 0. This patch make it showing in different way. (1) max-limitation for 0 is still showing '0'. (2) no-limitation will show 'none'. qgroupid rfer excl max_rfer max_excl parent -------- ---- ---- -------- -------- ------ 0/5 2.19GiB 2.19GiB none none --- 0/257 100.02MiB 100.02MiB none none --- Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com> Tested-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: tests: add test for zero-logDavid Sterba2015-06-05
| | | | | | | | Simple test to verify that the log_root is reset after the command, but we yet need to provide a testing image with log_root set to something sensible or crafted images with borked log_root pointer. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: cleanup and deprecate btrfs-zero-logDavid Sterba2015-06-05
| | | | | | Sync with the 'rescue zero-log' code, add a warning about deprecation. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: tests: update convert tests to set fs featuresDavid Sterba2015-06-04
| | | | Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: convert: allow to set filesystem featuresDavid Sterba2015-06-04
| | | | | | | | | | | | | | | Curretnly there are no features set for the converted filesystem and it's not possible to request it like in mkfs. Add new option -O|--features, use -O list-all to show all that are supported for convert. Note: from now on, convert without any -O option will use the same defaults as mkfs. The original behaviour was rather confusing. Convert is now more verbose about the parameters of the btrfs filesytem. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: add function to stringify filesystem featuresDavid Sterba2015-06-04
| | | | Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: scrub: more friendly duration format in statusDavid Sterba2015-06-04
| | | | | | | | scrub status for d4dc0da9-e8cc-4bfe-9b6f-2dcf8e0754f5 scrub started at Sat Jan 1 00:00:01 UTC 2000 and finished after 00:43:05 total bytes scrubbed: 111.17GiB with 0 errors Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: doc: update btrfs-rescue page and drop btrfs-zero-logDavid Sterba2015-06-04
| | | | | | | | - fix page title - update zero-log text - delete btrfs-zero-log.asciidoc as page is not shipped anymore Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: ioctl.h: add btrfs_ioctl_feature_flags structDavid Sterba2015-06-03
| | | | | | Copied from uapi/linux/btrfs.h. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: ioctl.h: update btrfs_ioctl_fs_info_argsDavid Sterba2015-06-03
| | | | | | Copied from uapi/linux/btrfs.h. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: ioctl.h: update type annotationsDavid Sterba2015-06-03
| | | | | | Add the __user annotations to pointers in structures. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: ioctl.h: add send flag maskDavid Sterba2015-06-03
| | | | | | Copied from uapi/linux/btrfs.h. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: ioctl.h: add EXTENT_SAME ioctl and structuresDavid Sterba2015-06-03
| | | | | | Copied from uapi/linux/btrfs.h. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: ioctl.h: copy commented version of balance structuresDavid Sterba2015-06-03
| | | | | | Copied from uapi/linux/btrfs.h, no-op change. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: ioctl.h: copy commented version of scrub_progress structureDavid Sterba2015-06-03
| | | | | | Copied from uapi/linux/btrfs.h, no-op change. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: ioctl.h: reorder to match kernel uapi headerDavid Sterba2015-06-03
| | | | | | | This is a no-op change, move the code that also exists in the uapi/linux/btrfs.h header. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: btrfstune: make uuid rewrite progress more verboseDavid Sterba2015-06-03
| | | | Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: tests: add misc tests for uuid rewriteDavid Sterba2015-06-03
| | | | | | Simple tests of the -u/-U options of btrfstune. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: doc: update btrfstune manpageDavid Sterba2015-06-03
| | | | Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: btrfstune: add option to enable NO_HOLESDavid Sterba2015-06-03
| | | | | | New option -n to enable the NO_HOLES feature. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: btrfstune: rework option handlingDavid Sterba2015-06-03
| | | | | | Simplify the code, gather the incompat flag bits and set them at once. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: subvol show: tweak outputDavid Sterba2015-06-03
| | | | | | | | | - capitalize UUID - print otime with timezone - rename 'Object ID' to 'Subvolume ID' - add ID to Parent and Top level Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: subvol show: print received uuidDavid Sterba2015-06-03
| | | | Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: specify mountpoint for recieveJosef Bacik2015-06-02
| | | | | | | | | | | In a chroot environment we may not have /proc mounted, which makes btrfs receive freak out since it wants to know the base directory where are are mounted for things like clone and such. Give an option to specify where the mountpoint is in these cases so you can still do a btrfs receive in a chroot. Thanks, Signed-off-by: Josef Bacik <jbacik@fb.com> [added manpage documentation] Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: update .gitignoreDavid Sterba2015-06-02
| | | | Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: use function is_block_device() insteadAnand Jain2015-06-02
| | | | | | | | Here the delete code as below, is trying to check if the provided device is a block device, there is a function for it. Use it. Signed-off-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: mkfs: check metadata redundancySam Tygier2015-06-02
| | | | | | | | | | | | | | | | Currently BTRFS allows you to make bad choices of data and metadata levels. For example -d raid1 -m raid0 means you can only use half your total disk space, but will lose everything if 1 disk fails. It should give a warning in these cases. When making a filesystem, check that metadata mode is at least as redundant as the data mode. For example give warning when: -d raid1 -m raid0 Signed-off-by: Sam Tygier <samtygier@yahoo.co.uk> [make the check more visible in mkfs output] Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: tests: add misc test for fs featuresDavid Sterba2015-06-02
| | | | | | | | A sample test for the misc-test category. Verify that btrfstune sets the requested fs features. Now implemented extrefs, skinny-metadata and seeding. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: tests: common: add helper run_check_stdoutDavid Sterba2015-06-02
| | | | | | | Sometimes we need to process the output of the command, but run_check captures all the output into results file. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: tests: add driver script for misc testsDavid Sterba2015-06-02
| | | | Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: add info about list-all to the helpAnand Jain2015-06-01
| | | | | | | | mkfs.btrfs -O list-all is a good options to list features, publish it in the help. Signed-off-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: receive: restore capabilities after chownDavid Sterba2015-05-27
| | | | | | | | | | | | | | | | Capabilities are cleared after chown, and the btrfs-stream encodes the CHOWN command after any SET_XATTR command. So the capabilites are not always preserved. This could be fixed in kernel to emit the instructions in the right order, but fix in userspace will make it work for older kernels. If we see the capabilities among xattrs, cache the value and apply it again in case it's followed by chown on that file. Fixes: https://bugzilla.kernel.org/show_bug.cgi?id=68891 Reported-by: Juan Orti Alcaine <j.orti.alcaine@gmail.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: btrfstune: fix a bug which makes unfinished fsid change ↵Qu Wenruo2015-05-26
| | | | | | | | | | | | | | | | | | unrecoverable This bug is found by making break point after change_fsid_prepare() and then kill the unfinished change, then try to restore the unfinished fsid change. If fsid change is canceled, open_ctree will still fail even with IGNORE_FSID_MIMATCH open ctree flag, since it can't find device with mismatched fsid, making it unable to restoring. Now add ignore_fsid_mismatch judgment in btrfs_find_device() to fix the bug and allow later restore to work as expected. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: Documentation: uuid changeQu Wenruo2015-05-26
| | | | | | Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> [updated wodring] Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: btrfstune: add '-U' and '-u' option to change fsidQu Wenruo2015-05-26
| | | | | | | | | | | | | | | | | Add two options, '-U' and '-u' for btrfstune. For '-u', it is used to change fsid to a random new UUID. For '-U', it is used to change fsid to a specified UUID. Both will also change the internal use only chunk_tree_uuid to a random new UUID. Although there is a GNU getopt extension "::" to get optional option-argument, but is forbidden by POSIX.1-2008, so use split options here. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: btrfstune: add ability to restore unfinished fsid changeQu Wenruo2015-05-26
| | | | | | | | Now change_uuid() can auto detected unfinished fsid change and restore it. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: btrfstune: rework change_uuidQu Wenruo2015-05-26
| | | | | | | | | | | | | | | | | | | Change the change_uuid(): 1) Remove new_chunk_tree_uuid parameter As chunk_tree_uuid is only internal used, no need to manual specify it. Use random generated UUID instead. 2) Don't use heap allocated memory for fs_info->new_fsid/chunk_tree_id. It's easy to forgot free or double free heap memory. Use stack memory instead. (In fact, I forgot to free them in previous patchset) 3) Print destination fsid. As now it's possible to change fsid to random uuid, it's better to print it out. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* Btrfs-progs: corrupt-block: add the ability to remove csumsJosef Bacik2015-05-26
| | | | | | | | Sometimes we need to test what happens when we're missing a csum for a range, so add an option to btrfs-corrupt-block to be able to remove a csum range. Thanks, Signed-off-by: Josef Bacik <jbacik@fb.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: use openat for process_clone in receiveEmil Karlson2015-05-26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This will fix breakage, when doing chrooted receive with cloned paths outside main subvolume. Steps to reproduce: $ create subvolume $ create file $ snapshot to snap1 $ delete file $ snapshot to snap2 $ reflink file from snap1 $ snapsthot to snap3 $ send full snap1 | receive --chroot $ send incremental snap2 | receive --chroot $ send incremental snap3 | receive --chroot The last step would fail with: Chroot to /mnt/recvdir At snapshot snap3 ERROR: failed to open /recvdir/snap1/file. No such file or directory Signed-off-by: Emil Karlson <jekarlson@gmail.com> [added reproducer] Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: tests: add script to clean intermediate imagesDavid Sterba2015-05-25
| | | | Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: test: 015-check-bad-memory-accessDavid Sterba2015-05-25
| | | | | | | | | | | | | Crafted images may trigger out-of-bounds access during check, fixed by "btrfs-progs: Enhance read_tree_block to avoid memory corruption" Now adding image for the first one, the other need enhancements in the testing framework. Reference: https://bugzilla.kernel.org/show_bug.cgi?id=97171 Reference: https://bugzilla.kernel.org/show_bug.cgi?id=97191 Reference: https://bugzilla.kernel.org/show_bug.cgi?id=97271 Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: tests: sort image filesDavid Sterba2015-05-25
| | | | | | | If a test has several images let filenames enforce a particular order of checks if desired. Signed-off-by: David Sterba <dsterba@suse.cz>