summaryrefslogtreecommitdiff
path: root/find-root.c
Commit message (Collapse)AuthorAge
* btrfs-progs: drop blocksize from read_tree_blockDavid Sterba2017-09-08
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: Refactor btrfs_next_bg and its callers 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: replace leafsize with nodesizeDavid Sterba2016-05-02
| | | | | | | | Nodesize is used in kernel, the values are always equal. We have to keep leafsize in headers, similarly the tree setting functions still take and set leafsize, but it's effectively a no-op. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: find-root: Allow btrfs-find-root to search chunk root even ↵Qu Wenruo2016-02-26
| | | | | | | | | | | | | chunk root is corrupted Since now open_ctree_fs_info() can even return a valid fs_info with only system chunk mapping from super block, use this ability to do chunk root search for heavily damanged fs. As an fast alternative for time consuming and buggy chunk-recovery. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: find-root: Add support to search chunk rootQu Wenruo2015-11-16
| | | | | | | | | | Add support to search chunk root, as we only need to search tree roots in system chunk, which should be very easy to add, just iterate in system chunks. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> [ renamed to btrfs_next_bg_* ] Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: find-root: fix a bug that will cause wrong resultQu Wenruo2015-08-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | [BUG] btrfs-find-root may not output desire result, as due to search_extent_cache() may return a result that doesn't cover the desired range, generation cache can be screwed up if higher generation tree root is found before lower generation tree root. For example: ======= ./btrfs-find-root /dev/sda6 -a Superblock thinks the generation is 8 Superblock thinks the level is 0 adding bytenr: 4194304, gen: 8 <<< Debug output adding bytenr: 24715264, gen: 7 <<< gen is 7 at read_tree_block time Well block 4194304(gen: 8 level: 0) seems good, and it matches superblock Well block 24715264(gen: 8 level: 0) seems good, and it matches superblock <<< But its gen is wrong at result output time ======= [Fix] Add a new check to make sure the search_extent_cache() is returning the desired result. Reported-by: Marc Merlin <marc@merlins.org> Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: Add new find-root.[ch] infrastructureQu Wenruo2015-02-11
| | | | | | | | | | | | | Introduce new find-root.[ch] infrastructure which has better tree root judgment and uses much less codes to do it. The new infrastructure will only record tree blocks with highest level among its generation, and do better judgment whether the found tree block is the desired one(level + generation check other than the original generation only check). Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: standardize tool source filenamesEric Sandeen2013-04-24
| | | | | | | | | | | | | | For any btrfs-$FOO executable, rename the main source file from $FOO.c to to btrfs-$FOO.c This makes it slightly more obvious what's building what, and allows us to write a default rule in the Makefile for these tools. (also add btrfs-calc-size to the list of objects to remove on make clean) Signed-off-by: Eric Sandeen <sandeen@redhat.com>
* Btrfs-progs: alloc our super copy in btrfs-find-rootJosef Bacik2013-03-12
| | | | | | | | | Dave fixed the fs_info to allocate the super copy instead of embedding it, but he failed to notice that I open code open_ctree in btrfs-find-root so we end up with a super that's not allocated, so we segfault whenever you try to run btrfs-find-root. I've fixed this up and now we don't segfault anymore. Thanks, Signed-off-by: Josef Bacik <jbacik@fusionio.com>
* btrfs-progs: separate super_copy out of fs_infoDavid Sterba2013-03-10
| | | | | | | | | Allocate fs_info::super_copy dynamically of full BTRFS_SUPER_INFO_SIZE and use it directly for saving superblock to disk. This fixes incorrect superblock checksum after mkfs. Signed-off-by: David Sterba <dsterba@suse.cz>
* Merge branch 'cov-fixes-v1-integration-20130201' of ↵Chris Mason2013-02-06
|\ | | | | | | http://git.zabbo.net/cgit/btrfs-progs into merged
| * btrfs-progs: remove duplicate __setup_rootEric Sandeen2013-02-05
| | | | | | | | | | | | | | | | | | __setup_root() was present in find-root.c as well as disk-io.c. No need for the cut and paste, just use the one in disk-io.c Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Zach Brown <zab@redhat.com>
| * btrfs-progs: don't leak multi-bio in find_root()Zach Brown2013-02-05
| | | | | | | | | | | | It wasn't freed if it didn't find metadata. Signed-off-by: Zach Brown <zab@redhat.com>
* | Merge branch 'for-chris' of git://repo.or.cz/btrfs-progs-unstable/devel into ↵Chris Mason2013-02-06
|\| | | | | | | | | | | | | | | | | raid56 Conflicts: ctree.h Signed-off-by: Chris Mason <chris.mason@fusionio.com>
| * btrfs-progs: update options in find-root.cWang Sheng-Hui2013-01-26
| | | | | | | | | | | | | | Remove the useless option "-v" and add the option "-o" in the description of usage. Signed-off-by: Wang Sheng-Hui <shhuiw@gmail.com>
| * btrfs-progs: Handle errors returned from open_ctreeDanny Kukawka2013-01-21
| | | | | | | | | | Signed-off-by: Danny Kukawka <danny.kukawka@bisect.de> Signed-off-by: David Sterba <dsterba@suse.cz>
* | Add basic RAID[56] supportDavid Woodhouse2013-02-01
|/ | | | | | | | | | | | | | | | David Woodhouse originally contributed this code, and Chris Mason changed it around to reflect the current design goals for raid56. The original code expected all metadata and data writes to be full stripes. This meant metadata block size == stripe size, and had a few other restrictions. This version allows metadata blocks smaller than the stripe size. It implements both raid5 and raid6, although it does not have code to rebuild from parity if one of the drives is missing or incorrect. Signed-off-by: David Woodhouse <David.Woodhouse@intel.com> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* btrfs-progs: add a recovery utility to pull files from damanged filesystemsJosef Bacik2011-10-27
Signed-off-by: Josef Bacik <josef@redhat.com> Signed-off-by: Chris Mason <chris.mason@oracle.com>