Commit Graph

2448 Commits (c27640938de1506e0a02f7f928a00886d5da616a)
 

Author SHA1 Message Date
Alexander Fougner c27640938d btrfs-progs: docs: add note about resizing to max after device replace
Signed-off-by: Alexander Fougner <fougner89@gmail.com>
[ formatting adjustments ]
Signed-off-by: David Sterba <dsterba@suse.com>
2016-03-14 13:42:47 +01:00
David Sterba aad4b1f081 btrfs-progs: fi du: add long options for units
Drop -h, add just the common long options for now.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-03-14 13:42:47 +01:00
David Sterba 54dea513c6 btrfs-progs: fi du: switch to u64
Signed-off-by: David Sterba <dsterba@suse.com>
2016-03-14 13:42:47 +01:00
Mark Fasheh bc23667bd2 btrfs-progs: fi du: Calculate space shared by each directory arguments file set
Here we define each file set as those found by a recursive search of a
single directory argument to btrfs fi du.

This isn't as simple as adding up shared extents - they may be shared with
each other, and may also overlap. This patch uses an interval tree to store
shared extents we find while fiemapping files. After collecting them, a 'set
shared' count is calculated by summing (without overlap) each shared region
discovered. This is then displayed to the user as 'set shared'.

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
Signed-off-by: David Sterba <dsterba@suse.com>
2016-03-14 13:42:47 +01:00
Mark Fasheh a2e7ff1eae btrfs-progs: filesystem: add 'du' command
'btrfs du' differs from regular du in that it will work to resolve which
blocks are shared between files in its list. This gives the user a more
accurate bytecount from which they can make decisions regarding management
of their file space.

We still print a total number of bytes counted (like regular du), but also
print the number of bytes which were found to have been shared amongst the
file set provided. From there it becomes trivial to calculate how much space
is exclusively owned.

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
[ rename files to reflect the filesystem command group, add GPL v2
  file headers ]
Signed-off-by: David Sterba <dsterba@suse.com>
2016-03-14 13:42:47 +01:00
David Sterba b5e7979ad2 btrfs-progs: build: extend per-binary objects
The standalone utilities could share object files with the main utility,
add a way to specify additional object files in a similar way to the
extra libs. The variable name must match the binary plus _objects
suffix and  s/-/_/ .

Signed-off-by: David Sterba <dsterba@suse.com>
2016-03-14 13:42:47 +01:00
Alexander Fougner 2ae0b12df0 btrfs-progs: update docs for inspect-internal dump-super
Signed-off-by: Alexander Fougner <fougner89@gmail.com>
[ minor formatting updates ]
Signed-off-by: David Sterba <dsterba@suse.com>
2016-03-14 13:42:47 +01:00
Alexander Fougner eaa93e3b02 btrfs-progs: introduce inspect-internal dump-super
The long-term plan is to merge the features of standalone tools
into the btrfs binary, reducing the number of shipped binaries.

Signed-off-by: Alexander Fougner <fougner89@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2016-03-14 13:42:47 +01:00
Alexander Fougner a7dae09ae2 btrfs-progs: update docs and completion for inspect-internal dump-tree
Signed-off-by: Alexander Fougner <fougner89@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2016-03-14 13:42:47 +01:00
Alexander Fougner fcd480a4d0 btrfs-progs: copy functionality of btrfs-debug-tree to inspect-internal subcommand
The long-term plan is to merge the features of standalone tools
into the btrfs binary, reducing the number of shipped binaries.

Signed-off-by: Alexander Fougner <fougner89@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2016-03-14 13:42:47 +01:00
David Sterba 9459f3650c
Btrfs progs v4.4.1
Signed-off-by: David Sterba <dsterba@suse.com>
2016-02-26 18:22:09 +01:00
Mark Fasheh 282dd33a43 btrfs-progs: Import interval tree implemenation from Linux v4.0-rc7.
While I had the chance, I compared the rbtre code in btrfs-progs to that of
the latest kernel.  No new bug fixes need importing, however rbtree.h and
rbtree_augmented.h get documentation updates

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
Signed-off-by: David Sterba <dsterba@suse.com>
2016-02-26 17:27:58 +01:00
Qu Wenruo 154d28dd99 btrfs-progs: misc-test: Add regression test for find-root gives empty result
Add regression test for btrfs-find-root gives empty result even the fs
is OK.

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
[ enhanced test ]
Signed-off-by: David Sterba <dsterba@suse.com>
2016-02-26 17:27:58 +01:00
Qu Wenruo c8c3715969 btrfs-progs: find-root: Allow btrfs-find-root to search chunk root even chunk root is corrupted
Since now open_ctree_fs_info() can even return a valid fs_info with only
system chunk mapping from super block, use this ability to do chunk root
search for heavily damanged fs.

As an fast alternative for time consuming and buggy chunk-recovery.

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2016-02-26 17:27:58 +01:00
Qu Wenruo 9db13dca2f btrfs-progs: Add support for tree block operations on fs_info without roots
Since open_ctree_fs_info() now may return a fs_info even without any
roots, modify functions like read_tree_block() to operate with such
fs_info.

This provides the basis for btrfs-find-root to operate on chunk tree
with corrupted fs.

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
[ coding style adjustments, unified declarations ]
Signed-off-by: David Sterba <dsterba@suse.com>
2016-02-26 17:27:58 +01:00
Qu Wenruo 43318324d2 btrfs-progs: Allow open_ctree to return fs_info even chunk tree is corrupted
Current open_ctree_fs_info() won't return anything if chunk tree root is
corrupted.
This makes some function, like btrfs-find-root, unable to find any older
chunk tree root, even it is possible to use system_chunk_array in super
block.

And at least two users in mail list has reported such heavily chunk
corruption.
Although we have 'btrfs rescue chunk-recovery' but it's too time
consuming and sometimes not able to cope with a specific filesystem
corruption.

This patch adds a new open ctree flag,
OPEN_CTREE_IGNORE_CHUNK_TREE_ERROR, allowing fs_info to be returned from
open_ctree_fs_info() even there is no valid tree root in it.

Also adds a new close_ctree() variant, close_ctree_fs_info() to handle
possible fs_info without any root.

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
[ adjusted error messages ]
Signed-off-by: David Sterba <dsterba@suse.com>
2016-02-26 17:27:58 +01:00
Qu Wenruo e2e0dae926 btrfs-progs: volume: Fix a bug causing btrfs-find-root to skip first chunk
There is a small bug from 2011, where btrfs_next_bg (formally
btrfs_next_metadata) function will always skip the first chunk.

That's OK for that time, as there is always 3 empty temporary chunks.
But now, we may ended up with only one metadata or system chunk, with
empty chunk auto-remove from kernel or new mkfs.btrfs.

So fix it by checking the initial value so btrfs_next_bg() will return
the first chunk if its *logical parameter is 0.

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2016-02-26 17:27:58 +01:00
Hongxu Jia bfc2cb7cfb btrfs-progs: fix symlink creation multiple times
The rule to create symlink in Makefile caused parallel issue:
$ make -j 40 DESTDIR=/image install BUILD_VERBOSE=1
...
  1     [LN]     libbtrfs.so.0
  2     [LN]     libbtrfs.so
  3 ln -s -f libbtrfs.so.0.1 libbtrfs.so.0
  4 ln -s -f libbtrfs.so.0.1 libbtrfs.so.0
  5 ln -s -f libbtrfs.so.0.1 libbtrfs.so
  6 ln -s -f libbtrfs.so.0.1 libbtrfs.so
...

It failed occasionally:
...
|symlinkat: couldn't stat 'git/libbtrfs.so' even though symlink
creation succeeded (No such file or directory).
|ln: failed to create symbolic link 'libbtrfs.so': No such file or directory
...

Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2016-02-26 17:27:58 +01:00
David Sterba 476d17fe38 btrfs-progs: tests: use common variables and helpers
Use TEST_DEV and the associated helpers to manage the tested image.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-02-23 19:02:23 +01:00
David Sterba 0ad5efde1a btrfs-progs: tests: store checksums in /tmp
We don't want to store the checksum on filesystem that we're converting.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-02-23 19:02:23 +01:00
Lakshmipathi.G cc57faac2e btrfs-progs: tests: do checksum verification with convert-tests
Signed-off-by: Lakshmipathi.G <Lakshmipathi.G@giis.co.in>
Signed-off-by: David Sterba <dsterba@suse.com>
2016-02-23 19:02:23 +01:00
Satoru Takeuchi be09626592 btrfs-progs: write down the meaning of BTRFS_ARG_BLKDEV
Although BTRFS_ARG_BLKDEV can be returned from check_arg_type(),
it's not explained the meaning.

Signed-off-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2016-02-05 16:19:52 +01:00
Satoru Takeuchi 194a4053f9 btrfs-progs: describe btrfs-send requires read-only subvolume
Both man btrfs-send(8) and usage message don't describe
btrfs-send needs read-only snapshot as its argument.

Signed-off-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2016-02-04 15:19:32 +01:00
Satoru Takeuchi bf111ecf90 btrfs-progs: Fix self-reference of man btrfs-subvolume
btrfs-subvolume(8) is mentioned at "SEE ALSO" section of itself.

Signed-off-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2016-02-04 15:19:29 +01:00
Tsutomu Itoh 060a55c331 btrfs-progs: doc: fix size suffix in mkfs.btrfs
There is no petabyte in the explanation of the suffix of
the size parameter. So, it's added.

Signed-off-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2016-01-28 12:42:00 +01:00
Tsutomu Itoh 39ac3d16c1 btrfs-progs: doc: fix typo of some documents
Some typos are corrected.

Signed-off-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2016-01-28 12:41:56 +01:00
David Sterba d30b0be836 btrfs-progs: fix compat_ro mask for free space tree
The BTRFS_FEATURE_COMPAT_RO_FREE_SPACE_TREE bit is supposed to be in the
COMPAT_RO_SUPP bitmask.

Reported-by: Holger Hoffstätte <holger.hoffstaette@googlemail.com>
Reported-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2016-01-25 15:35:30 +01:00
Mike Gilbert 30ce6c76c1 btrfs-progs: Makefile.in: Simplify/correct install-static
install -D does not create the last component, so this failed if
$(DESTDIR)$(bindir) did not already exist.

There's no need for a loop here since install accepts multiple source
arguments.

Signed-off-by: Mike Gilbert <floppym@gentoo.org>
Signed-off-by: David Sterba <dsterba@suse.com>
2016-01-21 19:35:33 +01:00
David Sterba 21258fab2c
Btrfs progs v4.4
Signed-off-by: David Sterba <dsterba@suse.com>
2016-01-18 13:56:35 +01:00
David Sterba 2460df7cd6 btrfs-progs: docs: update balance manual page
Make the new balance filters' syntax more explicit. Other rewording and
reformatting.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-01-15 15:19:50 +01:00
David Sterba a2b24489da btrfs-progs: debug-tree: tweak tree node checks
The tree root and chunk root base pointers are verified in open_ctree so
we don't get NULL here. We still check the node pointers to get better
error message.

Resolves-coverity-id: 1348450
Resolves-coverity-id: 1348451
Signed-off-by: David Sterba <dsterba@suse.com>
2016-01-15 14:16:36 +01:00
Noah Massey 1bb0bba1b6 btrfs-progs: fix static build
Change in "btrfs-progs: introduce helper for parsing args without
options" added a dependency on help.o that was duplicated for the static
build.

Signed-off-by: Noah Massey <noah.massey@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2016-01-15 13:31:44 +01:00
Mike Gilbert 17e204bb5e btrfs-progs: Use AC_CHECK_TOOL to find AR
AC_CHECK_TOOL takes the --host option into account for cross-compiling.

Signed-off-by: Mike Gilbert <floppym@gentoo.org>
Signed-off-by: David Sterba <dsterba@suse.com>
2016-01-14 11:46:59 +01:00
David Sterba 0de3c18b95
Btrfs progs v4.4-rc1
Signed-off-by: David Sterba <dsterba@suse.com>
2016-01-14 11:16:27 +01:00
David Sterba 62cb593894 btrfs-progs: subvol show: use clean_args_no_options instead of opencoding
Signed-off-by: David Sterba <dsterba@suse.com>
2016-01-14 11:07:10 +01:00
David Sterba a6cc8ea10a btrfs-progs: introduce helper for parsing args without options
All commands should support the "--" option separator. This is
transparently handled by getopt, but we don't use that everywhere.
Introduce a helper for commands that take no options (just the path).
The object file dependencies need to be adjusted a bit.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-01-14 11:07:10 +01:00
David Sterba c26dc1ef33 btrfs-progs: move prefixcmp to utils
Signed-off-by: David Sterba <dsterba@suse.com>
2016-01-14 11:07:10 +01:00
David Sterba 3f248d2431 btrfs-progs: receive: don't leak open find handle
Resolves-coverity-id: 1348121
Signed-off-by: David Sterba <dsterba@suse.com>
2016-01-14 11:07:10 +01:00
David Sterba 7faf96e30a btrfs-progs: also check filesystem type in test_issubvolume
A subvolume is a directory with inode number 256 on a btrfs filesytem.
Add the missing check to test_issubvolume for completeness, otherwise we
always do that in btrfs_open_dir.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-01-14 11:07:10 +01:00
David Sterba dddc3e08cb btrfs-progs: more verbose errors from test_issubvolume
Signed-off-by: David Sterba <dsterba@suse.com>
2016-01-14 11:07:10 +01:00
David Sterba 7afde59e38 btrfs-progs: let test_issubvolume return the exact error
Return any error from stat, minor cleanups.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-01-14 11:07:10 +01:00
David Sterba 33ac47b5fb btrfs-progs: use symbolic name for subvolume inode number in test_issubvolume
Signed-off-by: David Sterba <dsterba@suse.com>
2016-01-14 11:07:10 +01:00
David Sterba 5b56fe9db5 btrfs-progs: handle errors from test_isdir
Signed-off-by: David Sterba <dsterba@suse.com>
2016-01-14 11:07:09 +01:00
David Sterba 1267c58e58 btrfs-progs: let test_isdir return the exact error
Return any error from stat, normalize the return value in case the path
is a directory.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-01-13 17:45:41 +01:00
David Sterba 2078848983 btrfs-progs: debug-tree: teach -t option about the chunk and root trees
A user on IRC wanted to dump the chunk tree using the -t option. As the
-t option enumerates only trees pointed by the tree_root, the chunk tree
is skipped. Similar for th tree of tree roots.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-01-13 16:43:48 +01:00
David Sterba 0aa796cad7 btrfs-progs: subvol show: handle options by getopt
The subvolume show command does not take any optios but at least it
should honor "--", as reported.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=110181
Reported-by: <moviuro+kernel@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2016-01-13 16:43:48 +01:00
David Sterba b9ec406c0f btrfs-progs: fi usage: support mixed blockgroups
Properly account the duplicated block groups and global reserve.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=110111
Reported-by: Chris Murphy <bugzilla@colorremedies.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2016-01-13 16:43:13 +01:00
David Sterba ecd4bb607f btrfs-progs: docs: enhance btrfs-filesystem manual page
Wording, formatting, explanations, examples.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-01-12 18:42:49 +01:00
David Sterba ac45d64c04 btrfs-progs: tests: add missing prerequisites
Signed-off-by: David Sterba <dsterba@suse.com>
2016-01-12 15:16:11 +01:00
David Sterba 4b9d4fe00f btrfs-porgs: fi usage: rename variable to avoid shadowing
Reported by gcc -Wshadow .

Signed-off-by: David Sterba <dsterba@suse.com>
2016-01-12 15:02:57 +01:00