summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAge
* btrfs-progs: Factor out common print_device_infoNikolay Borisov2018-01-31
| | | | | | | | | This function has been copied twice in chunk-recover and super-recover. Factor it out into utils.c/h and use it. No functional changes. Signed-off-by: Nikolay Borisov <nborisov@suse.com> Reviewed-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: Explictly state test.sh must be executableNikolay Borisov2018-01-31
| | | | | | Signed-off-by: Nikolay Borisov <nborisov@suse.com> Reviewed-by: <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: build: simplify version trackingDavid Sterba2018-01-31
| | | | | | | | | | | | There will be a plain file tracking the last released version. The rest will be simplified to print it where needed. The version augmented by the current git status was not working anyway since we've switched to autoconf. The result of version.h with the potential git status was generated at configure time, which does not mean it's accurate regarding the git status. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: bump zstd version in CI to 1.3.3David Sterba2018-01-31
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: Print error on invalid extent item format during checkNikolay Borisov2018-01-31
| | | | | | | | | | | While performing normal mode check if the code comes across an invalid extent format it will just BUG() and exit without printing any useful information for debugging. Improve the situation by outputting the key/leaf bytenr/slot which will enable to quickly inspect the tree and see what the corruption is. Signed-off-by: Nikolay Borisov <nborisov@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: check: report more specific info about invalid locationSu Yue2018-01-08
| | | | | | | | | | | Previously, it was so useless to print message like "invalid location %d". Let it print objectid and offset of the dir_item too. Signed-off-by: Su Yue <suy.fnst@cn.fujitsu.com> Reviewed-by: Nikolay Borisov <nborisov@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: fix typo in error messageDavid Sterba2018-01-08
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: build: Remove unused variable TESTSGu Jinxiang2018-01-08
| | | | | | | Variable is never used. Signed-off-by: Gu Jinxiang <gujx@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: Remove unused parameter transGu Jinxiang2018-01-08
| | | | | | | | Some parameter of trans is not used indeed. Let's remove them. Signed-off-by: Gu Jinxiang <gujx@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: qgroup: cleanup __qgroup_searchLu Fengqi2018-01-08
| | | | | | | | Replace the if statement with the switch statement, and return the appropriate value for the future use rather than directly exit. Signed-off-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: qgroup: move btrfs_show_qgroups's error handler to __qgroup_searchLu Fengqi2018-01-08
| | | | | | | | | | | | We have to process the return value of BTRFS_IOC_TREE_SEARCH ioctl in advance, so that we can distinguish between the two case where quota is not enabled (ioctl return -ENOENT) and either parent qgroup or child qgroup does not exist (update_qgroup_relation return -ENOENT). Besides this, any error in this routine has been reported, so we don't need to report again in cmd_qgroup_show. Signed-off-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: Fix build of btrfs-calc-sizeHans van Kranenburg2018-01-08
| | | | | | | Build would fail because it couldn't find the usage function. Signed-off-by: Hans van Kranenburg <hans@knorrie.org> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: Fix progs_extra build dependenciesHans van Kranenburg2018-01-08
| | | | | | | | | | | | | The Makefile does not have a dependency path that builds dependencies for tools listed in progs_extra. E.g. doing make btrfs-show-super in a clean build environment results in: gcc: error: cmds-inspect-dump-super.o: No such file or directory Makefile:389: recipe for target 'btrfs-show-super' failed Signed-off-by: Hans van Kranenburg <hans@knorrie.org> Signed-off-by: Hugo Mills <hugo@carfax.org.uk> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: docs: update manual for mkfs --shrinkDavid Sterba2018-01-08
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests/mkfs: verify that mkfs.btrfs rootdir+shrink behaves correctlyQu Wenruo2018-01-08
| | | | | Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: mkfs: Use the whole file or block device to mkfs for rootdirQu Wenruo2018-01-08
| | | | | | | | | | | | | | | For --rootdir, even for large existing file or block device, it will always shrink the resulting filesystem. The problem is, mkfs.btrfs will try to calculate the dir size, and use it as @block_count to mkfs, which makes the filesystem shrunk. Fix it by trying to get the original block device or file size as @block_count, so mkfs.btrfs can use the full file/block device for --rootdir option. Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests/mkfs: Introduce test case to check if mkfs rootdir can ↵Qu Wenruo2018-01-08
| | | | | | | | | | | create a new file To test regression 460e93f25754 ("btrfs-progs: mkfs: check the status of file at mkfs"). Signed-off-by: Qu Wenruo <wqu@suse.com> [ update test to create a out of /tmp ] Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: mkfs: fix regression preventing --rootdir to create fileQu Wenruo2018-01-08
| | | | | | | | | | | | | | | | Commit 460e93f25754 ("btrfs-progs: mkfs: check the status of file at mkfs") will try to check the file state before creating fs on it. The check is mostly fine for normal mkfs case, while for --rootdir option, it's allowed to create a new file if the destination file doesn't exist. Fix it by allowing non-existent file if --rootdir is specified. Fixes: 460e93f25754 ("btrfs-progs: mkfs: check the status of file at mkfs") Signed-off-by: Qu Wenruo <wqu@suse.com> Reviewed-by: Tomohiro Misono <misono.tomohiro@jp.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: mkfs: Separate shrink from rootdirQu Wenruo2018-01-08
| | | | | | | | | | | | | Make --shrink a separate option for --rootdir, and change the default to off. The shrinking behaviour is not a commonly used feature but can be useful for creating minimal pre-filled images, in one step, without requiring to mount. Signed-off-by: Qu Wenruo <wqu@suse.com> [ update changelog and error messages ] Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: mkfs/rootdir: Shrink fs for rootdir optionQu Wenruo2018-01-08
| | | | | | | | | | Use the new dev extent based shrink method for rootdir option. This restores the original behaviour when --rootdir will create a minimal filesystem size. Signed-off-by: Qu Wenruo <wqu@suse.com> [ update changelog ] Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: mkfs/rootdir: Use over-reserve method to make size estimate easierQu Wenruo2018-01-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use an easier method to calculate the estimate device size for mkfs.btrfs --rootdir. The new method will over-estimate, but should ensure we won't encounter ENOSPC. It relies on the following data: 1) number of inodes -- for metadata chunk size 2) rounded up data size of each regular inode -- for data chunk size Total meta chunk size = round_up(nr_inode * (PATH_MAX * 3 + sectorsize), min_chunk_size) * profile_multiplier PATH_MAX is the maximum size possible for INODE_REF/DIR_INDEX/DIR_ITEM. Sectorsize is the maximum size possible for inline extent. min_chunk_size is 8M for SINGLE, and 32M for DUP, get from btrfs_alloc_chunk(). profile_multiplier is 1 for Single, 2 for DUP. Total data chunk size is much easier. Total data chunk size = round_up(total_data_usage, min_chunk_size) * profile_multiplier Total_data_usage is the sum of *rounded up* size of each regular inode use. min_chunk_size is 8M for SINGLE, 64M for DUP, get from btrfS_alloc_chunk(). Same profile_multiplier for meta. This over-estimate calculate is, of course inacurrate, but since we will later shrink the fs to its real usage, it doesn't matter much now. Signed-off-by: Qu Wenruo <wqu@suse.com> [ update comments ] Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: mkfs: Don't use custom chunk allocator for rootdirQu Wenruo2018-01-08
| | | | | | | | | | | | | | Remove the custom chunk allocator for mkfs. It is buggy in connection to the --rootdir option and puts file data to the reerved 1M area. The feature of the custom allocator was to reserve only minimal amount of blockgroup space. This will temporarily stop working and will need an explicit request by option, added by following patches. Use the generic chunk allocator. Signed-off-by: Qu Wenruo <wqu@suse.com> [ update changelog ] Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: mkfs: Cleanup temporary chunks before filling rootdirQu Wenruo2018-01-08
| | | | | | | | | Cleanup of temporary chunks should be done as soon as possible, and it should be especially before doing large tree operations, like filling the filesystem when using --rootdir. Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: mkfs: Update allocation info before verbose outputQu Wenruo2018-01-08
| | | | | | | | | | | Since new --rootdir can allocate chunk, it will modify the chunk allocation result. This patch will update allocation info before verbose output to reflect such info. Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: mkfs/rootdir: Introduce function to get end position of last ↵Qu Wenruo2018-01-08
| | | | | | | | | device extent Useful for later 'mkfs.btrfs --rootdir' shrink support. Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: test/mkfs: Test if the minimal device size is validQu Wenruo2018-01-08
| | | | | | | | | New test case to test if the minimal device size given by "mkfs.btrfs" failure case is valid. Signed-off-by: Qu Wenruo <wqu@suse.com> [ renamed script ] Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: mkfs: move source dir size calculation to its own filesQu Wenruo2018-01-08
| | | | | | | | Also rename the function from size_sourcedir() to mkfs_size_dir(). Signed-off-by: Qu Wenruo <wqu@suse.com> Reviewed-by: Nikolay Borisov <nborisov@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: mkfs: move image creation of rootdir to its own filesQu Wenruo2018-01-08
| | | | | | | | | | | | In fact, --rootdir option is getting more and more independent from normal mkfs code. So move image creation function, make_image() and its related code to mkfs/rootdir.[ch], and rename the function to btrfs_mkfs_fill_dir(). Signed-off-by: Qu Wenruo <wqu@suse.com> Reviewed-by: Nikolay Borisov <nborisov@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* Btrfs progs v4.14.1David Sterba2018-01-05
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: update CHANGES for v4.14.1David Sterba2018-01-05
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: docs: annual typo, clarity, & grammar review & fixupsNicholas D Steeves2018-01-03
| | | | | Signed-off-by: Nicholas D Steeves <nsteeves@gmail.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests/convert: ensure btrfs-convert won't rollback the ↵Qu Wenruo2018-01-03
| | | | | | | | filesystem after balance Signed-off-by: Qu Wenruo <wqu@suse.com> [ add shell quotes, rename test ] Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: convert: Fix a bug in rollback check which overwrite return valueQu Wenruo2018-01-03
| | | | | | | | | | | | | | | | | Commit 1170ac307900 ("btrfs-progs: convert: Introduce function to check if convert image is able to be rolled back") reworked rollback check condition, by checking 1:1 mapping of each file extent. The idea itself has nothing wrong, but error handler is not implemented correctly, which over writes the return value and always try to rollback the fs even it fails to pass the check. Fix it by correctly return the error before rollback the fs. Fixes: 1170ac307900 ("btrfs-progs: convert: Introduce function to check if convert image is able to be rolled back") Reported-by: Jeff Mahoney <jeffm@suse.com> Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: docs: fix typo in btrfs-man5Faalagorn2018-01-03
| | | | | | Pull-request: #81 Author: Faalagorn <faalagorn@gmail.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: docs: make option -A of mkfs less visibleDavid Sterba2018-01-03
| | | | | | | The option will be removed in the future, move it to the end of the list. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: build: specify minimal library version for reiserfs supportDavid Sterba2018-01-03
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: fi defrag: clean up duplicate code if find errorsSu Yue2018-01-03
| | | | | | | | | | In function cmd_filesystem_defrag(), lines of code for error handling are duplicate and hard to expand in further. Create a jump label for errors. Signed-off-by: Su Yue <suy.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: mkfs: Only zero out the first 1M for rootdirQu Wenruo2018-01-03
| | | | | | | | | It's a waste of IO to fill the whole image before creating btrfs on it, just wiping the first 1M, and then write 1 byte to the last position to create a sparse file. Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: mkfs: Enhance minimal device size calculation to fix mkfs ↵Qu Wenruo2018-01-03
| | | | | | | | | | | | | | | | | | | | | | failure on small file Since commit c11e36a29e84 ("Btrfs-progs: Do not force mixed block group creation unless '-M' option is specified"), mkfs no longer use mixed block group unless specified manually. This breaks the minimal device size calculation, which only considered mixed block group use case. This patch enhances minimal device size calculation for mkfs, by using different minimal stripe length (calculated from code) for different profiles, and use them to calculate minimal device size. Reported-by: Wesley Aptekar-Cassels <W.Aptekar@gmail.com> Fixes: c11e36a29e84 ("Btrfs-progs: Do not force mixed block group creation unless '-M' option is specified") Signed-off-by: Qu Wenruo <wqu@suse.com> Reviewed-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com> [ updated comments ] Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: test/common: Enhance prepare_test_dev to reset device sizeQu Wenruo2018-01-03
| | | | | | | | | So prepare_test_dev() can be called several times in one test case, to test different device sizes. Signed-off-by: Qu Wenruo <wqu@suse.com> [ switch to [ ] ] Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: test/common: Introduce run_mustfail_stdoutQu Wenruo2018-01-03
| | | | | | | For later test case which needs info from stderr. Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: fix typos in test namesDavid Sterba2018-01-03
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: mkfs: check the status of file at mkfsMisono, Tomohiro2018-01-03
| | | | | | | | | | | | | Currently, only the status of block devices is checked at mkfs, but we should also check for regular files whether they are already formatted or mounted to prevent overwrite accidentally. Device status is checked by test_dev_for_mkfs(). The part which is not related to block device is split from this and used for both block device and regular file. Signed-off-by: Tomohiro Misono <misono.tomohiro@jp.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: mkfs/008 mkfs with forceDavid Sterba2018-01-03
| | | | | | | With extended tests in the following patch a file based filesystem image also needs -f, otherwise it will fail. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: test/fsck/021: Cleanup custom check by overriding check_imageQu Wenruo2018-01-03
| | | | | | Signed-off-by: Qu Wenruo <wqu@suse.com> [ update comment ] Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: test/fsck/020: Cleanup custom check function by overriding ↵Qu Wenruo2018-01-03
| | | | | | | check_image function Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: test/fsck: Introduce test images containing tree reloc treeQu Wenruo2018-01-03
| | | | | | | | | | | | | Reloc tree is a special tree with very short life span. It acts as a special snapshot for any tree, with related nodes/leaves or EXTENT_DATA modified to point to new position. Considering the short life span and its special purpose, it should be quite reasonable to keep them as both corner case for fsck and educational dump for anyone interested in relocation. Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: lowmem check: Reword an unclear error message about file extent gapLu Fengqi2018-01-03
| | | | | | | | This error occurs when no_holes is not set, but there is a gap before the file extent. Signed-off-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: docs: update btrfs-subvolume manual pageHoward2018-01-03
| | | | | | | | | To simplify, I suggest moving the 'writable/readonly' issue only to the -r line, instead of having it introduced in two places. Pull-request: #80 Author: Howard <hwj@BridgeportContractor.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: dump_tree: remove superfluous _TREEHans van Kranenburg2018-01-03
| | | | | | | | | | | | | -# btrfs inspect-internal dump-tree -t fs /dev/block/device ERROR: unrecognized tree id: fs Without this fix I can't dump-tree fs, but I can dump-tree fs_tree and also fs_tree_tree, which is a bit silly. Reviewed-by: Qu Wenruo <wqu@suse.com> Signed-off-by: Hans van Kranenburg <hans@knorrie.org> Reviewed-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>