summaryrefslogtreecommitdiff
path: root/btrfs-debug-tree.c
Commit message (Collapse)AuthorAge
* btrfs-progs: Fix 2 extent buffer leak in btrfs-debug-treeQu Wenruo2015-02-11
| | | | | | | | | | | | | | There are 2 known extent buffer leaks: 1) With -t option. -t option will skip other tree roots, but it will read the root node first and then skip it. Where it forgets to free the tree block it read. 2) with -b option. It forgets to free the tree block it read. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: read_tree_block() and read_node_slot() cleanup.Qu Wenruo2015-02-02
| | | | | | | | | | | | Allow read_tree_block() and read_node_slot() to return error pointer. This should help caller to get more specified error number. For existing callers, change (!eb) judgmentt to (!extent_buffer_uptodate(eb)) to keep the compatibility, and for caller missing the check, use PTR_ERR(eb) if possible. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: autoconf: use standard PACKAGE_* macrosKarel Zak2015-01-28
| | | | | | | | | | | | | - use standard PACKAGE_{NAME,VERSION,STRING,URL,...} autoconf macros rather than homemade BTRFS_BUILD_VERSION - don't #include version.h, now the file is necessary for library API only Note that "btrfs version" returns "btrfs-progs <version>" instead of the original confusing "btrfs <version>". Signed-off-by: Karel Zak <kzak@redhat.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: Allow debug-tree to be executed on regular file.Qu Wenruo2015-01-09
| | | | | | | | | | | The commit 1bad43fbe002 ("btrfs-progs: refine btrfs-debug-tree error prompt when a mount point given") add judgement on btrfs-debug-tree to restrict only block device to be executed on, but the command can also be used on regular file, so add regular file support for the judgement. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: refine btrfs-debug-tree error prompt when a mount point givenGui Hecheng2014-12-29
| | | | | | | | | | | | | | | | | Now, if exec: # btrfs-debug-tree <mount_point> it echos: : Superblock bytenr is larger than device size But it is quite misleading, because it is a valid btrfs. In this case, we should tell the developer to provide a block device. After apply: : '<mount_point>' is not a block device Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com> Reviewed-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: use check_argc_* to check arg number for all toolsGui Hecheng2014-08-22
| | | | | | | | | | | | Since this patch: btrfs-progs: move the check_argc_* functions into utils.c All tools including the independent tools(e.g. btrfs-image, btrfs-convert) can share the convenience of the check_argc_* functions, so this patch adopt the argc check functions globally. Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* Btrfs-progs: debug-tree, add option to dump a single treeFilipe David Borba Manana2014-08-22
| | | | | | | | | | | | | | | | Very often while debugging filesystems with many subvolumes and/or snapshots, specially when they are large, I want to see only the content of one of the trees. So this change just adds an option to btrfs-debug-tree to allow to specify the id of the tree we're interesting in dumping to stdout. Example: btrfs-debug-tree -t 257 /dev/sdc Will only dump the tree of the first snapshot or subvolume that was created. Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: prevent close_root if the root to close is potentially NULLGui Hecheng2014-05-02
| | | | | | | | | | Originally only if 'block_only' is specified, the 'fs_root == NULL' will be checked. But if 'block_only' is not specified and close_root will be called blindly without checking 'fs_root == NULL', which is unsafe. Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* Btrfs-progs: switch to arg_strtou64() part2Wang Shilong2014-03-21
| | | | | | Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <clm@fb.com>
* btrfs-progs: define BTRFS_UUID_UNPARSE_SIZE for uuid unparse buf sizeAnand Jain2014-01-31
| | | | | | | | | we use 37 as the allocation size to hold the uuid_unparse, here it defines BTRFS_UUID_UNPARSE_SIZE for the same. Signed-off-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <clm@fb.com>
* Btrfs-progs: rework open_ctree to take flags, add a new one V2Josef Bacik2013-11-07
| | | | | | | | | | | So I needed to add a flag to not try to read block groups when doing --init-extent-tree since we could hang there, but that meant adding a whole other 0/1 type flag to open_ctree_fs_info. So instead I've converted it all over to using a flags setting and added the flag that I needed. This has been tested with xfstests and make test. Thanks, Signed-off-by: Josef Bacik <jbacik@fusionio.com> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* Btrfs-progs: add -b to btrfsck to look at backup rootsJosef Bacik2013-11-07
| | | | | | | | | | In some cases the tree root is so hosed we can't get anything useful out of it. So add the -b option to btrfsck to make us look for the most recent backup tree root to use for repair. Then we can hopefully get ourselves into a working state. Thanks, Signed-off-by: Josef Bacik <jbacik@fusionio.com> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* btrfs-progs: drop unused parameter from btrfs_release_pathEric Sandeen2013-09-03
| | | | | | | | | | | | | | | Port of commit b3b4aa7 to userspace. parameter tree root it's not used since commit 5f39d397dfbe140a14edecd4e73c34ce23c4f9ee ("Btrfs: Create extent_buffer interface for large blocksizes") This gets userspace a tad closer to kernelspace by removing this unused parameter that was all over the codebase... Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* Btrfs-progs: add option to btrfs-debug-tree to print uuid tree onlyStefan Behrens2013-08-09
| | | | | | Signed-off-by: Stefan Behrens <sbehrens@giantdisaster.de> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* Btrfs-progs: Add missing close_ctree() calls to debug-treeFilipe David Borba Manana2013-08-09
| | | | | | Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* Btrfs-progs: Add missing free_extent_buffer() call to debug-treeFilipe David Borba Manana2013-08-09
| | | | | | Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* 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>