platform/upstream/btrfs-progs.git
9 years agobtrfs-progs: restore: shift option texts
David Sterba [Wed, 29 Apr 2015 16:11:46 +0000 (18:11 +0200)]
btrfs-progs: restore: shift option texts

Signed-off-by: David Sterba <dsterba@suse.cz>
9 years agobtrfs-progs: restore: use bigger buffer for output path name
David Sterba [Wed, 29 Apr 2015 16:08:28 +0000 (18:08 +0200)]
btrfs-progs: restore: use bigger buffer for output path name

Signed-off-by: David Sterba <dsterba@suse.cz>
9 years agobtrfs-progs: optionally restore symlinks.
Dan Merillat [Wed, 29 Apr 2015 16:06:27 +0000 (18:06 +0200)]
btrfs-progs: optionally restore symlinks.

Restore symlinks, optionally with owner/times.

Signed-off-by: Dan Merillat <dan.merillat@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
9 years agobtrfs-progs: restore: separate the overwrite check
Dan Merillat [Thu, 23 Apr 2015 16:51:33 +0000 (12:51 -0400)]
btrfs-progs: restore: separate the overwrite check

Symlink restore needs this, but the cut&paste became too complicated.
Simplify everything.

Signed-off-by: Dan Merillat <dan.merillat@gmail.com>
[message wording adjustments]
Signed-off-by: David Sterba <dsterba@suse.cz>
9 years agoBtrfs progs v4.0
David Sterba [Wed, 29 Apr 2015 14:56:22 +0000 (16:56 +0200)]
Btrfs progs v4.0

Signed-off-by: David Sterba <dsterba@suse.cz>
9 years agobtrfs-progs: restore: don't misreport errors from search_dir
David Sterba [Wed, 29 Apr 2015 14:48:04 +0000 (16:48 +0200)]
btrfs-progs: restore: don't misreport errors from search_dir

The logic around return value has changed in the metadata restore
patches. The return value from btrfs_search_slot may remain non-zero and
is returned. This is incorrectly interpreted as an error.

Signed-off-by: David Sterba <dsterba@suse.cz>
9 years agobtrfs-progs: receive: unconditionally print if doing chroot
David Sterba [Fri, 24 Apr 2015 16:01:32 +0000 (18:01 +0200)]
btrfs-progs: receive: unconditionally print if doing chroot

The chroot action seems important enough to be printed unconditionally
and without the verbose option that prints way too much information.

Signed-off-by: David Sterba <dsterba@suse.cz>
9 years agobtrfs-progs: fix typos in restore help/doc
David Sterba [Fri, 24 Apr 2015 15:28:37 +0000 (17:28 +0200)]
btrfs-progs: fix typos in restore help/doc

Signed-off-by: David Sterba <dsterba@suse.cz>
9 years agobtrfs-progs: restore: document metadata restore.
Dan Merillat [Thu, 23 Apr 2015 16:50:26 +0000 (12:50 -0400)]
btrfs-progs: restore: document metadata restore.

This was lost in the cleanup of 71a559

Signed-off-by: Dan Merillat <dan.merillat@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
9 years agobtrfs-progs: restore: cleanup, use PATH_MAX
David Sterba [Thu, 23 Apr 2015 15:41:08 +0000 (17:41 +0200)]
btrfs-progs: restore: cleanup, use PATH_MAX

Signed-off-by: David Sterba <dsterba@suse.cz>
9 years agobtrfs-progs: check: fix compile warnings in del_file_extent_hole
David Sterba [Thu, 23 Apr 2015 15:28:30 +0000 (17:28 +0200)]
btrfs-progs: check: fix compile warnings in del_file_extent_hole

make[1]: Nothing to be done for `all'.
cmds-check.c: In function ‘del_file_extent_hole’:
cmds-check.c:289:26: warning: ‘prev.start’ may be used uninitialized in this function
cmds-check.c:289:26: warning: ‘prev.len’ may be used uninitialized in this function
cmds-check.c:290:26: warning: ‘next.start’ may be used uninitialized in this function
cmds-check.c:290:26: warning: ‘next.len’ may be used uninitialized in this function

Reported-by: Anand Jain <Anand.Jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
9 years agobtrfs-progs: restore: convert copy_file exit paths to a single return
David Sterba [Thu, 23 Apr 2015 15:15:04 +0000 (17:15 +0200)]
btrfs-progs: restore: convert copy_file exit paths to a single return

Resolves-coverity-id: 1295365
Signed-off-by: David Sterba <dsterba@suse.cz>
9 years agobtrfs-progs: restore: convert search_dir exit paths to a single return
David Sterba [Thu, 23 Apr 2015 14:55:03 +0000 (16:55 +0200)]
btrfs-progs: restore: convert search_dir exit paths to a single return

Resolves-coverity-id: 1295366
Signed-off-by: David Sterba <dsterba@suse.cz>
9 years agobtrfs-progs: restore: fix path leak in copy_metadata
David Sterba [Thu, 23 Apr 2015 14:40:07 +0000 (16:40 +0200)]
btrfs-progs: restore: fix path leak in copy_metadata

The path lifecycle spans only this function and we have to free it.

Resolves-coverity-id: 1295367
Signed-off-by: David Sterba <dsterba@suse.cz>
9 years agobtrfs-progs: optionally enforce chroot for btrfs receive
Lauri Võsandi [Sun, 19 Apr 2015 11:46:28 +0000 (14:46 +0300)]
btrfs-progs: optionally enforce chroot for btrfs receive

This patch forces btrfs receive to issue chroot before
parsing the btrfs stream using command-line flag -C
to confine the process and minimize damage that could
be done via malicious btrfs stream.

Signed-off-by: Lauri Võsandi <lauri.vosandi@gmail.com>
[added long option variant, added docs]
Signed-off-by: David Sterba <dsterba@suse.cz>
9 years agobtrfs-progs: restore: optionally restore metadata
Dan Merillat [Tue, 21 Apr 2015 05:48:24 +0000 (01:48 -0400)]
btrfs-progs: restore: optionally restore metadata

As long as the inode is intact, the file metadata can be restored.
Directory data is restored at the end of search_dir.  Errors are
checked and returned, unless ignore_errors is requested.

Signed-off-by: Dan Merillat <dan.merillat@gmail.com>
[minor style fixes, error message updates]
Signed-off-by: David Sterba <dsterba@suse.cz>
9 years agobtrfs-progs: report failure when resize ioctl fails
Zygo Blaxell [Wed, 22 Apr 2015 03:38:47 +0000 (23:38 -0400)]
btrfs-progs: report failure when resize ioctl fails

The BTRFS_IOC_RESIZE ioctl returns 0 on success, negative for POSIX
errors, and positive for btrfs-specific errors.

If resize fails with a btrfs-specific error, decode the error and
report it.  If we can't decode the error, report its numeric value so
that the userspace tool is not instantly useless when a new error code
is defined in the kernel.

Exit with non-zero status on any resize error.  This is very important
for scripts that will shrink the underlying storage when btrfs reports
success!

Signed-off-by: Zygo Blaxell <ce3g8jdj@umail.furryterror.org
Signed-off-by: David Sterba <dsterba@suse.cz>
9 years agobtrfs-progs: fix typo in btrfs-device.txt
Anand Jain [Wed, 22 Apr 2015 16:16:41 +0000 (18:16 +0200)]
btrfs-progs: fix typo in btrfs-device.txt

Signed-off-by: David Sterba <dsterba@suse.cz>
9 years agobtrfs-progs: check for matching free space in cache
Josef Bacik [Fri, 17 Apr 2015 18:02:15 +0000 (14:02 -0400)]
btrfs-progs: check for matching free space in cache

We have this check in the kernel but not in userspace, which makes fsck
fail when we wouldn't have a problem in the kernel.  This was meant to
catch this case because it really isn't good, unfortunately it will
require a design change to fix in the kernel so in the meantime add this
check so we can be sure our tests only catch real problems.  Thanks,

Signed-off-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
9 years agobtrfs-progs: fix btrfs quota rescan failed on PPC64 arch
George Wang [Mon, 20 Apr 2015 05:33:16 +0000 (13:33 +0800)]
btrfs-progs: fix btrfs quota rescan failed on PPC64 arch

PPC64 arch use such following IOC values "
\#define _IOC_NONE       1U
\#define _IOC_READ       2U
\#define _IOC_WRITE      4U
" comparing to the default IOC values "
\#define _IOC_NONE       0U
\#define _IOC_READ       2U
\#define _IOC_WRITE      1U"

This means the value "_IOW*" will be negative when we store it in the int
variables. Such as the "BTRFS_IOC_QGROUP_CREATE", it will be "0x4010942e" on
X86_64, but "0x8010942e" on PPC64.
Notice that the IOC values are the "unsigned long" type, so we use the
"unsigned long" to store it, and this can insure the comparison between the
variable and BTRFS_IOC_* valid.

Signed-off-by: George Wang <xuw2015@gmail.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
[manpage states that it's int, kernel uses unsigned int, glibc wants
unsigned long int]
Tested-by: Chandan Rajendra <chandan@linux.vnet.ibm.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
9 years agobtrfs-progs: add zero-log to rescue command
David Sterba [Wed, 13 Nov 2013 17:55:12 +0000 (18:55 +0100)]
btrfs-progs: add zero-log to rescue command

Copy the functionality of standalone btrfs-zero-log to the main tool.
Delete man page for btrfs-zero-log and copy the relevant parts into
btrfs-rescue(8).  The standalone utility will be removed later.

Signed-off-by: David Sterba <dsterba@suse.cz>
9 years agobtrfs-progs: cleanup, rename *disk_usage* files to usage
David Sterba [Fri, 17 Apr 2015 16:29:38 +0000 (18:29 +0200)]
btrfs-progs: cleanup, rename *disk_usage* files to usage

Signed-off-by: David Sterba <dsterba@suse.cz>
9 years agobtrfs-progs: fi resize: accept only directories as paths
David Sterba [Fri, 17 Apr 2015 16:20:32 +0000 (18:20 +0200)]
btrfs-progs: fi resize: accept only directories as paths

Resize of a filesystem image does not work as expected. This has been
confusing and can have bad consequences as people have reported,
resizing the wrong filesystem.

Signed-off-by: David Sterba <dsterba@suse.cz>
9 years agobtrfs-progs: Documentaion: rename to .asciidoc
David Sterba [Tue, 14 Apr 2015 15:37:23 +0000 (17:37 +0200)]
btrfs-progs: Documentaion: rename to .asciidoc

A few minor benefits:

* editors set highliting according to the extensions
* web access to the git repository (github) renders the .asciidoc
  files:
  * we can link to them from the wiki
  * the files are editable via browser and such editations can be
    submitted for merge easily

Signed-off-by: David Sterba <dsterba@suse.cz>
9 years agobtrfs-progs: improve troubleshooting avoid duplicate error strings
Anand Jain [Mon, 13 Apr 2015 12:37:01 +0000 (20:37 +0800)]
btrfs-progs: improve troubleshooting avoid duplicate error strings

my troubleshooting experience says have unique error string per module.

In the below eg, its one additional step to know error line,

cat -n cmds-device.c | egrep "error removing the device"
   185 "ERROR: error removing the device '%s' - %s\n",
   190 "ERROR: error removing the device '%s' - %s\n",

which is completely avoidable.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
[merged the two messages into one]
Signed-off-by: David Sterba <dsterba@suse.cz>
9 years agoBtrfs-progs: fix compile warnings
Anand Jain [Tue, 14 Apr 2015 13:07:31 +0000 (15:07 +0200)]
Btrfs-progs: fix compile warnings

simple compile time warning fixes.

btrfs-calc-size.c: In function ‘print_seek_histogram’:
btrfs-calc-size.c:221: warning: ‘group_start’ may be used uninitialized in this function
btrfs-calc-size.c:223: warning: ‘group_end’ may be used uninitialized in this function

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
9 years agobtrfs-progs: use local btrfs-image in leaf corruption test
WorMzy Tykashi [Wed, 8 Apr 2015 14:50:04 +0000 (15:50 +0100)]
btrfs-progs: use local btrfs-image in leaf corruption test

Currently this test uses the system btrfs-image. If there isn't a
btrfs-image on $PATH, the test fails. The test should be using the
locally compiled btrfs-image, not the system one.

Signed-off-by: WorMzy Tykashi <wormzy.tykashi@gmail.com>
Reviewed-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
9 years agobtrfs-progs: getopt, use symbolic name for argument requirements
David Sterba [Wed, 8 Apr 2015 15:39:51 +0000 (17:39 +0200)]
btrfs-progs: getopt, use symbolic name for argument requirements

Signed-off-by: David Sterba <dsterba@suse.cz>
9 years agobtrfs-progs: cleanup option index argument from getopt_long
David Sterba [Wed, 8 Apr 2015 15:33:55 +0000 (17:33 +0200)]
btrfs-progs: cleanup option index argument from getopt_long

We're not using it anywhere. The best practice is to add enums with
values > 255 for the long options, option index counting is error prone.

Signed-off-by: David Sterba <dsterba@suse.cz>
9 years agobtrfs-progs: print fs features filtered by a mask
David Sterba [Mon, 23 Mar 2015 18:49:51 +0000 (19:49 +0100)]
btrfs-progs: print fs features filtered by a mask

mkfs and convert will not support the same features, -O will print only
the list according to the given mask.

Signed-off-by: David Sterba <dsterba@suse.cz>
9 years agobtrfs-progs: move feature parsing from mkfs to utils
David Sterba [Mon, 23 Mar 2015 18:20:37 +0000 (19:20 +0100)]
btrfs-progs: move feature parsing from mkfs to utils

We'll use them in convert as well. Move defines and the interface
functions to utils.*.

Signed-off-by: David Sterba <dsterba@suse.cz>
9 years agobtrfs-progs: mkfs, deprecate leafsize and clean up the code
David Sterba [Mon, 2 Feb 2015 14:51:15 +0000 (15:51 +0100)]
btrfs-progs: mkfs, deprecate leafsize and clean up the code

Using the --leafsize will issue a warning. Replace leafsize with
nodesize in the mkfs-related code.

Signed-off-by: David Sterba <dsterba@suse.cz>
9 years agobtrfs-progs: convert: use exact size for reading superblock
David Sterba [Tue, 7 Apr 2015 17:09:39 +0000 (19:09 +0200)]
btrfs-progs: convert: use exact size for reading superblock

We've passed blocksize to prepare_system_chunk and used it to read and
write superblock. While this does not cause a bug (SUPER_INFO is
blocksize ie. page size on most arches), we should really use the
correct size.

Signed-off-by: David Sterba <dsterba@suse.cz>
9 years agobtrfs-progs: tests: remove duplicate output for fsck test 013
David Sterba [Tue, 7 Apr 2015 16:34:00 +0000 (18:34 +0200)]
btrfs-progs: tests: remove duplicate output for fsck test 013

The test name is logged since it lives in it's own directory.

Signed-off-by: David Sterba <dsterba@suse.cz>
9 years agobtrfs-progs: tests: split make rule for fsck and convert tests, fix prerequisities
David Sterba [Tue, 7 Apr 2015 16:29:05 +0000 (18:29 +0200)]
btrfs-progs: tests: split make rule for fsck and convert tests, fix prerequisities

We'd like to run each class of tests separately. There were some missing
prerequisities that should be/are verified by the tests, makefile rules
have been synced.

Signed-off-by: David Sterba <dsterba@suse.cz>
9 years agobtrfs-progs: convert tests: preserve test image permissions
David Sterba [Tue, 7 Apr 2015 16:09:18 +0000 (18:09 +0200)]
btrfs-progs: convert tests: preserve test image permissions

If the test image is eg. on NFS it's not writable for root, so chmod
0777 fixes that but then we must not delete the file.

Signed-off-by: David Sterba <dsterba@suse.cz>
9 years agobtrfs-progs: Doc: Add warning and note on btrfs-convert.
Qu Wenruo [Fri, 3 Apr 2015 07:23:13 +0000 (15:23 +0800)]
btrfs-progs: Doc: Add warning and note on btrfs-convert.

Although btrfs-convert can rollback converted btrfs, it still has some
limitation to ensure rollback.

Add a warning on the limitations.

Also add a note for users who decides to go on with btrfs and don't need
the rollback ability.

Reported-by: Vytautas D <vytdau@gmail.com>
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.cz>
9 years agobtrfs-progs: convert-tests: Add check for converted btrfs with regular file extent.
Qu Wenruo [Fri, 3 Apr 2015 07:01:17 +0000 (15:01 +0800)]
btrfs-progs: convert-tests: Add check for converted btrfs with regular file extent.

Regression test for previous patch "btrfs-progs: convert: Make
ext*_image file obey datacsum setting."

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
9 years agobtrfs-progs: convert-tests: Update to use test framework infrastructure.
Qu Wenruo [Fri, 3 Apr 2015 07:01:16 +0000 (15:01 +0800)]
btrfs-progs: convert-tests: Update to use test framework infrastructure.

Also change the test() to convert_test(), to avoid conflict name with
bash test function.

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
9 years agobtrfs-progs: fsck-tests: Add fallback TEST_DEV for test case 013
Qu Wenruo [Fri, 3 Apr 2015 07:01:15 +0000 (15:01 +0800)]
btrfs-progs: fsck-tests: Add fallback TEST_DEV for test case 013

Add fallback TEST_DEV for test case 013.
Fallback to $TOP/tests/test.img.

Now all test cases of btrfs-progs need no extra setting except sudo.

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
9 years agobtrfs-progs: fsck-tests: Update 013-extent-tree-rebuild to use more test framework...
Qu Wenruo [Fri, 3 Apr 2015 07:01:14 +0000 (15:01 +0800)]
btrfs-progs: fsck-tests: Update 013-extent-tree-rebuild to use more test framework infrastructure.

Update 013-extent-tree-rebuild to use more framework infrastructure,
including:
1) Use run_check other than open-coded redirect
2) Add root privillege
3) Add dependency on 'btrfs-debug-tree' command

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
9 years agobtrfs-progs: fsck-tests: Remove duplicatesd TEST_MNT setup.
Qu Wenruo [Fri, 3 Apr 2015 07:01:13 +0000 (15:01 +0800)]
btrfs-progs: fsck-tests: Remove duplicatesd TEST_MNT setup.

Since we have already had TEST_MNT fallback setup to $TOP/tests/mnt,
just remove duplicated setting in 012-leaf-corruption/test.sh

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
9 years agobtrfs-progs: test-frame: Update variant names
Qu Wenruo [Fri, 3 Apr 2015 07:01:12 +0000 (15:01 +0800)]
btrfs-progs: test-frame: Update variant names

Use upper case variant name for the following variants:
1) top -> TOP
2) script_dir -> SCRIPT_DIR

And change the following variant name:
1) RESULT -> RESULTS

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
9 years agobtrfs-progs: convert: Make ext*_image file obey datacsum setting.
Qu Wenruo [Thu, 2 Apr 2015 02:21:35 +0000 (10:21 +0800)]
btrfs-progs: convert: Make ext*_image file obey datacsum setting.

Before this patch, ext*_image is always set NODATACSUM inode flag.
However btrfs-convert will set normal file with DATACUSM flag by
default, and generate checksum for regular file extent.

Now, a regular file extent is shared by a btrfs file inode with DATACSUM
and ext*_image with NODATACSUM, and it has checksum in csum tree.
This will cause btrfsck complain about odd checksum, since ext*_image is
set NODATACSUM but has checksum generated from regular file extent.

This patch makes convert completely obey datacsum setting, meaning
btrfs-convert will generate csum for every file extent by default.

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.cz>
9 years agobtrfs-progs doc: emphasis that only mounted device works for btrfs device stats
Chen Hanxiao [Wed, 1 Apr 2015 07:52:57 +0000 (03:52 -0400)]
btrfs-progs doc: emphasis that only mounted device works for btrfs device stats

We provided format <path>|<device> in command line.
But btrfs device stats doesn't work if device is not mounted.

Also fix some tailing whitespace.

Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
9 years agobtrfs-progs: silence fake fsck
Zach Brown [Fri, 27 Mar 2015 21:58:43 +0000 (14:58 -0700)]
btrfs-progs: silence fake fsck

Harald suggested that we remove the message from the fake fsck.btrfs
that some distros run at boot:

  https://bugzilla.redhat.com/show_bug.cgi?id=1206502

"This output does not add anything, but is a disturbing element of
booting up a system. It's the only message I get, when starting my
system, before gdm is started."

I'm inclined to agree.

This makes the tiniest change to remove the message that's output for an
auto invocation.  My guess is that it was just copied from the xfs
fsck.xfs and that no one actually cares about it.

Signed-off-by: Zach Brown <zab@zabbo.net>
Signed-off-by: David Sterba <dsterba@suse.cz>
9 years agoBtrfs progs v3.19.1
David Sterba [Wed, 25 Mar 2015 17:43:42 +0000 (18:43 +0100)]
Btrfs progs v3.19.1

Signed-off-by: David Sterba <dsterba@suse.cz>
9 years agobtrfs-progs: Fix autoconf handling of --enable-convert
Mike Gilbert [Wed, 25 Mar 2015 00:55:41 +0000 (20:55 -0400)]
btrfs-progs: Fix autoconf handling of --enable-convert

AC_ARG_ENABLE(convert) sets $enable_convert, not $enable_btrfsconvert.

Signed-off-by: Mike Gilbert <floppym@gentoo.org>
Signed-off-by: David Sterba <dsterba@suse.cz>
9 years agoBtrfs progs v3.19.1-rc1
David Sterba [Tue, 24 Mar 2015 18:39:46 +0000 (19:39 +0100)]
Btrfs progs v3.19.1-rc1

Signed-off-by: David Sterba <dsterba@suse.cz>
9 years agobtrfs-progs: mkfs, add required arguments to help strings
David Sterba [Mon, 2 Feb 2015 14:35:37 +0000 (15:35 +0100)]
btrfs-progs: mkfs, add required arguments to help strings

Signed-off-by: David Sterba <dsterba@suse.cz>
9 years agobtrfs-progs: mkfs, align help strings
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>
9 years agobtrfs-progs: convert, add long options for all short options
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>
9 years agobtrfs-progs: Print warning message if qgroup data is inconsistent
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>
9 years agobtrfs-progs: Add stack get/set functions for btrfs_qgroup_status_item
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>
9 years agobtrfs-progs: Allow parse_qgroupid() to resolve subvolume path into qgroupid
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>
9 years agobtrfs-progs: Move parse_qgroupid() to utils.c
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>
9 years agobtrfs-progs: Allow btrfs-debug-tree to print human readable qgroup status flag.
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>
9 years agobtrfs-progs: Update qgroup status flags and replace qgroup level/subvid calculation...
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>
9 years agobtrfs-progs: restore, fix page alignment issue for lzo compression
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>
9 years agobtrfs-progs: completion: add fi and dev usage commands
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>
9 years agobtrfs-progs: convert, fix typo in getopt value
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>
9 years agobtrfs-progs: convert tests: add remaining supported nodesizes
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>
9 years agobtrfs-progs: Add nodesize test for btrfs-convert
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>
9 years agobtrfs-progs: btrfs-convert: Allow setting nodesize
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>
9 years agobtrfs-progs: Fix msgs in check_node_or_leaf_size
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>
9 years agobtrfs-progs: mkfs: Move out some nodesize code
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>
9 years agobtrfs-progs: fi usage, fix reporting space for degraded mounts
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>
9 years agobtrfs-progs: re-introduce BTRFS_BUILD_VERSION in version.h
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>
9 years agoBtrfs progs v3.19
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>
9 years agobtrfs-progs: tests, common: fix typo after cleanup
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>
9 years agoBtrfs progs v3.19-rc3
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>
9 years agobtrfs-progs: tests, clean up scripts
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>
9 years agobtrfs-progs: fsck-test: Add check_sudo to check valid root/sudo privilege
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>
9 years agobtrfs-progs: convert, adjust help text formatting
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>
9 years agobtrfs-progs: convert, add option to disable progress
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>
9 years agobtrfs-progs: update INSTALL
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>
9 years agobtrfs-progs: Add more detailed package bdependency information to INSTALL file
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>
9 years agobtrfs-progs: doc: clarify toplevel subvolid
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>
9 years agobtrfs-progs: Move (set/clear_)extent_buffer_uptodate() to extent_io.h.
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>
9 years agobtrfs-progs: Make csum tree rebuild works with extent tree rebuild.
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>
9 years agobtrfs-progs: use correct the return value
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>
9 years agobtrfs-progs: convert: show progress by default
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>
9 years agobtrfs-progs: Fix a infinite loop when fixing nlink if file name conflicts twice.
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>
9 years agobtrfs-progs: docs: fixed a grammar mistake
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>
9 years agobtrfs-progs: version.sh: simplify printing the version
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>
9 years agobtrfs-progs: autoconf: define package url manually if not set
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>
9 years agobtrfs-progs: fix typo in OPEN_CTREE flag
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>
9 years agobtrfs-progs: Fix 2 extent buffer leak in btrfs-debug-tree
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>
9 years agobtrfs-progs: Move -rdynamic linker only option to LDFLAGS
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>
9 years agoMerge branch 'qu/find-root-v3-part1' into v3.19.x
David Sterba [Wed, 11 Feb 2015 17:35:12 +0000 (18:35 +0100)]
Merge branch 'qu/find-root-v3-part1' into v3.19.x

9 years agobtrfs-progs: find-root, add option to search through all the metadata extents
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>
9 years agobtrfs-progs: Cleanup unneeded btrfs-find-root codes
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>
9 years agobtrfs-progs: Switch btrfs-find-root to use the find-root infrastructure
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>
9 years agobtrfs-progs: Add better search generation judgment for btrfs-find-root
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>
9 years agobtrfs-progs: Switch btrfs-find-root to use the new open_ctree flags
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>
9 years agobtrfs-progs: Add new find-root.[ch] infrastructure
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>
9 years agobtrfs-progs: Add new btrfs_open_ctree_flags CHUNK_ONLY
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>
9 years agobtrfs-progs: Add support to suppress tree block csum error output
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>
9 years agobtrfs-progs: Cleanup check_tree_block() function
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>
9 years agoMerge remote-tracking branch 'remotes/josef/for-kdave' into v3.19.x
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."