aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* btrfs-progs: convert: Fix a bug leads to discontinuous extentsQu Wenruo2016-07-041-1/+3
| | | | | | | | | | | | | | Btrfs_record_file_extent() will split extents using max extent size(128M). It works well for real file extents, but not that well for large hole extent, as hole doesn't have extent size limit. In that case, it will only insert one 128M hole, and skip the rest, leading to discontinuous extent error for converted btrfs. Fix it by not splitting hole extents. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: 001-simple-unmounted: fix test failure due to bashismLuis Henriques2016-07-041-1/+1
| | | | | | | | | | | | | | | | | | The usage of 'source' is a bashism, and '.' should be used instead. This is causing fuzz-tests/001-simple-unmounted to fail in systems where /bin/sh isn't bash: [TEST/fuzz] 001-simple-unmounted ./test.sh: 5: ./test.sh: source: not found ./test.sh: 7: ./test.sh: setup_root_helper: not found ./test.sh: 8: ./test.sh: check_prereq: not found ./test.sh: 18: ./test.sh: check_all_images: not found Since most (all?) tests actually use /bin/bash, change this test to use bash too. Signed-off-by: Luis Henriques <henrix@camandro.org> Signed-off-by: David Sterba <dsterba@suse.com>
* Btrfs progs v4.6.1v4.6.1David Sterba2016-06-241-1/+1
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: update CHANGES for 4.6.1David Sterba2016-06-241-0/+9
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: build: check if FIEMAP_EXTENT_SHARED is definedDavid Sterba2016-06-241-0/+2
| | | | | | Detect the macro at configure time rather than during compilation. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: build: add m4 macros for AC_CHECK_DEFINEDavid Sterba2016-06-241-0/+92
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: build: let autotools include m4David Sterba2016-06-242-4/+3
| | | | | | We'll need some non-standard macro definitions. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: fi show: print error message if no valid Btrfs is specifiedSatoru Takeuchi2016-06-241-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | * Before this patch =============================== # ./btrfs fi show foo # "foo" doesn't mean any valid Btrfs # # no error message # echo $? 1 =============================== * After this patch =============================== # ./btrfs fi show foo ERROR: foo is not a valid Btrfs # # echo $? 1 =============================== Signed-off-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: fix filesytem type creation for convert testsDavid Sterba2016-06-222-10/+10
| | | | | | | | The extN filesystem type was lost when the separate tests were created and we've been testing only ext2. The tests pass for ext3 and ext4 though. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: add 005-delete-all-rollbackDavid Sterba2016-06-221-0/+61
| | | | | | Test if a rollback works after deleing all files from btrfs. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: update READMEDavid Sterba2016-06-222-11/+30
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: add test consoleDavid Sterba2016-06-222-0/+24
| | | | | | | | Add a wrapper that sets up environment the same way a test would use it. Use it for quick prototyping or testing, the commands and output is logged. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: print shorter test name in the outputDavid Sterba2016-06-221-5/+6
| | | | | | | The full path is printed, we're interested in the last path component only. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: split convert_testDavid Sterba2016-06-221-23/+70
| | | | | | | Split the big function to several helpers so we can use them separately. Add comments and do minor tweaks. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: docs: update 'btrfs-device' manual pageDavid Sterba2016-06-211-53/+152
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: free qgroup counts in btrfsckMark Fasheh2016-06-173-0/+16
| | | | | Signed-off-by: Mark Fasheh <mfasheh@suse.de> Signed-off-by: David Sterba <dsterba@suse.com>
* Btrfs-progs: Initialize stripesize to the value of sectorsizeChandan Rajendra2016-06-172-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | stripesize should ideally be set to the value of sectorsize. However previous versions of btrfs-progs/mkfs.btrfs had set stripesize to a value of 4096. On machines with PAGE_SIZE other than 4096, This could lead to the following scenario, - /dev/loop0, /dev/loop1 and /dev/loop2 are mounted as a single filesystem. The filesystem was created by an older version of mkfs.btrfs which set stripesize to 4k. - losetup -a /dev/loop0: [0030]:19477 (/root/disk-imgs/file-0.img) /dev/loop1: [0030]:16577 (/root/disk-imgs/file-1.img) /dev/loop2: [64770]:3423229 (/root/disk-imgs/file-2.img) - /etc/mtab lists only /dev/loop0 - losetup /dev/loop4 /root/disk-imgs/file-1.img The new mkfs.btrfs invoked as 'mkfs.btrfs -f /dev/loop4' succeeds even though /dev/loop1 has already been mounted and has /root/disk-imgs/file-1.img as its backing file. The above behaviour occurs because check_super() function returns an error code (due to stripesize not being set to 4096) and hence check_mounted_where() function treats /dev/loop1 as a disk containing a filesystem other than Btrfs. Hence as a workaround this commit allows 4096 as a valid stripesize. Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: qgroup: Fix a bug that fails to skip rescan running caseQu Wenruo2016-06-171-2/+7
| | | | | | | | | | | | | | | | Commit 6bdf962fe35a8648d(btrfs-progs: Read qgroup status for qgroup verify) will read qgroup status, and then use it to skip qgroup reporting. However since the rescan_running/inconsistent flags are only 1 bit long, while qgroup flags & BTRFS_QGROUP_FLAGS returns value longer than 1bit, it doesn't work. Fix it by doing double negation on (flags & BTRFS_QGROUP_FLAGS) to convert it to either 1 or 0. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: docs: update btrfs-restore manual pageDavid Sterba2016-06-171-19/+36
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: add 003-fi-resize-argsDavid Sterba2016-06-171-0/+46
| | | | | | Check various resize option combinations. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: fi resize: fix parsing of negative argumentDavid Sterba2016-06-171-1/+1
| | | | | | | | | The cleanup of option parsing caused a regression where the negative resize argument is recognized as short options and the command fails. Use the new helper to allow that. Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=119971 Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: new helper for option parsing, more permissive for "no options"David Sterba2016-06-172-0/+20
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: doc: correct the destination of btrfs-receiveSatoru Takeuchi2016-06-141-3/+3
| | | | | | | | We can set not only btrfs mount point but also any path belong to btrfs mount point as btrfs-receive's destination. Signed-off-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: doc: add missing newline in btrfs-convertNoah Massey2016-06-141-0/+1
| | | | | Signed-off-by: Noah Massey <noah.massey@gmail.com> Signed-off-by: David Sterba <dsterba@suse.com>
* Btrfs progs v4.6David Sterba2016-06-101-1/+1
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: update CHANGES for 4.6David Sterba2016-06-101-0/+18
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: convert: Fix a bug which fails to insert hole file extentQu Wenruo2016-06-071-1/+5
| | | | | | | | | | | | | | | | | | When copying inode, if there is a file referring part of a hole range, convert will fail. The problem is, when calculating real extent bytenr, it doesn't check if the original extent is a hole. In case the orinal extent is a hole, we still calculate bytenr using file_pos - found_extent_file_pos, causing non-zero value, and later btrfs_record_file_extent() detects that we are pointing to non-exist extent and aborts convert. Fix it by checking the disk_bytenr before calculating real disk bytenr. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: convert: Insert needed holes for superblock migrationQu Wenruo2016-06-071-0/+16
| | | | | | | | | | | | | | | | | | | New convert doesn't insert holes for superblock migration range. Unlike the old design, which only relocates 4K (superblock size) to other places. In the new design, to make sure convert can handle different page sizes and align chunks bytenr, we relocate the whole 64K range. And if there is only a 4K used block inside 64K superblock migration range, it will make converted the fs have discontiguous file extents. This patch will fix it by inserting needed holes to avoid such discontinuous error. Reported-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com> Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: convert: Fix bugs in backup superblock migrationQu Wenruo2016-06-071-2/+45
| | | | | | | | | | | | | | | | | | | | New convert has several bugs with backup superblock migration 1) Backup superblocks are not migrated due to incorrect condition Two wrong checks cause backup superblocks not to be migrated at all 2) Converted ext* image doesn't keep hole for backup superblocks Since we are creating file extents according to tmp_used, which has wiped out backup superblock ranges. In that case, later superblock migration will fail, since migration will insert file extent range into ext* image. Fix above bugs will make convert on ext2 image filled about 100M data successful. Reported-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com> Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: convert: Fix a bug that makes convert asserts at scan timeQu Wenruo2016-06-071-7/+74
| | | | | | | | | | | | | | | | | When a ext2 fs filled with a 57M file, it's possible that convert fails with assert in add_merge_cache_extent(). The problem is that the ext2 used space just takes some of the second superblock. And due to a bug in reserving superblock space, it corrupted used space tree and cause assert. Fix in by doing better used space merging for case where superblock range is inside the ext2 used space. Reported-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com> Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: convert: Add support to rollback new convert imageQu Wenruo2016-06-071-1/+78
| | | | | | | | | | | | For new btrfs-convert, it's less restrict for metadata chunk allocation. While the may_rollback() function is still following the restrict 1:1 mapping check for all chunks, it will not allow some new convert image to be rolled back. Add new per extent check for new convert to allow it to be rolled back. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: Cleanup old btrfs-convertQu Wenruo2016-06-073-1355/+9
| | | | | | | | | | | | | | | | | | | | | | Cleanup all the old btrfs-convert facilities, including: 1) btrfs_convert_operations->alloc/free/test_extents* No need to do non-standard extent allocation. After init_btrfs() everything can be done by normal routine. Now only 4 functions are needed in btrfs_convert_operations. 1) open_fs 2) read_used_space 3) copy_inodes 4) close_fs 2) fs_info->extent_ops Same as above. 3) Old init_btrfs(), create_image(), create_file_image_range() Replaced with newer and cleaner one. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: convert: Strictly avoid meta or system chunk allocationQu Wenruo2016-06-073-0/+21
| | | | | | | | | | | | | Before this patch, btrfs-convert only rely on large enough initial system/metadata chunk size to ensure no newer system/meta chunk will be created. But that's not safe enough. So add two new members in fs_info, avoid_sys/meta_chunk_alloc flags to prevent any newer system or meta chunks to be created before init_btrfs_v2(). Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: Convert: Add support for rollback new convert behaviorQu Wenruo2016-06-071-5/+14
| | | | | | | | | | | | | | | | | | | | Add support to rollback new btrfs-convert. The support is quite easy unlike the new convert behavior, which in fact makes the rollback less restricted. The core is, rollback must support both old and new convert result. For old convert, all fs image extents can be covered by any chunk type. But any extents inside reserved range must be covered by chunk. For new convert, all fs image extents are covered by data chunk. Allowing any condition will just make another fail to pass. So make the convert condition a little less restricted to allow both can be converted. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: Introduce do_convert_v2 functionQu Wenruo2016-06-071-1/+176
| | | | | | | | Introduce new function do_convert_v2() to do new convert. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> [ use __strncpy_null for label ] Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: convert: Introduce init_btrfs_v2 function.Qu Wenruo2016-06-071-0/+61
| | | | | | | | | | | Introduce new init_btrfs_v2() function for later newer do_convert(). Since we have good enough chunk allocation, a lot of wired chunk hack won't ever be used. We only need to insert data chunks and create needed subvolume. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: convert: Enhance record_file_blocks to handle reserved rangesQu Wenruo2016-06-071-9/+94
| | | | | | | | | | | | | | | Enhance record_file_blocks() to handle reserved ranges. Old file system can use the space in btrfs reserved ranges. So we could not use the bytenr of old filesystem directly. Thanks to previous patches, we have a full fs image in convert_root, and it has already relocated the blocks in reserved ranges. So here we just search the convert_root to get correct disk_bytenr and use it. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: convert: Introduce function to migrate reserved rangesQu Wenruo2016-06-071-2/+122
| | | | | | | | | | | | | Introduce new function, migrate_reserved_ranges() to migrate used fs data in btrfs reserved space. Unlike old implementation, which will need to relocate all the complicated csum and reference relocation, previous patches already ensure such reserved ranges won't be allocated. So here we only need copy these data out and create new extent/csum/reference. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: convert: Introduce new function to create converted imageQu Wenruo2016-06-071-0/+184
| | | | | | | | | | | Use new function, create_convert_image_v2() to create snapshot of old filesystem. Unlike old function which is called after copying all inodes, this function need to be called before copying inodes. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: extent-tree: Enhance btrfs_record_file_extentQu Wenruo2016-06-072-51/+115
| | | | | | | | | | | | | | Btrfs_record_file_extent() has some small problems like: 1) Can't handle overlapping extents 2) May create extent larger than BTRFS_MAX_EXTENT_SIZE So enhance it using previously added facilites. This is used for later btrfs-convert, as for new convert, we create saved image first, then copy inode. Which will also cause extent overlapping. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: extent-tree: Introduce function to find the first overlapping ↵Qu Wenruo2016-06-073-0/+89
| | | | | | | | | | | | extent Introduce a new function, btrfs_search_overlap_extent() to find the first overlapping extent. It's useful for later btrfs-convert rework. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: Introduce function to create convert data chunksQu Wenruo2016-06-074-14/+86
| | | | | | | | | | | Introduce new function, make_convert_data_chunks(), to build up data chunks for convert. It will call a modified version of btrfs_alloc_data_chunk() to force data chunks to covert all known ext* data. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: Introduce function to setup temporary extent treeQu Wenruo2016-06-071-1/+197
| | | | | | | | Introduce new function, setup_temporary_extent_tree() to build a temporary extent tree for make_btrfs_v2(). Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: Introduce function to initialize csum treeQu Wenruo2016-06-071-0/+25
| | | | | | | | Introduce new function, setup_temp_csum_tree(), to setup temporary csum tree for make_btrfs_v2(). Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: Introduce function to initialize fs treeQu Wenruo2016-06-071-0/+26
| | | | | | | | Introudce new function, setup_temp_fs_tree(), to setup temporary fs tree for make_btrfs_v2(). Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: Introduce function to initialize device treeQu Wenruo2016-06-071-1/+55
| | | | | | | | Introduce new function, setup_temp_device_tree(), to setup temporary device tree for make_btrfs_v2(). Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: Introduce function to setup temporary chunk rootQu Wenruo2016-06-071-0/+171
| | | | | | | | Introduce new function, setup_temp_chunk_root(), to initialize temporary chunk root for make_btrfs_v2(). Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: Introduce function to setup temporary tree rootQu Wenruo2016-06-071-0/+147
| | | | | | | | | | | | | | Introduce new function, setup_temp_tree_root(), to initialize temporary tree root for make_btrfs_v2(). The new function will setup tree root at metadata chunk and ensure data won't be written into metadata chunk. Also, new make_btrfs_v2() will have a much better code structure than old make_btrfs(). Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: Introduce function to setup temporary superblockQu Wenruo2016-06-071-0/+116
| | | | | | | | | Introduce a new function, setup_temp_super(), to setup temporary super for make_btrfs_v2(). Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> [ use __strncpy_null in setup_temp_super ] Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: utils: Introduce new function for convertQu Wenruo2016-06-074-26/+118
| | | | | | | | | | | | | | | | Introduce new function make_convert_btrfs() for convert. This new function will have the following features: 1) Allocate temporary sb/metadata/system chunk, avoiding old used data 2) More structured functions No more over 1000 lines function, better function split and code reuse This will finally replace current make_btrfs(), but now only used for convert. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>