summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAge
* btrfs-progs: util: Fix a wrong unit of pretty_sizeQu Wenruo2016-03-14
| | | | | | | | | | | | | | | | | If parameter for pretty_size is smaller than default base(1024), pretty_size() will output wrong unit. For example, pretty_size(1008) will output '0.98B' not '1008B' or '0.98KiB'. The cause is, for default base and auto-detect unit, base will be 1024 but num_divs is still 0, last result will still be divided by base, causing the bug. Fix it by checking num_divs in default case, and if num_divs is 0, change base to 1. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: add image for bko#96971 (bad checksum type)David Sterba2016-03-14
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: libbtrfs: remove max/min macros from APIOndrej Kozina2016-03-14
| | | | | | | | | kerncompat.h header file is part of libbtrfs API. min/max macros cause conflict while building projects dependant on libbtrfs. Moving those macros to btrfs-progs internal header file fixes the conflict. Signed-off-by: Ondrej Kozina <okozina@redhat.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: convert: document -O|--features flagVytas Dauksa2016-03-14
| | | | | | | Copy-pasted description found at mkfs.btrfs. I did not bother with feature list as it seemed to be incomplete. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: don't print message for a missing deviceDavid Sterba2016-03-14
| | | | | | | | | | | The message "warning devid %llu not found already\n", does not seem to be too useful, it appears during several commands and sometimes repeatedly. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: restore: update error messagesDavid Sterba2016-03-14
| | | | | | Switch to common helpers, message wording changed. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: switch more error messages to common helpersDavid Sterba2016-03-14
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: fix misc/005-long-device-name-for-ssdDavid Sterba2016-03-14
| | | | | | | | We use a device mapper device on top of a loop device, the change in rotational status does not always propagate if change it at the loop device sysfs node. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: inspect: remove unnecessary helpersDavid Sterba2016-03-14
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: unify argc min/max checkingDavid Sterba2016-03-14
| | | | | | We don't want to modify argc. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: unify naming of argc and argvDavid Sterba2016-03-14
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: rename commandline helpersDavid Sterba2016-03-14
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: add getopt stubs where neededDavid Sterba2016-03-14
| | | | | | | | | Commands that do not take any options do not use getopt, which means the standard option separator "--" does not work. Update all command handlers that need it, argv needs to be referenced using the optind that is correctly pointed after the separator. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: docs: add note about resizing to max after device replaceAlexander Fougner2016-03-14
| | | | | | Signed-off-by: Alexander Fougner <fougner89@gmail.com> [ formatting adjustments ] Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: fi du: add long options for unitsDavid Sterba2016-03-14
| | | | | | Drop -h, add just the common long options for now. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: fi du: switch to u64David Sterba2016-03-14
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: fi du: Calculate space shared by each directory arguments file setMark Fasheh2016-03-14
| | | | | | | | | | | | | | 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>
* btrfs-progs: filesystem: add 'du' commandMark Fasheh2016-03-14
| | | | | | | | | | | | | | | | | '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>
* btrfs-progs: build: extend per-binary objectsDavid Sterba2016-03-14
| | | | | | | | | 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>
* btrfs-progs: update docs for inspect-internal dump-superAlexander Fougner2016-03-14
| | | | | | Signed-off-by: Alexander Fougner <fougner89@gmail.com> [ minor formatting updates ] Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: introduce inspect-internal dump-superAlexander Fougner2016-03-14
| | | | | | | | 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>
* btrfs-progs: update docs and completion for inspect-internal dump-treeAlexander Fougner2016-03-14
| | | | | Signed-off-by: Alexander Fougner <fougner89@gmail.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: copy functionality of btrfs-debug-tree to inspect-internal ↵Alexander Fougner2016-03-14
| | | | | | | | | | 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>
* Btrfs progs v4.4.1David Sterba2016-02-26
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: Import interval tree implemenation from Linux v4.0-rc7.Mark Fasheh2016-02-26
| | | | | | | | | 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>
* btrfs-progs: misc-test: Add regression test for find-root gives empty resultQu Wenruo2016-02-26
| | | | | | | | | 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>
* btrfs-progs: find-root: Allow btrfs-find-root to search chunk root even ↵Qu Wenruo2016-02-26
| | | | | | | | | | | | | 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>
* btrfs-progs: Add support for tree block operations on fs_info without rootsQu Wenruo2016-02-26
| | | | | | | | | | | | | 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>
* btrfs-progs: Allow open_ctree to return fs_info even chunk tree is corruptedQu Wenruo2016-02-26
| | | | | | | | | | | | | | | | | | | | | | | | | 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>
* btrfs-progs: volume: Fix a bug causing btrfs-find-root to skip first chunkQu Wenruo2016-02-26
| | | | | | | | | | | | | | | 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>
* btrfs-progs: fix symlink creation multiple timesHongxu Jia2016-02-26
| | | | | | | | | | | | | | | | | | | | | | | 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>
* btrfs-progs: tests: use common variables and helpersDavid Sterba2016-02-23
| | | | | | Use TEST_DEV and the associated helpers to manage the tested image. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: store checksums in /tmpDavid Sterba2016-02-23
| | | | | | We don't want to store the checksum on filesystem that we're converting. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: do checksum verification with convert-testsLakshmipathi.G2016-02-23
| | | | | Signed-off-by: Lakshmipathi.G <Lakshmipathi.G@giis.co.in> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: write down the meaning of BTRFS_ARG_BLKDEVSatoru Takeuchi2016-02-05
| | | | | | | | 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>
* btrfs-progs: describe btrfs-send requires read-only subvolumeSatoru Takeuchi2016-02-04
| | | | | | | | 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>
* btrfs-progs: Fix self-reference of man btrfs-subvolumeSatoru Takeuchi2016-02-04
| | | | | | | 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>
* btrfs-progs: doc: fix size suffix in mkfs.btrfsTsutomu Itoh2016-01-28
| | | | | | | | 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>
* btrfs-progs: doc: fix typo of some documentsTsutomu Itoh2016-01-28
| | | | | | | Some typos are corrected. Signed-off-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: fix compat_ro mask for free space treeDavid Sterba2016-01-25
| | | | | | | | | 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>
* btrfs-progs: Makefile.in: Simplify/correct install-staticMike Gilbert2016-01-21
| | | | | | | | | | | 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>
* Btrfs progs v4.4David Sterba2016-01-18
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: docs: update balance manual pageDavid Sterba2016-01-15
| | | | | | | Make the new balance filters' syntax more explicit. Other rewording and reformatting. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: debug-tree: tweak tree node checksDavid Sterba2016-01-15
| | | | | | | | | | 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>
* btrfs-progs: fix static buildNoah Massey2016-01-15
| | | | | | | | | 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>
* btrfs-progs: Use AC_CHECK_TOOL to find ARMike Gilbert2016-01-14
| | | | | | | 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>
* Btrfs progs v4.4-rc1David Sterba2016-01-14
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: subvol show: use clean_args_no_options instead of opencodingDavid Sterba2016-01-14
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: introduce helper for parsing args without optionsDavid Sterba2016-01-14
| | | | | | | | | 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>
* btrfs-progs: move prefixcmp to utilsDavid Sterba2016-01-14
| | | | Signed-off-by: David Sterba <dsterba@suse.com>