summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAge
...
* btrfs-progs: check: Move check_dev_size_alignment to check/common.cQu Wenruo2018-02-02
| | | | | | Reviewed-by: Su Yue <suy.fnst@cn.fujitsu.com> Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: check: Move link_inode_to_lostfound function to common.cQu Wenruo2018-02-02
| | | | | | Reviewed-by: Su Yue <suy.fnst@cn.fujitsu.com> Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: check: Move __create_inode_item function to check/common.cQu Wenruo2018-02-02
| | | | | | | | | Move __create_inode_item() function to check/common.c and rename it to insert_inode_item(), with comment added. Reviewed-by: Su Yue <suy.fnst@cn.fujitsu.com> Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: check: Move count_csum_range function to check/common.cQu Wenruo2018-02-02
| | | | | | | | | | | | Despite of moving it to check/common.c, also: 1) Add extra comment of the function 2) Change @root parameter to @fs_info Since @root is never used, csum_root is picked from fs_info anyway. Reviewed-by: Su Yue <suy.fnst@cn.fujitsu.com> Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: check: Move fs_root_objectid function to check/common.hQu Wenruo2018-02-02
| | | | | | | | Just another small wrapper shared between original and lowmem mode. Reviewed-by: Su Yue <suy.fnst@cn.fujitsu.com> Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: check: Move imode_to_type function to check/common.hQu Wenruo2018-02-02
| | | | | | | | | This function is shared between original and lowmem mode, and it's small enough, so move it to check/common.h. Reviewed-by: Su Yue <suy.fnst@cn.fujitsu.com> Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: check: Export check global variables to check/common.hQu Wenruo2018-02-02
| | | | | | | | | | | | | | | | There are a dozen of variables which are used as "check global" variables, like @total_csum_bytes or @no_holes. These variables are used freely across the check code, however since we're splitting check code, they need to be exported so they can be used in other files. This patch just export them and add declarations for them in check/common.h. Reviewed-by: Su Yue <suy.fnst@cn.fujitsu.com> Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: check: Move node_refs structure to check/common.hQu Wenruo2018-02-02
| | | | | | Reviewed-by: Su Yue <suy.fnst@cn.fujitsu.com> Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: check: Move definitions of lowmem mode to check/lowmem.hQu Wenruo2018-02-02
| | | | | | | | | Unlike original mode, lowmem mode mostly uses normal tree operations, so no structure definitions, only a lot of random error bits. Reviewed-by: Su Yue <suy.fnst@cn.fujitsu.com> Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: check: Move original mode definitions to check/original.hQu Wenruo2018-02-02
| | | | | | Reviewed-by: Su Yue <suy.fnst@cn.fujitsu.com> Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: Move cmds-check.c to check/main.cQu Wenruo2018-02-02
| | | | | | Reviewed-by: Su Yue <suy.fnst@cn.fujitsu.com> Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: chang tree-reloc-tree test number from 027 to 015Qu Wenruo2018-02-02
| | | | | | | | | | | | There are 2 fsck tests with the same number 027: tree-reloc-tree bad-extent-inline-ref-type And we also have a hole in 015, so just rename tree-reloc-tree to 015, to get rid of the duplicated test number and fill in the hole. Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: Cleanup use of root in leaf_data_endGu Jinxiang2018-02-02
| | | | | | | | | | | | | In function leaf_data_end, root is just used to get fs_info, so change the parameter of this function from btrfs_root to btrfs_fs_info. And also make it consistent with kernel. Add const to parameter leaf of function btrfs_item_offset_nr to keep type consistent with leaf_data_end. Signed-off-by: Gu Jinxiang <gujx@cn.fujitsu.com> Reviewed-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: remove no longer used btrfs_alloc_extentGu Jinxiang2018-02-02
| | | | | | | | Function btrfs_alloc_extent is no longer be used. So let's remove it. Reviewed-by: Qu Wenruo <wqu@suse.com> Signed-off-by: Gu Jinxiang <gujx@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: do clean up for redundancy value assignmentGu Jinxiang2018-02-02
| | | | | | | | | | Although skinny_metadata's type is int, its value just can be 0/1. And if condition be true only when skinny_metadata equals 1, so in if's executive part, set skinny_metadata to 1 is redundancy. Remove it. Reviewed-by: Qu Wenruo <wqu@suse.com> Signed-off-by: Gu Jinxiang <gujx@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: Use fs_info instead of root for BTRFS_MAX_XATTR_SIZEGu Jinxiang2018-02-02
| | | | | | | | | | | | Do a cleanup. Also make it consistent with kernel. Use fs_info instead of root for BTRFS_MAX_XATTR_SIZE, since maybe in some situation we do not know root, but just know fs_info. To be consistent with kernel, change macro to inline function. Signed-off-by: Gu Jinxiang <gujx@cn.fujitsu.com> Reviewed-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: Sync code with kernel for BTRFS_MAX_INLINE_DATA_SIZEGu Jinxiang2018-02-02
| | | | | | | | | | | | | Do a cleanup. Also make it consistent with kernel. Use fs_info instead of root for BTRFS_MAX_INLINE_DATA_SIZE, since maybe in some situation we do not know root, but just know fs_info. Change macro to inline function to be consistent with kernel. And change the function body to match kernel. Signed-off-by: Gu Jinxiang <gujx@cn.fujitsu.com> Reviewed-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: Use fs_info instead of root for BTRFS_NODEPTRS_PER_BLOCKGu Jinxiang2018-02-02
| | | | | | | | | | | | Do a cleanup. Also make it consistent with kernel. Use fs_info instead of root for BTRFS_NODEPTRS_PER_BLOCK, since maybe in some situation we do not know root, but just know fs_info. To be consistent with kernel, change macro to inline function. Signed-off-by: Gu Jinxiang <gujx@cn.fujitsu.com> Reviewed-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: Use fs_info instead of root for BTRFS_LEAF_DATA_SIZEGu Jinxiang2018-02-02
| | | | | | | | | | Do a cleanup. Also make it consistent with kernel. Use fs_info instead of root for BTRFS_LEAF_DATA_SIZE, since maybe in some situation we do not know root, but just know fs_info. Signed-off-by: Gu Jinxiang <gujx@cn.fujitsu.com> Reviewed-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* Btrfs progs v4.15David Sterba2018-02-02
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: update CHANGES for v4.15David Sterba2018-01-31
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: docs: fix typo in btrfs-filesystem manual pageWilliam Giokas2018-01-31
| | | | | | Pull-request: #86 Signed-off-by: William Giokas <1007380@gmail.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: fixup mount tests of fsck/028-unaligned-super-dev-sizesDavid Sterba2018-01-31
| | | | | | | This test was broken because it tried to mount a different image than what it had repaired. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: enhance common umount helper to take optional pathsDavid Sterba2018-01-31
| | | | | | | | | | | The run_check_umount_test_dev umounts the TEST_DEV and also optionally uses the arguments but this would not work as expected if the TEST_DEV is not a vald path for umount (eg. a restored image). Update the helper so it tries to umount all paths, or fallback to TEST_DEV to keep the current behaviour. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: disable some mkfs/010 testcases inside travisDavid Sterba2018-01-31
| | | | | | | | | Node sizes larger than 16k will fail due to enospc in the mount test. This is likely caused by the kernel. Keep the condition only local to travis so any other testing environment could see the failure eventually. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: docs: clean all generated filesDavid Sterba2018-01-31
| | | | | | The section 3 manual page btrfs-ioctl was not deleted. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: build: update help text for zstdDavid Sterba2018-01-31
| | | | | | | The enable/disable does not take an argument and we don't autodetect zstd anymore. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: Remove unnecessary parameter for btrfs_add_block_groupQu Wenruo2018-01-31
| | | | | | | | | | @chunk_objectid of btrfs_make_block_group() function is always fixed to BTRFS_FIRST_FREE_OBJECTID, so there is no need to pass it as parameter explicitly. 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: treewide: Replace strerror(errno) with %m.Rosen Penev2018-01-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As btrfs is specific to Linux, %m can be used instead of strerror(errno) in format strings. This has some size reduction benefits for embedded systems. glibc, musl, and uclibc-ng all support %m as a modifier to printf. A quick glance at the BIONIC libc source indicates that it has support for %m as well. BSDs and Windows do not but I do believe them to be beyond the scope of btrfs-progs. Compiled sizes on Ubuntu 16.04: Before: 3916512 btrfs 233688 libbtrfs.so.0.1 4899 bcp 2367672 btrfs-convert 2208488 btrfs-corrupt-block 13302 btrfs-debugfs 2152160 btrfs-debug-tree 2136024 btrfs-find-root 2287592 btrfs-image 2144600 btrfs-map-logical 2130760 btrfs-select-super 2152608 btrfstune 2131760 btrfs-zero-log 2277752 mkfs.btrfs 9166 show-blocks After: 3908744 btrfs 233256 libbtrfs.so.0.1 4899 bcp 2366560 btrfs-convert 2207432 btrfs-corrupt-block 13302 btrfs-debugfs 2151104 btrfs-debug-tree 2134968 btrfs-find-root 2281864 btrfs-image 2143536 btrfs-map-logical 2129704 btrfs-select-super 2151552 btrfstune 2130696 btrfs-zero-log 2276272 mkfs.btrfs 9166 show-blocks Total savings: 23928 (24 kilo)bytes Signed-off-by: Rosen Penev <rosenp@gmail.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: don't clobber errno in close_file_or_dirDavid Sterba2018-01-31
| | | | | | | | Preserve the errno value for the caller in case closing happens in the middle of eg. an ioctl and reporing the failure. The errors that could happen in close/closedir do not bother us. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: volumes: Remove unnecessary parameters when allocating device ↵Qu Wenruo2018-01-31
| | | | | | | | | | | | | | | extent @chunk_tree and @chunk_objectid of device extent is fixed to BTRFS_CHUNK_TREE_OBJECTID and BTRFS_FIRST_CHUNK_TREE_OBJECTID respectively. There is no need to pass them as parameter explicitly. Signed-off-by: Qu Wenruo <wqu@suse.com> Reviewed-by: Nikolay Borisov <nborisov@suse.com> Reviewed-by: Su Yue <suy.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: volumes: Remove unnecessary trans parameterQu Wenruo2018-01-31
| | | | | | | | | | | | | Remove @trans parameter for find_free_dev_extent_start() and its callers. The function itself is doing read-only tree search, no use of transaction. Signed-off-by: Qu Wenruo <wqu@suse.com> Reviewed-by: Nikolay Borisov <nborisov@suse.com> Reviewed-by: Su Yue <suy.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: volumes: Make find_free_dev_extent_start staticQu Wenruo2018-01-31
| | | | | | | | | | The function is not used by anyone else outside of volumes.c, make it static. Signed-off-by: Qu Wenruo <wqu@suse.com> Reviewed-by: Nikolay Borisov <nborisov@suse.com> Reviewed-by: Su Yue <suy.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: Use bool parameter to determine if we're allocating data extentQu Wenruo2018-01-31
| | | | | | | | | | | | | | | btrfs_reserve_extent() uses int @data to determine if we're allocating data extent, while reuse the parameter later to pass it as profile (data/meta/sys). It's a little confusing, this patch will follow kernel parameter to use bool @is_data to replace it. And in btrfs_reserve_extent(), use dedicated u64 @profile. Signed-off-by: Qu Wenruo <wqu@suse.com> Reviewed-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: truncate test image to 0 firstDavid Sterba2018-01-31
| | | | | | | | We use the prepare_test_dev helper to make sure the image has at least this size. The "at least" part is not desired by some tests as the device might be larger than the test expects. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: add more coverage to mkfs-tests/013-reserved-1M-for-singleDavid Sterba2018-01-31
| | | | | | | Though the newly added mkfs profiles should not be affected, let's add the remaining valid single device profiles for better coverage. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: mkfs: don't overwrite first 1M for singleQu Wenruo2018-01-31
| | | | | | | | | Add test case to check if the first device extent is occupying reserved 0~1M range. 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: tests:mkfs/010: Output minimal device sizeQu Wenruo2018-01-31
| | | | | | | To make debugging a little easier. Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: mkfs: Prevent temporary system chunk to use space in reserved ↵Qu Wenruo2018-01-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1M range When creating btrfs, mkfs.btrfs will firstly create a temporary system chunk as basis, and then created needed trees or new devices. However the layout temporary system chunk is hard-coded and uses reserved [0, 1M) range of devid 1. Change the temporary chunk layout from old: 0 1M 4M 5M |<----------- temp chunk -------------->| And it's 1:1 mapped, which means it's a SINGLE chunk, and stripe offset is also 0. to new layout: 0 1M 4M 5M |<----------- temp chunk -------------->| And still keeps the 1:1 mapping. However this also affects btrfs_min_dev_size() which still assume temporary chunks starts at device offset 0. The problem can only be exposed by "-m single" or "-M" where we reuse the temporary chunk. With other meta profiles, system and meta chunks are allocated by later btrfs_alloc_chunk() call, and old SINGLE chunks are removed, so it will be no such problem for other meta profiles. Reported-by: Nikolay Borisov <nborisov@suse.com> Signed-off-by: Qu Wenruo <wqu@suse.com> Tested-by: Nikolay Borisov <nborisov@suse.com> Reviewed-by: Nikolay Borisov <nborisov@suse.com> [ folded fix for the minimal device size calculation ] Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: 029-super-recovery: cleanup the testDavid Sterba2018-01-31
| | | | | | | Transform the test to the common helpers and don't manage the loop devices here. The test category changes from check to misc. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: Add test for super block recoveryNikolay Borisov2018-01-31
| | | | | | | | | This functionality regressed some time ago and it was never caught. Seems no one complained of that, but to be sure add a regression test to prevent future regressions. Signed-off-by: Nikolay Borisov <nborisov@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: super-recover: fix the broken sb detectionNikolay Borisov2018-01-31
| | | | | | | | | | | | | | | | | | | Commit 3296d058b7ce ("btrfs-progs: super-recover: Reuse btrfs_read_dev_super function") changed the logic when a superblock is added to the bad block list to depend on -EIO. However currently btrfs_read_dev_super doesn't return -EIO when the fist super block is broken. Instead it returns -1. This causes the super-recovery logic to miss the fact that the first super block is completely broken. Fix this by considering any error code from btrfs_read_dev_super other than -ENOENT to mean that the super block is corrupted. -ENOENT means that the superblock copy is not part of the fs i.e. it's smaller than the offset of the block. This can only occur for the 2nd copy at 256gb mark. 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: Document logic of btrfs_read_dev_superNikolay Borisov2018-01-31
| | | | | | 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: Replace usage of list_for_each with list_for_each_entryNikolay Borisov2018-01-31
| | | | | | | | | | | | | There are a couple of places where instead of the more succinct list_for_each_entry the code uses list_for_each. This results in slightly more code with no additional benefit as well as no coherent pattern. This patch makes the code uniform. No functional changes. Signed-off-by: Nikolay Borisov <nborisov@suse.com> Reviewed-by: Qu Wenruo <wqu@suse.com> [ remove unused variable in uuid_search ] Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: Remove recover_get_good_superNikolay Borisov2018-01-31
| | | | | | | | | | Currently getting the good super really consists of just getting the first entry on the linked list, since it's the one with the highest transid. So remove the function and just use list_first_entry directly. 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: 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>