David Sterba [Mon, 2 Feb 2015 14:32:11 +0000 (15:32 +0100)]
btrfs-progs: mkfs, align help strings
Signed-off-by: David Sterba <dsterba@suse.cz>
David Sterba [Mon, 23 Mar 2015 17:45:56 +0000 (18:45 +0100)]
btrfs-progs: convert, add long options for all short options
Signed-off-by: David Sterba <dsterba@suse.cz>
Qu Wenruo [Fri, 27 Feb 2015 08:26:38 +0000 (16:26 +0800)]
btrfs-progs: Print warning message if qgroup data is inconsistent
Before this patch, qgroup show won't check btrfs qgroup status, so even
the INCONSISTENT flags is set, user is not aware of it.
This patch will include BTRFS_QGROUP_STATUS_ITEM in the search range and
check the flag, if there is any flag meaning the inconsistence of qgroup
data, info user.
NOTE: There is several kernel bugs from INCONSISTENT flags is always set
to RUNNING flags is not cleared until umount.
So this warning will always be here if using a newer kernel fixing these
bugs.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Qu Wenruo [Fri, 27 Feb 2015 08:26:37 +0000 (16:26 +0800)]
btrfs-progs: Add stack get/set functions for btrfs_qgroup_status_item
This provides the basis for later qgroup related changes.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Qu Wenruo [Fri, 27 Feb 2015 08:26:36 +0000 (16:26 +0800)]
btrfs-progs: Allow parse_qgroupid() to resolve subvolume path into qgroupid
Now parse_qgroupid() can resolve subvolume path into qgroupid.
This is quite handy for handling level 0 qgroupid, and user don't need
to resolve rootid by hand now.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
[constify string in __is_subvol]
Signed-off-by: David Sterba <dsterba@suse.cz>
Qu Wenruo [Fri, 27 Feb 2015 08:26:35 +0000 (16:26 +0800)]
btrfs-progs: Move parse_qgroupid() to utils.c
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
[constified strings in parse_qgroupid]
Signed-off-by: David Sterba <dsterba@suse.cz>
Qu Wenruo [Fri, 27 Feb 2015 08:26:34 +0000 (16:26 +0800)]
btrfs-progs: Allow btrfs-debug-tree to print human readable qgroup status flag.
Now btrfs-debug-tree can print qgroup status flag as ON|INCONSISTENT
instead of 0x5.
BTW, this patch helped us to find a bug that INCONSISTENT flag is never
cleared in kernel.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
[renamed to qgroup_flags_to_str]
Signed-off-by: David Sterba <dsterba@suse.cz>
Qu Wenruo [Fri, 27 Feb 2015 08:26:33 +0000 (16:26 +0800)]
btrfs-progs: Update qgroup status flags and replace qgroup level/subvid calculation with inline function
Ctree.h of btrfs-progs contains wrong flags for btrfs_qgroup_status.
Update it with the one in kernel.
Also, introduce the inline function btrfs_qgroup_(level/subvid) to get
the level/subvolid of qgroup, to replace the old open-coded bit
operations.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Gui Hecheng [Mon, 22 Sep 2014 08:29:28 +0000 (16:29 +0800)]
btrfs-progs: restore, fix page alignment issue for lzo compression
When runing restore under lzo compression, "bad compress length"
problems are encountered.
It is because there is a page alignment problem with the @decompress_lzo,
as follows:
|------| |----|-| |------|...|------|
page ^ page page
|
3 bytes left
When lzo pages are compressed in memory, we will ensure that the 4 bytes
length header will not cross a page boundary. There is a situation that
3 (or less) bytes are left at the end of a page, and then the 4 bytes
len is stored at the start of the next page. But the @decompress_lzo
doesn't go to the start of the next page and continue to read the next 4
bytes which crosses two pages, so a random value is fetched as a "bad
compress length".
So we check page alignment every time before we are going to fetch the
next @len and after the former piece of data is decompressed. If the
current page that we reach has less than 4 bytes left, then we should
fetch the next @len at the start of next page.
Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com>
[simplifed and moved into decompress_lzo]
Signed-off-by: David Sterba <dsterba@suse.cz>
David Sterba [Mon, 23 Mar 2015 22:07:32 +0000 (23:07 +0100)]
btrfs-progs: completion: add fi and dev usage commands
Signed-off-by: David Sterba <dsterba@suse.cz>
David Sterba [Mon, 23 Mar 2015 17:27:19 +0000 (18:27 +0100)]
btrfs-progs: convert, fix typo in getopt value
Unfortunatelly GETOPT_VAL_IEC is not equal to GETOPT_VAL_NO_PROGRESS
so --no-progress had no effect.
Signed-off-by: David Sterba <dsterba@suse.cz>
David Sterba [Mon, 23 Mar 2015 15:57:03 +0000 (16:57 +0100)]
btrfs-progs: convert tests: add remaining supported nodesizes
That's 8k, 32k and 64k.
Signed-off-by: David Sterba <dsterba@suse.cz>
Sebastian Thorarensen [Fri, 20 Mar 2015 01:11:29 +0000 (02:11 +0100)]
btrfs-progs: Add nodesize test for btrfs-convert
convert-tests now test both 4096 and 16384 nodesizes.
Signed-off-by: Sebastian Thorarensen <sebth@naju.se>
Signed-off-by: David Sterba <dsterba@suse.cz>
Sebastian Thorarensen [Fri, 20 Mar 2015 01:11:11 +0000 (02:11 +0100)]
btrfs-progs: btrfs-convert: Allow setting nodesize
Allow btrfs-convert to use nodesizes other than 4096. It defaults to
max(16384, pagesize), like mkfs.
Signed-off-by: Sebastian Thorarensen <sebth@naju.se>
Signed-off-by: David Sterba <dsterba@suse.cz>
Sebastian Thorarensen [Fri, 20 Mar 2015 01:10:39 +0000 (02:10 +0100)]
btrfs-progs: Fix msgs in check_node_or_leaf_size
check_node_or_leaf_size in utils.c now prints 'nodesize (or leafsize)'
instead of 'leafsize (or nodesize)' in the error messages, in order to
be less confusing for the user, as leafsize in mkfs is deprecated.
'ERROR: ' is also prepended to be consistent with other error messages.
Signed-off-by: Sebastian Thorarensen <sebth@naju.se>
Signed-off-by: David Sterba <dsterba@suse.cz>
Sebastian Thorarensen [Fri, 20 Mar 2015 01:10:15 +0000 (02:10 +0100)]
btrfs-progs: mkfs: Move out some nodesize code
Move the constant DEFAULT_MKFS_LEAF_SIZE to utils.h and rename it to
BTRFS_MKFS_DEFAULT_NODE_SIZE for consistency. Move the function
check_leaf_or_node_size to utils.c and rename it to
btrfs_check_node_or_leaf_size.
Signed-off-by: Sebastian Thorarensen <sebth@naju.se>
[added btrfs_ prefix]
Signed-off-by: David Sterba <dsterba@suse.cz>
David Sterba [Tue, 17 Mar 2015 13:41:01 +0000 (14:41 +0100)]
btrfs-progs: fi usage, fix reporting space for degraded mounts
The total size of devices was summed from raw partition size which is
wrong in two ways:
- if the device is missing, the size is 0 and it mismatches the size
summed from chunks, leading to bogus numbers like
Device unallocated: 16.00EiB
Used: 1.88TiB
Free (estimated): 8.00EiB (min: 8.00EiB)
- we should really account the device size that's occupied by btrfs, not
the real partition size altough it's the same most of the time
The sum of missing devices is now printed in the summary and any missing
device path is replaced with 'missing' instead of blank:
Data,RAID1: Size:972.00GiB, Used:962.15GiB
972.00GiB
/dev/sdb1 972.00GiB
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=94911
Reported-by: <raffix@web.de>
Signed-off-by: David Sterba <dsterba@suse.cz>
Lokesh Mandvekar [Mon, 16 Mar 2015 17:10:51 +0000 (12:10 -0500)]
btrfs-progs: re-introduce BTRFS_BUILD_VERSION in version.h
The macro is in a public header and breaks build of some applications.
Signed-off-by: Lokesh Mandvekar <lsm5@fedoraproject.org>
[edit changelog]
Signed-off-by: David Sterba <dsterba@suse.cz>
David Sterba [Wed, 11 Mar 2015 12:40:48 +0000 (13:40 +0100)]
Btrfs progs v3.19
Signed-off-by: David Sterba <dsterba@suse.cz>
David Sterba [Tue, 10 Mar 2015 13:11:18 +0000 (14:11 +0100)]
btrfs-progs: tests, common: fix typo after cleanup
The previous value for unknown was -1.
Reported-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
David Sterba [Mon, 9 Mar 2015 11:55:26 +0000 (12:55 +0100)]
Btrfs progs v3.19-rc3
Signed-off-by: David Sterba <dsterba@suse.cz>
David Sterba [Mon, 9 Mar 2015 11:30:26 +0000 (12:30 +0100)]
btrfs-progs: tests, clean up scripts
Rename variables, use caps, call true by full path, add quotation to
variables and a few wording fixes.
Signed-off-by: David Sterba <dsterba@suse.cz>
Qu Wenruo [Mon, 2 Mar 2015 03:41:50 +0000 (11:41 +0800)]
btrfs-progs: fsck-test: Add check_sudo to check valid root/sudo privilege
Although fsck-test/012 uses sudo, it uses 'sudo -n', which won't prompt
user to input password and will return 1 if no valid credential is
found.
And this makes test result quite annoying since it fails to mount and
still continue, which will always fail.
This patch will check 'sudo -v -n' and 'sudo -n true' to determine
whether sudo works fine in different version/settings, since in some
setting/version, 'sudo -v -n' will fail even the user is set NOPASSWD.
Also, remove the 'have_root_helper' variant, since there is a
possibility that sudo credential will timeout during the test and
'have_root_helper' won't help to detect such problem.
New '_sudo' command will do credential check if needed to avoid such
problem.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
David Sterba [Mon, 9 Mar 2015 11:06:22 +0000 (12:06 +0100)]
btrfs-progs: convert, adjust help text formatting
Signed-off-by: David Sterba <dsterba@suse.cz>
David Sterba [Mon, 9 Mar 2015 10:56:04 +0000 (11:56 +0100)]
btrfs-progs: convert, add option to disable progress
With progress turned on by default we should be able to disable it
as well.
Reported-by: Jérôme Poulin <jeromepoulin@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
David Sterba [Fri, 27 Feb 2015 17:17:45 +0000 (18:17 +0100)]
btrfs-progs: update INSTALL
Signed-off-by: David Sterba <dsterba@suse.cz>
Augusto Mecking Caringi [Sat, 31 May 2014 06:24:46 +0000 (03:24 -0300)]
btrfs-progs: Add more detailed package bdependency information to INSTALL file
Signed-off-by: Augusto Mecking Caringi <augustocaringi@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Shriramana Sharma [Sun, 30 Nov 2014 13:42:46 +0000 (19:12 +0530)]
btrfs-progs: doc: clarify toplevel subvolid
Signed-off-by: Shriramana Sharma <samjnaa@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Qu Wenruo [Tue, 27 Jan 2015 03:12:43 +0000 (11:12 +0800)]
btrfs-progs: Move (set/clear_)extent_buffer_uptodate() to extent_io.h.
Unlike kernel, these functions in userland just test/set/clear a member.
So move them to header to avoid extra function call cost.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Qu Wenruo [Mon, 26 Jan 2015 05:53:02 +0000 (13:53 +0800)]
btrfs-progs: Make csum tree rebuild works with extent tree rebuild.
Before this patch, csum tree rebuild will not work with extent tree
rebuild, since extent tree rebuild will only build up basic block
groups, but csum tree rebuild needs data extents to rebuild.
So if one use btrfsck with --init-csum-tree and --init-extent-tree, csum
tree will be empty and tons of "missing csum" error will be outputted.
This patch allows csum tree rebuild get its data from fs/subvol trees
using regular file extents (which is also the only one using csum tree
currently).
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
[renamed to fill_csum_tree_from_one_fs_root]
Signed-off-by: David Sterba <dsterba@suse.cz>
Fan Chengniang [Tue, 10 Feb 2015 10:23:13 +0000 (18:23 +0800)]
btrfs-progs: use correct the return value
The return values 12 and 13 are not used spectially except as return
value. No description and definition about them. so I change them to
generic errno.
Signed-off-by: Fan Chengniang <fancn.fnst@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
David Sterba [Fri, 27 Feb 2015 15:30:05 +0000 (16:30 +0100)]
btrfs-progs: convert: show progress by default
Agreed by several people, showing progress by default makes sense as
conversion is a one-time and long running action.
Signed-off-by: David Sterba <dsterba@suse.cz>
Qu Wenruo [Mon, 23 Feb 2015 08:00:04 +0000 (16:00 +0800)]
btrfs-progs: Fix a infinite loop when fixing nlink if file name conflicts twice.
There is a case that can cause nlink fix function.
For example, lost+found dir already has the following files:
---------------------------
|ino |filename |
|-------------------------|
|258 |normal_file |
|259 |normal_file.260 |
---------------------------
The next inode to be fixed is the following:
---------------------------
|260 |normail_file |
---------------------------
And when trying to move inode to lost+found dir, its file name conflicts
with inode 258, and even add ".INO" suffix, it still conflicts with
inode 259.
Since the move failed, the LINK_COUNT_ERR flag is not cleared, the inode
record will not be freed, btrfsck will try fix it again and again,
causing the infinite loop.
The patch will first change the ".INO" suffix naming to a loop behavior,
and clear the LINK_COUNT_ERR flag anyway to avoid infinite loop.
Reported-by: Naohiro Aota <naota@elisp.net>
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Stefan Tatschner [Sat, 21 Feb 2015 11:12:42 +0000 (12:12 +0100)]
btrfs-progs: docs: fixed a grammar mistake
Signed-off-by: Stefan Tatschner <stefan@sevenbyte.org>
Signed-off-by: David Sterba <dsterba@suse.cz>
David Sterba [Fri, 13 Feb 2015 13:49:31 +0000 (14:49 +0100)]
btrfs-progs: version.sh: simplify printing the version
Signed-off-by: David Sterba <dsterba@suse.cz>
David Sterba [Fri, 13 Feb 2015 13:39:43 +0000 (14:39 +0100)]
btrfs-progs: autoconf: define package url manually if not set
The PACKAGE_URL is set from optional parameter of AC_INIT starting in
autoconf 2.64. There are enterprise distros with version 2.63, we can
make the build work there easily as well.
Fixes build failure:
mkfs.c: In function ?main?:
mkfs.c:1492: error: ?PACKAGE_URL? undeclared (first use in this function)
Reported-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
David Sterba [Thu, 12 Feb 2015 12:41:00 +0000 (13:41 +0100)]
btrfs-progs: fix typo in OPEN_CTREE flag
Introduced in "btrfs-progs: Add new btrfs_open_ctree_flags CHUNK_ONLY"
by my local fixups.
Signed-off-by: David Sterba <dsterba@suse.cz>
Qu Wenruo [Wed, 11 Feb 2015 01:57:17 +0000 (09:57 +0800)]
btrfs-progs: Fix 2 extent buffer leak in btrfs-debug-tree
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>
Qu Wenruo [Wed, 11 Feb 2015 00:46:24 +0000 (08:46 +0800)]
btrfs-progs: Move -rdynamic linker only option to LDFLAGS
Same thing as clang cleanup patch commit
040b3f11ba6b5555d793a9ef79ed4d9032d22370
"btrfs-progs: Makefile: Move linker only option to LDFLAGS"
But the move to autoconfig seems using old Makefile.
So do it again.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
David Sterba [Wed, 11 Feb 2015 17:35:12 +0000 (18:35 +0100)]
Merge branch 'qu/find-root-v3-part1' into v3.19.x
Qu Wenruo [Fri, 16 Jan 2015 11:32:54 +0000 (19:32 +0800)]
btrfs-progs: find-root, add option to search through all the metadata extents
Add option '-a' for btrfs-find-root to iterate all the metadata extents
even the root is already found.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Qu Wenruo [Fri, 16 Jan 2015 08:40:50 +0000 (16:40 +0800)]
btrfs-progs: Cleanup unneeded btrfs-find-root codes
Since we switched to new open_ctree flag and new find-root facility,
there is no need to keep the old find-root codes.
Clean it up.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Qu Wenruo [Fri, 16 Jan 2015 08:22:09 +0000 (16:22 +0800)]
btrfs-progs: Switch btrfs-find-root to use the find-root infrastructure
Since the new find-root infrastructure is here with better root
judgement with less codes, just switch to it.
To switch to the new infrastructure, new print function is added and
output format is slighted changed.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Qu Wenruo [Fri, 16 Jan 2015 07:32:35 +0000 (15:32 +0800)]
btrfs-progs: Add better search generation judgment for btrfs-find-root
Before the patch, btrfs-find-root will only consider it find a good root
if its generation matches generation in superblock and its level is
currently found highest level.
But that's not correct in 2 ways.
1) Root with decreased level
Since tree level can decrease, like subvolume/file deletion.
Which will make the new root have higher generation but lower level.
2) Root not updated in latest transaction.
If there is some root not updated in latest transaction, its generation
will be smaller than the one in superblock, and btrfs-find-root will not
find it.
This patch will use different generation for different tree to search,
solving the above problems.
Currently, it only supports generation/level in superblock. Using tree
root level/generation if possible will be introduced later.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Qu Wenruo [Fri, 16 Jan 2015 06:30:02 +0000 (14:30 +0800)]
btrfs-progs: Switch btrfs-find-root to use the new open_ctree flags
Since in previous patches, we introduced the new open_ctree flag
OPEN_CTREE_CHUNK_ROOT_ONLY, switch btrfs-find-root to use it instead of
the open_ctree_broken().
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Qu Wenruo [Fri, 16 Jan 2015 05:58:45 +0000 (13:58 +0800)]
btrfs-progs: Add new find-root.[ch] infrastructure
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>
Qu Wenruo [Fri, 16 Jan 2015 03:22:28 +0000 (11:22 +0800)]
btrfs-progs: Add new btrfs_open_ctree_flags CHUNK_ONLY
Add new flag CHUNK_ONLY and internal used only flag __RETURN_CHUNK.
CHUNK_ONLY will imply __RETURN_CHUNK, SUPPRESS_ERROR and PARTIAL, which
will allow the fs to be opened with only chunk tree OK.
This will improve the usability for btrfs-find-root.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Qu Wenruo [Fri, 16 Jan 2015 03:04:09 +0000 (11:04 +0800)]
btrfs-progs: Add support to suppress tree block csum error output
Add new open ctree flag OPEN_CTREE_SUPPRESS_CHECK_BLOCK_ERRORS to
suppress tree block csum error output.
Provides the basis for new btrfs-find-root and other enhancement on
btrfs offline tools output.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
[renamed vars and funcs, added comments]
Signed-off-by: David Sterba <dsterba@suse.cz>
Qu Wenruo [Thu, 29 Jan 2015 08:32:39 +0000 (16:32 +0800)]
btrfs-progs: Cleanup check_tree_block() function
Before this patch, check_tree_block() will print error on bytenr
mismatch but don't output error on fsid mismatch.
This patch will modify check_tree_block(), so it will only return errno
but not print error messages.
The error message will be output by print_tree_block_err() function.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
[renamed and cleaned return codes]
Signed-off-by: David Sterba <dsterba@suse.cz>
David Sterba [Tue, 10 Feb 2015 14:17:10 +0000 (15:17 +0100)]
Merge remote-tracking branch 'remotes/josef/for-kdave' into v3.19.x
"This series of patches fixes up btrfsck in lots of ways and adds some
new functionality. These patches were required to fix Hugo's broken
multi-disk fs as well as fix fsck so it would actually pass all of the
fsck tests. This also fixes a long standing btrfs-image problem where
it wouldn't restore multi disk images onto a single disk properly."
Josef Bacik [Thu, 5 Feb 2015 20:41:32 +0000 (15:41 -0500)]
Btrfs-progs: fix bad extent flag
We can have FULL_BACKREF set or not set when we need the opposite, this patch
fixes this problem by setting a bit when the flag is set improperly. This way
we can either correct the problem when we re-create the extent item if the
backrefs are also wrong, or we can just set the flag properly in the extent
item. Thanks,
Signed-off-by: Josef Bacik <jbacik@fb.com>
Josef Bacik [Tue, 3 Feb 2015 14:48:57 +0000 (09:48 -0500)]
Btrfs-progs: skip opening all devices with restore
When we go to fixup the dev items after a restore we scan all existing devices.
If you happen to be a btrfs developer you could possibly open up some random
device that you didn't just restore onto, which gives you weird errors and makes
you super cranky and waste a day trying to figure out what is failing. This
will make it so that we use the fd we've already opened for opening our ctree.
Thanks,
Signed-off-by: Josef Bacik <jbacik@fb.com>
Josef Bacik [Tue, 3 Feb 2015 14:48:29 +0000 (09:48 -0500)]
Btrfs-progs: make debug-tree spit out full_backref flag
Currently btrfs-debug-tree ignores the FULL_BACKREF flag which makes it hard to
figure out problems related to FULL_BACKREF. Thanks,
Signed-off-by: Josef Bacik <jbacik@fb.com>
Josef Bacik [Wed, 28 Jan 2015 20:38:03 +0000 (12:38 -0800)]
Btrfs-progs: make restore update dev items
When we restore a multi disk image onto a single disk we need to update the dev
items used and total bytes so that fsck doesn't freak out and that we get normal
results from stuff like btrfs fi show. Thanks,
Signed-off-by: Josef Bacik <jbacik@fb.com>
Josef Bacik [Tue, 27 Jan 2015 22:23:21 +0000 (14:23 -0800)]
Btrfs-progs: unpin excluded extents as we fix things
We don't want to keep extent records pinned down if we fix stuff as we may need
the space and we can be pretty sure that these records are correct. Thanks,
Signed-off-by: Josef Bacik <jbacik@fb.com>
Josef Bacik [Mon, 9 Feb 2015 15:02:25 +0000 (10:02 -0500)]
Btrfs-progs: remove global transaction from fsck
We hold a transaction open for the entirety of fixing extent refs. This works
out ok most of the time but we can be tight on space and run out of space when
fixing things. To get around this just push down the transaction starting dance
into the functions that actually fix things. This keeps us from ending up with
ENOSPC because we pinned everything and allows the code to be a bit simpler.
Thanks,
Signed-off-by: Josef Bacik <jbacik@fb.com>
Josef Bacik [Mon, 26 Jan 2015 01:41:19 +0000 (17:41 -0800)]
Btrfs-progs: only build space info's for the main flags
Hitting enospc problems with a really corrupt fs uncovered the fact that we
match any flag in a block group when creating space info's. This is a problem
if we have a raid level set, we'll end up with only one space info that covers
metadata and data because they share a raid level. We don't want this, we want
to separate out the data and metadata space infos, so mask off the raid level
and only use the main flags. Thanks,
Signed-off-by: Josef Bacik <jbacik@fb.com>
Josef Bacik [Fri, 6 Feb 2015 18:03:12 +0000 (13:03 -0500)]
Btrfs-progs: Introduce metadump_v2
The METADUMP super flag makes us skip doing the chunk tree reading which isn't
helpful for the new restore since we have a valid chunk tree. But we still want
to have a way for the kernel to know that this is a metadump restore so it
doesn't do things like verify data checksums. We also want to skip some of the
device extent checks in fsck since those will obviously not match. Thanks,
Signed-off-by: Josef Bacik <jbacik@fb.com>
Josef Bacik [Fri, 6 Feb 2015 19:40:45 +0000 (14:40 -0500)]
Btrfs-progs: multi-thread btrfs-image restore
For some reason we only allow btrfs-image restore to have one thread, which is
incredibly slow with large images. So allow us to do work with more than just
one thread. This made my restore go from 16 minutes to 3 minutes. Thanks,
Signed-off-by: Josef Bacik <jbacik@fb.com>
Josef Bacik [Mon, 26 Jan 2015 01:39:24 +0000 (17:39 -0800)]
btrfs-progs: fix btrfs-image overlapping chunks
If you create a metadump from a striped volume you will have chunks that refer
to different logical offsets with the same physical offset on different devices.
So when we do the restore we just truncate the number of stripes in each chunk
item and carry on, which causes problems because we then have chunks that point
to the same physical offset for different logical offsets. To handle this
problem we keep track of logical extents that overlap on physical extents.
Then we go back and remap these extents into different physical extents on the
disk we are restoring onto. This makes us actually able to restore a multi disk
image onto a single disk and have everything work out properly. Thanks,
Signed-off-by: Josef Bacik <jbacik@fb.com>
Josef Bacik [Fri, 23 Jan 2015 16:39:28 +0000 (11:39 -0500)]
Btrfs-progs: don't check csums for data reloc root
The data reloc root is weird with it's csums. It'll copy an entire extent and
then log any csums it finds, which makes it look weird when it comes to prealloc
extents. So just skip the data reloc tree, it's special and we just don't need
to worry about it. Thanks,
Signed-off-by: Josef Bacik <jbacik@fb.com>
Josef Bacik [Thu, 15 Jan 2015 22:11:41 +0000 (17:11 -0500)]
Btrfs-progs: don't try to repair reloc roots
We have logic to fix the root locations for roots in response to a corruption
bug we had earlier. However this work doesn't apply to reloc roots and can
screw things up worse, so make sure we skip any reloc roots that we find.
Thanks,
Signed-off-by: Josef Bacik <jbacik@fb.com>
Josef Bacik [Wed, 14 Jan 2015 19:40:21 +0000 (14:40 -0500)]
Btrfs-progs: read super properly in btrfs-image
When btrfs-image makes a metadump it'll map all the blocks from their logical
address to their physical. This works out fine with the exception of the super
block, which is the physical offset. Normally this just works, but if the user
has balanced their fs it'll either crash btrfs-image or it'll copy some
completely arbitrary data. This forces btrfs-image to read the super directly
from the disk. Thanks,
Signed-off-by: Josef Bacik <jbacik@fb.com>
Josef Bacik [Fri, 6 Feb 2015 14:59:54 +0000 (09:59 -0500)]
Btrfs-progs: handle -eagain properly
If we fix bad blocks during run_next_block we will return -EAGAIN to loop around
and start again. The deal_with_roots work messed up this handling, this patch
fixes it. With this patch we can properly deal with broken tree blocks.
Thanks,
Signed-off-by: Josef Bacik <jbacik@fb.com>
Josef Bacik [Tue, 13 Jan 2015 20:23:41 +0000 (15:23 -0500)]
btrfs-progs: deal with no extent info
Previously we used to just set FULL_BACKREF if we couldn't lookup an extent info
for an extent. Now we just bail out if we can't lookup the extent info, which
is less than good since fsck is supposed to fix these very problems. So instead
figure out the flag we are supposed to use and pass that along instead. This
patch also provides a test image to test this functionality. Thanks,
Signed-off-by: Josef Bacik <jbacik@fb.com>
Josef Bacik [Tue, 13 Jan 2015 20:23:01 +0000 (15:23 -0500)]
Btrfs-progs: let btrfs-corrupt-block specify a root
Sometimes we want to corrupt specific keys or delete items on different roots,
so allow btrfs-corrupt-block to take a root objectid so we can corrupt a
specific root. Thanks,
Signed-off-by: Josef Bacik <jbacik@fb.com>
David Sterba [Thu, 5 Feb 2015 16:14:36 +0000 (17:14 +0100)]
Btrfs progs v3.19-rc2
Signed-off-by: David Sterba <dsterba@suse.cz>
David Sterba [Thu, 5 Feb 2015 14:46:42 +0000 (15:46 +0100)]
btrfs-progs: build, do not install everything by default
Commit
878affd47d ("btrfs-progs: build more utilities by default")
resulted in installation of new utilities, that were not installed
before. Make them build but do not install them.
Signed-off-by: David Sterba <dsterba@suse.cz>
David Sterba [Thu, 5 Feb 2015 14:11:40 +0000 (15:11 +0100)]
btrfs-progs: autoconf: do not force fortify flags
Make it default, but let the user override it.
Signed-off-by: David Sterba <dsterba@suse.cz>
David Sterba [Thu, 5 Feb 2015 13:52:03 +0000 (14:52 +0100)]
btrfs-progs: autoconf: largefile support is driven by configure
Don't force it in the makefile.
Signed-off-by: David Sterba <dsterba@suse.cz>
David Sterba [Thu, 5 Feb 2015 13:46:47 +0000 (14:46 +0100)]
btrfs-progs: autoconf: move custom CFLAGS from makefile
Keep only flags that are required to build properly, current fine
tunings are moved to the optional defaults in configure and can be
overriden by the user.
Signed-off-by: David Sterba <dsterba@suse.cz>
David Sterba [Wed, 4 Feb 2015 18:23:38 +0000 (19:23 +0100)]
btrfs-progs: autoconf: set CFLAGS conditionally
The expected way to define custom CFLAGS is
$ export CFLAGS=...
$ ./configure ...
the build will use them. No not override the make variables directly
from now on.
Signed-off-by: David Sterba <dsterba@suse.cz>
David Sterba [Wed, 4 Feb 2015 17:45:54 +0000 (18:45 +0100)]
btrfs-progs: build, use the static library for the utilities
Commit
2c2e6c4e12e5af15fd ("btrfs-progs: autoconf: cleanup compilation
flags usage") added the shared library to the linking command so the
resulting binaries depend dependent on libbtrfs.so. This is not
intended.
Reported-by: WorMzy Tykashi <wormzy.tykashi@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
David Sterba [Wed, 4 Feb 2015 17:10:23 +0000 (18:10 +0100)]
btrfs-progs: build, fix the source of btrfsck symlink
The installed symlink points to the absolute path of btrfs,
a relative link is enough.
Reported-by: WorMzy Tykashi <wormzy.tykashi@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
David Sterba [Wed, 4 Feb 2015 17:08:23 +0000 (18:08 +0100)]
btrfs-progs: autoconf: set exec_prefix in makefile
Lost in the conversion and breaks the build unless set explicitly.
Reported-by: WorMzy Tykashi <wormzy.tykashi@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
David Sterba [Tue, 3 Feb 2015 17:53:58 +0000 (18:53 +0100)]
Btrfs progs v3.19-rc1
Signed-off-by: David Sterba <dsterba@suse.cz>
David Sterba [Tue, 3 Feb 2015 17:34:14 +0000 (18:34 +0100)]
btrfs-progs: qgroups, adjust help text
Minor rewording to make the line shorter and.
Resolves-coverity-id: 1267280
Signed-off-by: David Sterba <dsterba@suse.cz>
David Sterba [Tue, 3 Feb 2015 16:12:28 +0000 (17:12 +0100)]
btrfs-progs: autoconf: check btrfs-convert dependencies
Use the standard pkg-config checks.
Signed-off-by: David Sterba <dsterba@suse.cz>
David Sterba [Tue, 3 Feb 2015 15:50:33 +0000 (16:50 +0100)]
btrfs-progs: autoconf: check if backtrace is really supported
Signed-off-by: David Sterba <dsterba@suse.cz>
David Sterba [Tue, 3 Feb 2015 15:31:51 +0000 (16:31 +0100)]
btrfs-progs: autoconf: print summary about features
Signed-off-by: David Sterba <dsterba@suse.cz>
David Sterba [Tue, 3 Feb 2015 15:22:55 +0000 (16:22 +0100)]
btrfs-progs: autoconf: make btrfs-convert build optional
Proposed at https://github.com/kdave/btrfs-progs/pull/6, I've added the
configure options.
Signed-off-by: David Sterba <dsterba@suse.cz>
David Sterba [Tue, 3 Feb 2015 14:38:17 +0000 (15:38 +0100)]
btrfs-progs: autoconf: detect tools to build docs
Signed-off-by: David Sterba <dsterba@suse.cz>
David Sterba [Tue, 3 Feb 2015 14:04:28 +0000 (15:04 +0100)]
btrfs-progs: build, fix version macro name
Autoconf changed it to PACKAGE_VERSION and moved to config.h.
Signed-off-by: David Sterba <dsterba@suse.cz>
David Sterba [Tue, 3 Feb 2015 13:56:06 +0000 (14:56 +0100)]
btrfs-progs: autoconf: use variable substitutions in doc makefile
Signed-off-by: David Sterba <dsterba@suse.cz>
David Sterba [Tue, 3 Feb 2015 13:49:09 +0000 (14:49 +0100)]
btrfs-progs: autoconf: generate documentation makefile as well
This is plain move to .in.
Signed-off-by: David Sterba <dsterba@suse.cz>
David Sterba [Tue, 3 Feb 2015 13:40:33 +0000 (14:40 +0100)]
btrfs-progs: build, fix rules to clean temporary files in docs
$ make clean-doc
Cleaning Documentation
/usr/bin/rm: cannot remove ‘*.xml’: No such file or directory
/usr/bin/rm: cannot remove ‘*.xml+’: No such file or directory
/usr/bin/rm: cannot remove ‘*.5’: No such file or directory
/usr/bin/rm: cannot remove ‘*.8’: No such file or directory
make[1]: *** [clean] Error 1
make: *** [clean-doc] Error 2
The RM variable from parent makefile lacks -f, add it where it's
missing.
Minor change in LN_S variable name, same -f change.
Signed-off-by: David Sterba <dsterba@suse.cz>
Qu Wenruo [Wed, 28 Jan 2015 02:12:55 +0000 (10:12 +0800)]
btrfs-progs: read_tree_block() and read_node_slot() cleanup.
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>
David Sterba [Mon, 2 Feb 2015 17:17:05 +0000 (18:17 +0100)]
btrfs-progs: drop old fi balance syntax from help
The command 'btrfs fi balance' still works to keep any scripts working,
we may remove it someday.
Signed-off-by: David Sterba <dsterba@suse.cz>
David Sterba [Mon, 2 Feb 2015 16:49:41 +0000 (17:49 +0100)]
btrfs-progs: add bash completion script
Original authors:
Alfredo Esteban <aedelatorre at gmail.com>
Joseph Wang <joequant at gmail.com>
John C F <john.ch.fr at gmail.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Qu Wenruo [Fri, 2 Jan 2015 07:12:33 +0000 (15:12 +0800)]
btrfs-progs: Add repair function for discount file extent hole.
Since orphan extents are handled in previous patches, now just punch
holes to fill the file extents hole.
Also since now btrfsck is aware of whether the inode has orphan file
extent, allow repair_inode_no_item() to determine filetype according to
orphan file extent.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Qu Wenruo [Fri, 2 Jan 2015 07:12:32 +0000 (15:12 +0800)]
btrfs-progs: Add repair and report function for orphan file extent.
In some fs tree leaf/node corruption case, file extents may be lost, but
in extent tree, its record may still exists.
This provide the possibility for such orphan file extents to be
recovered even we can't recover its compression and other info, we can
still insert it as a normal non-compression file extent.
This patch provides the repair and report function for such orphan file
extent.
Even after such repair, user may still need to try to decompress its
data if user knows that is a compressed extent.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Qu Wenruo [Fri, 2 Jan 2015 07:12:31 +0000 (15:12 +0800)]
btrfs-progs: Record and report every file extent hole.
Record every file extent discontinuous hole in inode_record using a
rb_tree member.
Before the patch, btrfsck will only record the first file extent hole by
using first_extent_gap, that's good for detecting error, but not
suitable for fixing it.
This patch provides the ability to record every file extent hole and
report it.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Qu Wenruo [Fri, 2 Jan 2015 07:12:30 +0000 (15:12 +0800)]
btrfs-progs: Add btrfs_get_extent() and btrfs_punch_hole().
Add btrfs_get_extent() and btrfs_punch_hole() for btrfs-progs.
Btrfs_get_extent() will act much like kernel one, return the first
extent that covers the given range.
The difference will be that progs btrfs_get_extent() can't handle
no-holes feature, which means caller should handle it carefully.
Btrfs_punch_hole() will punch a hole in given range of given inode,
however it differs from kernel one since it won't zero any page or drop
any extents if there is any extent in the hole range.
These functions are mainly used for later I_ERR_FILE_EXTENT_DISCOUNT
repair function.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Qu Wenruo [Fri, 2 Jan 2015 07:12:29 +0000 (15:12 +0800)]
btrfs-progs: Record orphan data extent ref to corresponding root.
Before this patch, when a extent's data ref points to a invalid key in
fs tree, this happens if a leaf/node of fs tree is corrupted, btrfsck
can't do any repair and just exit.
In fact, such problem can be handled in fs tree repair routines, rebuild
the inode item(if missing) and add back the extent data (with some
assumption).
So this patch records such data extent refs for later fs tree recovery
routine.
TODO:
Restore orphan data extent refs into btrfs_root is not the best
method. It's best to directly restore it into inode_record, however
current extent tree and fs tree can't cooperate together, so use
btrfs_root as a temporary storage until inode_cache is built.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
David Sterba [Wed, 28 Jan 2015 18:06:47 +0000 (19:06 +0100)]
btrfs-progs: build more utilities by default
Get better build coverage, btrfs-fragments require external libraries.
Signed-off-by: David Sterba <dsterba@suse.cz>
David Sterba [Wed, 28 Jan 2015 18:01:25 +0000 (19:01 +0100)]
btrfs-progs: build, make autogen.sh work on older systems
Try harder to find the support scipts, look into libtool or automake
dirs directly.
Signed-off-by: David Sterba <dsterba@suse.cz>
David Sterba [Wed, 28 Jan 2015 17:41:17 +0000 (18:41 +0100)]
btrfs-progs: build, use autoconf to detect RM
Signed-off-by: David Sterba <dsterba@suse.cz>
David Sterba [Wed, 28 Jan 2015 17:28:37 +0000 (18:28 +0100)]
btrfs-progs: build, clean all generated files
Signed-off-by: David Sterba <dsterba@suse.cz>
David Sterba [Wed, 28 Jan 2015 17:16:10 +0000 (18:16 +0100)]
btrfs-progs: build, make build test work again
We need to regenerate version.h after clean-all.
Signed-off-by: David Sterba <dsterba@suse.cz>
Karel Zak [Fri, 12 Dec 2014 10:54:06 +0000 (11:54 +0100)]
btrfs-progs: autoconf: add --disable-documentation
Signed-off-by: Karel Zak <kzak@redhat.com>
Signed-off-by: David Sterba <dsterba@suse.cz>