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>
Karel Zak [Wed, 10 Dec 2014 14:21:24 +0000 (15:21 +0100)]
btrfs-progs: autoconf: add --disable-backtrace
It's better to use ./configure than manually edit Makefile.
Signed-off-by: Karel Zak <kzak@redhat.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Karel Zak [Wed, 10 Dec 2014 11:30:05 +0000 (12:30 +0100)]
btrfs-progs: autoconf: clean generated files, make version.h stuff more robust
- add rule to generated version.h when any relevant stuff changed
- add rule to clean generated files on "make clean-all"
Signed-off-by: Karel Zak <kzak@redhat.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Karel Zak [Wed, 10 Dec 2014 10:56:59 +0000 (11:56 +0100)]
btrfs-progs: autoconf: cleanup compilation flags usage
- define basic default CFLAGS in configure.ac, because:
* autoconf default is -g -O2, but btrfs uses -g -O1
* it's better to follow autoconf; standard way to modify
CFLAGS is to call: CFLAGS="foo bar" ./configure
- move all flags to one place in Makefile.in
- don't use AM_CFLAGS, the CFLAGS and STATIC_CFLAGS are enough
- don't mix objects and flags in $LIBS, it's more readable to
add $(libs) to make rules
Signed-off-by: Karel Zak <kzak@redhat.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Karel Zak [Tue, 9 Dec 2014 15:57:10 +0000 (16:57 +0100)]
btrfs-progs: autoconf: use paths and $*_LIBS from ./configure
Signed-off-by: Karel Zak <kzak@redhat.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Karel Zak [Tue, 9 Dec 2014 15:41:10 +0000 (16:41 +0100)]
btrfs-progs: autoconf: check for build programs in ./configure
Signed-off-by: Karel Zak <kzak@redhat.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Karel Zak [Tue, 9 Dec 2014 14:58:11 +0000 (15:58 +0100)]
btrfs-progs: autoconf: use ./configure to generate version.h
The original homemade solution is unnecessary, autotools provides better
infrastructure to generate files.
Signed-off-by: Karel Zak <kzak@redhat.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Karel Zak [Tue, 9 Dec 2014 14:37:03 +0000 (15:37 +0100)]
btrfs-progs: autoconf: use standard PACKAGE_* macros
- 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>
Karel Zak [Tue, 9 Dec 2014 14:15:47 +0000 (15:15 +0100)]
btrfs-progs: autoconf: use config.h
- the header file is generated by ./configure, the standard autotools
way is to use -include config.h on compiler command line rather than
include the file directly from code
- remove _GNU_SOURCE from code, the macros is already defined in config.h
by AC_USE_SYSTEM_EXTENSIONS autoconf macro
Signed-off-by: Karel Zak <kzak@redhat.com>
[_GNU_SOURCE changes already done]
Signed-off-by: David Sterba <dsterba@suse.cz>
Karel Zak [Thu, 4 Dec 2014 12:26:46 +0000 (13:26 +0100)]
btrfs-progs: autoconf: add ./configure script
- add ./autogen.sh script (necessary after git clean/clone)
- add ./configure.ac
- copy autotool helper scripts from automake
- modify version.sh to be usable from the configure script
- rename Makefile to Makefile.in and use basic variables from configure.ac
Signed-off-by: Karel Zak <kzak@redhat.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
David Sterba [Tue, 27 Jan 2015 16:42:28 +0000 (17:42 +0100)]
Btrfs progs v3.18.2
Signed-off-by: David Sterba <dsterba@suse.cz>
David Sterba [Tue, 27 Jan 2015 16:07:40 +0000 (17:07 +0100)]
btrfs-progs: update wording for qgroup limits
Based on a user report, 'max' in help does not clearly point to the
limits that are commonly used as a quota-related term.
Signed-off-by: David Sterba <dsterba@suse.cz>
Xing Gu [Mon, 26 Jan 2015 08:26:38 +0000 (16:26 +0800)]
btrfs-progs: don't output operational status information to stderr
Signed-off-by: Xing Gu <gux.fnst@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Hugo Mills [Tue, 27 Jan 2015 15:05:53 +0000 (15:05 +0000)]
btrfs-progs: check: Add --readonly flag
Particularly during support conversations, people get confused about
which options to use with btrfs check. Adding a flag, --readonly, which
implies the default read-only behaviour and which conflicts with the
read-write operations, should help make the behaviour of the tool clear.
Signed-off-by: Hugo Mills <hugo@carfax.org.uk>
Signed-off-by: David Sterba <dsterba@suse.cz>
Hugo Mills [Tue, 27 Jan 2015 15:05:52 +0000 (15:05 +0000)]
btrfs-progs: Make option parsing more robust to code modifications
The current approach to option parsing, where long-only options are
selected on the basis of their position in the long_options array is
fragile and painful to modify if options are to be inserted into the
list, rather than appended.
Instead, use the last field of struct option to return a value which
cannot be a char (and hence a short option), and simply switch on those
within the case statement.
Signed-off-by: Hugo Mills <hugo@carfax.org.uk>
Signed-off-by: David Sterba <dsterba@suse.cz>
Fan Chengniang [Fri, 23 Jan 2015 01:50:49 +0000 (09:50 +0800)]
btrfs-progs: qgroup: make large size aligned
Problem: when the size is too big, the output format will be unaligned.
The __update__columns_max_len function has been updated to fix this
problem.
Signed-off-by: Fan Chengniang <fancn.fnst@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Dimitri John Ledkov [Sun, 18 Jan 2015 01:52:58 +0000 (01:52 +0000)]
btrfs-progs: drop feature defines from C files, in favour of CFLAGS defines
glibc 2.10+ (5+ years old) enables all the desired features:
_XOPEN_SOURCE 700, __XOPEN2K8, POSIX_C_SOURCE, DEFAULT_SOURCE; with a
single _GNU_SOURCE define in the makefile alone. For portability to
other libc implementations (e.g. dietlibc) _XOPEN_SOURCE=700 is also
defined.
This also resolves Debian bug report filed by Michael Tautschnig -
"Inconsistent use of _XOPEN_SOURCE results in conflicting
declarations". Whilst I was not able to reproduce the results, the
reported fact is that _XOPEN_SOURCE set to 500 in one set of files
(e.g. cmds-filesystem.c) generates/defines different struct stat from
other files (cmds-replace.c).
This patch thus cleans up all feature defines, and sets them at a
consistent level.
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=747969
Signed-off-by: Dimitri John Ledkov <dimitri.j.ledkov@intel.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
David Sterba [Wed, 21 Jan 2015 17:53:02 +0000 (18:53 +0100)]
btrfs-progs: unify getopt table terminators
Signed-off-by: David Sterba <dsterba@suse.cz>
David Sterba [Wed, 21 Jan 2015 17:47:24 +0000 (18:47 +0100)]
btrfs-progs: add --human-readable option where applicable
Add an alias to -h to 'filesystem usage', 'filesystem df' and
'device usage' commands, same as the traditional 'df'.
Signed-off-by: David Sterba <dsterba@suse.cz>
David Sterba [Wed, 21 Jan 2015 17:09:32 +0000 (18:09 +0100)]
btrfs-progs: use predefined getopt values for unit suffixes
Signed-off-by: David Sterba <dsterba@suse.cz>
David Sterba [Wed, 21 Jan 2015 17:02:42 +0000 (18:02 +0100)]
btrfs-progs: define common geopt values for unit suffixes
Signed-off-by: David Sterba <dsterba@suse.cz>
Fan Chengniang [Mon, 19 Jan 2015 07:18:18 +0000 (15:18 +0800)]
btrfs-progs: make btrfs qgroups show human readable sizes
add --raw, --si, --iec, --kbytes, --mbytes, --gbytes, --tbytes options
make columns which show sizes align to right. Others aligned to left.
example:
qgroupid rfer excl max_rfer max_excl parent child
-------- ---- ---- -------- -------- ------ -----
0/5 299.58MiB 299.58MiB 300.00MiB 300.00MiB 1/1 ---
0/265 299.58MiB 16.00KiB 400.00MiB 0.00B 1/1 ---
0/266 299.58MiB 16.00KiB 350.00MiB 0.00B --- ---
1/1 599.16MiB 299.59MiB 800.00MiB 0.00B --- 0/5,0/265
Signed-off-by: Fan Chengniang <fancn.fnst@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
David Sterba [Wed, 21 Jan 2015 16:49:26 +0000 (17:49 +0100)]
btrfs-progs: unify header file inclusion protections
There are missing ifdefs or defines with very generic names.
Signed-off-by: David Sterba <dsterba@suse.cz>
Qu Wenruo [Mon, 24 Nov 2014 07:27:44 +0000 (15:27 +0800)]
btrfs-progs: Doc: Add explain on 'source' and 'target' for btrfs-image.
Add explain on 'source' and 'target', which is somewhat confusing for
users who want to restore dumped image.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
[reworded texts]
Signed-off-by: David Sterba <dsterba@suse.cz>
Qu Wenruo [Mon, 19 Jan 2015 06:45:03 +0000 (14:45 +0800)]
btrfs-progs: Cleanup, use bitshift instead of immediate number in btrfs_open_ctree_flags.
Change the immediate number in btrfs_open_ctree_flags to bit shift.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Fan Chengniang [Mon, 19 Jan 2015 07:27:30 +0000 (15:27 +0800)]
btrfs-progs: btrfstune: force to set seeding flags
Now we can use -f with -S option when setting seeding flags or clearing
seeding flags
Reported-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
Signed-off-by: Fan Chengniang <fancn.fnst@cn.fujitsu.com>
[updated docs]
Signed-off-by: David Sterba <dsterba@suse.cz>
David Sterba [Mon, 19 Jan 2015 18:09:28 +0000 (19:09 +0100)]
btrfs-progs: tests, use non-interactive sudo helper
Sudo may not be configured to run without user prompt, in that case the
tests would be stuck.
Reported-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
David Sterba [Mon, 19 Jan 2015 17:47:20 +0000 (18:47 +0100)]
btrfs-progs: fix check of running scrub
Scrub on multiple devices may report wrong status if scrub finishes
early on one of them.
Reported-by: Sandy McArthur Jr <sandymac@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
David Sterba [Mon, 19 Jan 2015 12:44:49 +0000 (13:44 +0100)]
btrfs-progs: make getopt tables static const
Signed-off-by: David Sterba <dsterba@suse.cz>
David Sterba [Mon, 19 Jan 2015 12:30:06 +0000 (13:30 +0100)]
btrfs-progs: cleanup, move getop long options close to their use
Move long_option defintions just before getopt_long everywhere.
Signed-off-by: David Sterba <dsterba@suse.cz>
David Sterba [Wed, 14 Jan 2015 17:32:17 +0000 (18:32 +0100)]
btrfs-progs: tests, adjust alignment of the pretty command name
Signed-off-by: David Sterba <dsterba@suse.cz>
David Sterba [Wed, 14 Jan 2015 17:13:21 +0000 (18:13 +0100)]
btrfs-progs: tests, use the root helper in 012
We need it to mount/umount, to traverse lost+found and stat the results.
Signed-off-by: David Sterba <dsterba@suse.cz>
David Sterba [Wed, 14 Jan 2015 17:07:43 +0000 (18:07 +0100)]
btrfs-progs: tests, add support for running commands under root
Most of the checks run fine without root, but some of them may need to
do a mount test or access the data. Add the support to selectively run
commands under root, hardcoded to sudo for now.
Signed-off-by: David Sterba <dsterba@suse.cz>
Qu Wenruo [Thu, 25 Dec 2014 01:32:15 +0000 (09:32 +0800)]
btrfs-progs: Move extent tree rebuild test to its dir
Move extent tree rebuild teset to its dir.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Qu Wenruo [Thu, 25 Dec 2014 01:32:14 +0000 (09:32 +0800)]
btrfs-progs: Move leaf-corruption no extent data case and add verification script
Move leaf-corruption type no extent data case to its dir, and add
verification script in test.sh
The verification script is based on manual btrfs-debug-tree check.
The image can also be reused to other leaf-corruption type, like
corrupted leaf contains regular file extent data case.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Qu Wenruo [Thu, 25 Dec 2014 01:32:13 +0000 (09:32 +0800)]
btrfs-progs: Move bad root items test cases to its corresponding dir
Now 006-bad-root-items has two cases, one for default case, and one for
skinny metadata case.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Qu Wenruo [Thu, 25 Dec 2014 01:32:12 +0000 (09:32 +0800)]
btrfs-progs: Move btrfs-image dump to corresponding dir
Move these obvious btrfs-image to its corresponding dir to use the new
infrastructure.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Qu Wenruo [Thu, 25 Dec 2014 01:32:11 +0000 (09:32 +0800)]
btrfs-progs: New btrfsck test infrastructure
Change the old btrfsck test infrastructure (btrfs-image dump or xz raw
dump) to the new test infrastructure.
1) Test case layout
The new infrastructure is dir based, each dir is one test type, and can
contain multiple images/scripts for different corner cases.
So layout will be the following:
btrfs-progs
|-tests
|-fsck-tests
|-001-SOME-CORRUPT-TYPE
|-IMAGE-FOR-CASE1
|-IMAGE-FOR-CASE2
2) Test case image types
Only 2 types for test case images.
a) btrfs-image dump
This one is the simplest case, one only needs to add the image to
corresponding dir.
b) custom script
This one is for all the resting cases which can't fit btrfs-image,
like csum error or script can generate the image (this reduces the
size obviously and good for review)
The old binary dump also belongs to this type, so need to add script
to extract them.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Gui Hecheng [Thu, 18 Dec 2014 03:32:35 +0000 (11:32 +0800)]
btrfs-progs: remove uneccessary subvol name check for subvol deletion
When we want to delete a subvol, we first check to see whether it is
a subvolume or not. After the check, we are sure that it is a valid
subvol, don't have to check its name.
Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com>
[removed unused variable 'len']
Signed-off-by: David Sterba <dsterba@suse.cz>
Fan Chengniang [Fri, 9 Jan 2015 08:11:42 +0000 (16:11 +0800)]
btrfs-progs: btrfstune: fix multiple options error
when we use multiple options, error return status will be override by the
last option status.
example: btrfstune -S 1 -r /dev/loop0
when -S option fails and -r option succeeds, return value is 0, rather than
1, where 1 is the right return status.
Reported-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
Signed-off-by: Fan Chengniang <fancn.fnst@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Fan Chengniang [Tue, 13 Jan 2015 03:53:16 +0000 (11:53 +0800)]
btrfs-progs: add missing options to qgroup limit
btrfs qgroup limit has two options -c and -e,. They were forgotten to add
to manpage.
Signed-off-by: Fan Chengniang <fancn.fnst@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Qu Wenruo [Wed, 14 Jan 2015 06:50:40 +0000 (14:50 +0800)]
btrfs-progs: Fix wrong return value when executing 'fi show' on umounted device.
When executing 'btrfs fi show' on unmounted device, even no problem
happens, the return value is still 1 not 0.
The problem lies in search_umounted_fs_uuids(), where when it finds the
given uuid, it should return 1, but later uuid copy overwrites the return
value, causing it always return 0 under that case.
Fix it by pass found as pointer, and return value only indicates
whether anything wrong happens, whether found or not is stored in the
new parameter.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Merlijn Wajer [Wed, 14 Jan 2015 12:13:15 +0000 (13:13 +0100)]
btrfs-progs: restore backtrace functionality on glibc
Originally broke in commit
c2691f807ddd2c6b261c5707f6838a45d9275390
__glibc__ should have been __GLIBC__
We also include features.h ; although most includes (at least stdlib.h)
typically already include it -- at least on glibc, where it matters.
Signed-off-by: Merlijn Wajer <merlijn@wizzup.org>
Reported-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Martin Volf [Fri, 9 Jan 2015 21:27:21 +0000 (22:27 +0100)]
btrfs-progs: Remove redundant short description from cmd_snapshot_usage
cmd_snapshot_usage in cmds-subvolume.c contains the short description
twice. Remove the first one.
Signed-off-by: Martin Volf <martin.volf.42@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
David Sterba [Fri, 9 Jan 2015 18:22:29 +0000 (19:22 +0100)]
Btrfs progs v3.18.1
Signed-off-by: David Sterba <dsterba@suse.cz>
Qu Wenruo [Mon, 22 Dec 2014 02:53:36 +0000 (10:53 +0800)]
btrfs-progs: Don't increase error count if the inode can be repaired.
The original check_inode_recs() will return -1 if found any error in a
inode_record. This is OK for original design since there is almost
nothing can repair at that time.
However more and more error from nlink mismatch to missing inode item
can be repaired in try_repair_inode(), check_inode_recs() should not
increase the error count if the inode can be repair.
With this patch, repair function for leaf-corruption will not return
error if all corruption inode can be recovered.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Reviewed-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Fan Chengniang [Fri, 9 Jan 2015 07:08:56 +0000 (15:08 +0800)]
btrfs-progs: fix some format errors in doc
Signed-off-by: Fan Chengniang <fancn.fnst@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Tsutomu Itoh [Thu, 8 Jan 2015 02:40:53 +0000 (11:40 +0900)]
btrfs-progs: doc: fix format of btrfs-replace
Current 'man btrfs-replace' is as follows:
========================================================================
...
...
-f
force using and overwriting <targetdev> even if it looks like
containing a valid btrfs filesystem.
A valid filesystem is assumed if a btrfs superblock is found
which contains a correct checksum. Devices which are currently
mounted are never allowed to be used as the <targetdev>. -B::::
no background replace.
...
...
========================================================================
The format of 'B' option is wrong. So, fix it.
Signed-off-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Qu Wenruo [Wed, 7 Jan 2015 09:23:43 +0000 (17:23 +0800)]
btrfs-progs: Fix a copy-n-paste bug in btrfs_read_fs_root().
Introduced in commit
96ec888aad41969 ("btrfs-progs: add quota group
verify code").
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Reviewed-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Qu Wenruo [Tue, 6 Jan 2015 09:30:44 +0000 (17:30 +0800)]
btrfs-progs: Fix a buffer overflow causing segfault in fstests/btrfs/069
The newly introduced search_chunk_tree_for_fs_info() won't count devid 0
in fi_arg->num_devices, which will cause buffer overflow since later
get_device_info() will fill di_args with devid.
This can be trigger by fstests/btrfs/069 and any operations needs to
iterate over all the devices like 'fi show' or 'dev stat' while
replacing.
The fix is do an extra probe specifically for devid 0 after
search_chunk_tree_for_fs_info() and change num_devices if needed.
Reported-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com>
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Peter Wu [Mon, 5 Jan 2015 14:10:09 +0000 (15:10 +0100)]
btrfs-progs: Documentation: fix broken conversion
Fixes various formatting issues:
Fixes quoting issues in various manpages. Before/After excerpts for
mkfs.btrfs(8), btrfs-qgroup(8):
mkfs.btrfs [-A|--alloc-start '<alloc-start>']
mkfs.btrfs [-A|--alloc-start <alloc-start>]
id 0/<subvolume id>''
id 0/<subvolume id>
If multiple '<attr>'s is given, use comma to separate.
If multiple <attr>s is given, use comma to separate.
The one that is most apparent is the removal of text in
btrfs-subvolume(8) and others. Before/After:
list [options] [-G <value>] [-C <value>] [--sort=rootid,gen,ogen,path] <path>
list [options] [-G [+|-]<value>] [-C [+|-]<value>] [--sort=rootid,gen,ogen,path] <path>
create [-i <qgroupid>] <name>
create [-i <qgroupid>] [<dest>]<name>
This happens because `<foo>` was replaced by `'<foo>'` in the sed
expression, which is then treated as a constrained quote. As a result,
the `[...]` before the string gets interpreted as "quoted text
attributes".
In this patch, the sed expression is dropped and asciidoc is configured
to recognize `<...>` as a unconstrained quoted string (such that
`<attr>s` is correctly emphasized) and to avoid adding quotes in
contexts where it is not needed.
A remaining problem is that some texts (the one between brackets) do not
add the emphasis for `<...>`. While this could be solved by replacing
`[` and `]` with `[` and `]` using sed, it introduces formatting
problems in btrfs-zero-log(8) because the context is ignored.
Signed-off-by: Peter Wu <peter@lekensteyn.nl>
Signed-off-by: David Sterba <dsterba@suse.cz>
Qu Wenruo [Mon, 5 Jan 2015 07:56:15 +0000 (15:56 +0800)]
btrfs-progs: Fix a extent buffer leak in count_csum_range().
The commit
f495a2ac6611 ("btrfs-progs: fsck: remove unfriendly BUG_ON()
for searching tree failure") is causing tons of extent buffer leak if some
csum mismatches in btrfsck.
This is caused by a misplaced btrfs_release_path(), fix it.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Reviewed-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Qu Wenruo [Mon, 5 Jan 2015 06:24:27 +0000 (14:24 +0800)]
btrfs-progs: Allow debug-tree to be executed on regular file.
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>
David Sterba [Tue, 6 Jan 2015 17:54:48 +0000 (18:54 +0100)]
btrfs-progs: convert, handle pwrite error in do_rollback
Resolves-coverity-id: 1242984
Signed-off-by: David Sterba <dsterba@suse.cz>
David Sterba [Tue, 6 Jan 2015 17:46:03 +0000 (18:46 +0100)]
btrfs-progs: handle orphan creation error in btrfs_unlink
The error handling is simple and just returns an error upward, no
cleanup.
Resolves-coverity-id: 1260251
Signed-off-by: David Sterba <dsterba@suse.cz>
David Sterba [Sat, 3 Jan 2015 02:33:31 +0000 (03:33 +0100)]
btrfs-progs: fix leak of path in reset_balance
A path may leak after an unlikely error condition.
Resolves-coverity-id: 1199474
Signed-off-by: David Sterba <dsterba@suse.cz>
David Sterba [Sat, 3 Jan 2015 02:24:10 +0000 (03:24 +0100)]
btrfs-progs: safely copy path in btrfs_scan_lblkid
We should terminate the string, let's use the wrapper.
Resolves-coverity-id: 1127097
Signed-off-by: David Sterba <dsterba@suse.cz>
David Sterba [Sat, 3 Jan 2015 02:13:11 +0000 (03:13 +0100)]
btrfs-progs: cleanup whitespace in is_same_blk_file
Signed-off-by: David Sterba <dsterba@suse.cz>
David Sterba [Sat, 3 Jan 2015 02:10:55 +0000 (03:10 +0100)]
btrfs-progs: use strncpy in is_same_blk_file
Although we're getting strings from the caller, let's be safe.
Resolves-coverity-id: 1199475
Signed-off-by: David Sterba <dsterba@suse.cz>