summaryrefslogtreecommitdiff
path: root/image/main.c
Commit message (Collapse)AuthorAge
* btrfs-progs: drop blocksize argument from readahead_tree_blockDavid Sterba2017-09-08
| | | | | | | Tree blocks are always nodesize. As readahead is only an optimization, exact size is not required and is only advisory. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: drop blocksize from read_tree_blockDavid Sterba2017-09-08
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: drop local blocksize variables if they're nodesizeDavid Sterba2017-09-08
| | | | | | Prep work so we can drop the blocksize argument from several functions. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: image: fix typos in messagesAdam Buchbinder2017-07-20
| | | | | | Signed-off-by: Adam Buchbinder <abuchbinder@google.com> [ separated from the previous patch ] Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: image: Fix data races when reporting progressAdam Buchbinder2017-07-20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Making the code data-race safe requires that reads *and* writes happen under a mutex lock, if any of the access are writes. See Dmitri Vyukov, "Benign data races: what could possibly go wrong?" for more details. The fix here was to put most of the main loop of restore_worker under a mutex lock. This race was detected using fsck-tests/012-leaf-corruption. ================== WARNING: ThreadSanitizer: data race Write of size 4 by main thread: #0 add_cluster btrfs-progs/image/main.c:1931 #1 restore_metadump btrfs-progs/image/main.c:2566 #2 main btrfs-progs/image/main.c:2859 Previous read of size 4 by thread T6: #0 restore_worker btrfs-progs/image/main.c:1720 Location is stack of main thread. Thread T6 (running) created by main thread at: #0 pthread_create <null> #1 mdrestore_init btrfs-progs/image/main.c:1868 #2 restore_metadump btrfs-progs/image/main.c:2534 #3 main btrfs-progs/image/main.c:2859 SUMMARY: ThreadSanitizer: data race btrfs-progs/image/main.c:1931 in add_cluster Signed-off-by: Adam Buchbinder <abuchbinder@google.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: Refactor btrfs_readahead_tree_block to use btrfs_fs_infoQu Wenruo2017-07-12
| | | | | Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: Refactor read_extent_data to use btrfs_fs_infoQu Wenruo2017-07-12
| | | | | Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: Refactor btrfs_num_copies to use btrfs_fs_infoQu Wenruo2017-07-12
| | | | | Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: Refactor read_tree_block to get rid of btrfs_rootQu Wenruo2017-07-03
| | | | | | | | | | | | | The only reasom read_tree_block() needs a btrfs_root parameter is to get its node/sector size. And long ago, I have already introduced a compactible interface, read_tree_block_fs_info() to pass btrfs_fs_info instead of btrfs_root. Since we have cleaned up all root->sector/node/stripesize users, we should be OK to refactor read_tree_block() function. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
* btrfs-progs: Refactor nodesize users in image/main.cQu Wenruo2017-07-03
| | | | Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
* btrfs-progs: Fix restoring image from multi devices fs into single deviceFilipe Manana2017-06-26
| | | | | | | | | | | | | | | | | | | | | | | | | We correctly build an image from a multiple devices filesystem but when restoring the image into a single device we were missing updating the number of devices in the superblock to the value 1 (we already took care of setting the number of stripes to 1 for each chunk item and setting the device id for each chunk item to match the device id from the super block). This missing update of the number of devices makes it impossible to mount the restored filesystem on recent kernels, more specifically since the linux kernel commit 99e3ecfcb9f4ca35192d20a5bea158b81f600062 ("Btrfs: add more validation checks for superblock"), that produce the following message in the dmesg/syslog: [21097.542047] BTRFS error (device sdi): super_num_devices 2 mismatch with num_devices 1 found here [21097.543972] BTRFS error (device sdi): failed to read chunk tree: -22 [21097.720360] BTRFS error (device sdi): open_ctree failed So fix this by updating the number of devices to 1 in the superblock. Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: Liu Bo <bo.li.liu@oracle.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: image: remove unused argument from copy_log_treesDavid Sterba2017-03-08
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: move help defines to own headerDavid Sterba2017-03-08
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: sanitize - Use correct source for memcpyGoldwyn Rodrigues2017-01-25
| | | | | | | | | While performing a memcpy, we are copying from uninitialized dst as opposed to src->data. Though using eb->len is correct, I used src->len to make it more readable. Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: Fix spelling/typos in user-facing stringsNicholas D Steeves2017-01-25
| | | | | Signed-off-by: Nicholas D Steeves <nsteeves@gmail.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: remove extra newline from messagesDavid Sterba2016-12-14
| | | | | | The common message helpers add the newline. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: move btrfs-image sources to own directoryDavid Sterba2016-11-24
There are no pending patches to btrfs-image, this looks like a good time to move it. Signed-off-by: David Sterba <dsterba@suse.com>