summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAge
* btrfs-progs: read_tree_block() and read_node_slot() cleanup.Qu Wenruo2015-02-02
| | | | | | | | | | | | 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>
* btrfs-progs: drop old fi balance syntax from helpDavid Sterba2015-02-02
| | | | | | | 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>
* btrfs-progs: add bash completion scriptDavid Sterba2015-02-02
| | | | | | | | | 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>
* btrfs-progs: Add repair function for discount file extent hole.Qu Wenruo2015-02-02
| | | | | | | | | | | | 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>
* btrfs-progs: Add repair and report function for orphan file extent.Qu Wenruo2015-02-02
| | | | | | | | | | | | | | | | | 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>
* btrfs-progs: Record and report every file extent hole.Qu Wenruo2015-02-02
| | | | | | | | | | | | | | | 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>
* btrfs-progs: Add btrfs_get_extent() and btrfs_punch_hole().Qu Wenruo2015-02-02
| | | | | | | | | | | | | | | | | | | 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>
* btrfs-progs: Record orphan data extent ref to corresponding root.Qu Wenruo2015-02-02
| | | | | | | | | | | | | | | | | | | | | | 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>
* btrfs-progs: build more utilities by defaultDavid Sterba2015-01-28
| | | | | | Get better build coverage, btrfs-fragments require external libraries. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: build, make autogen.sh work on older systemsDavid Sterba2015-01-28
| | | | | | | Try harder to find the support scipts, look into libtool or automake dirs directly. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: build, use autoconf to detect RMDavid Sterba2015-01-28
| | | | Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: build, clean all generated filesDavid Sterba2015-01-28
| | | | Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: build, make build test work againDavid Sterba2015-01-28
| | | | | | We need to regenerate version.h after clean-all. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: autoconf: add --disable-documentationKarel Zak2015-01-28
| | | | | Signed-off-by: Karel Zak <kzak@redhat.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: autoconf: add --disable-backtraceKarel Zak2015-01-28
| | | | | | | 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>
* btrfs-progs: autoconf: clean generated files, make version.h stuff more robustKarel Zak2015-01-28
| | | | | | | | - 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>
* btrfs-progs: autoconf: cleanup compilation flags usageKarel Zak2015-01-28
| | | | | | | | | | | | | | | | | | | - 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>
* btrfs-progs: autoconf: use paths and $*_LIBS from ./configureKarel Zak2015-01-28
| | | | | Signed-off-by: Karel Zak <kzak@redhat.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: autoconf: check for build programs in ./configureKarel Zak2015-01-28
| | | | | Signed-off-by: Karel Zak <kzak@redhat.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: autoconf: use ./configure to generate version.hKarel Zak2015-01-28
| | | | | | | | 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>
* btrfs-progs: autoconf: use standard PACKAGE_* macrosKarel Zak2015-01-28
| | | | | | | | | | | | | - 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>
* btrfs-progs: autoconf: use config.hKarel Zak2015-01-28
| | | | | | | | | | | | | - 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>
* btrfs-progs: autoconf: add ./configure scriptKarel Zak2015-01-28
| | | | | | | | | | | - 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>
* Btrfs progs v3.18.2David Sterba2015-01-27
| | | | Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: update wording for qgroup limitsDavid Sterba2015-01-27
| | | | | | | 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>
* btrfs-progs: don't output operational status information to stderrXing Gu2015-01-27
| | | | | Signed-off-by: Xing Gu <gux.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: check: Add --readonly flagHugo Mills2015-01-27
| | | | | | | | | | 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>
* btrfs-progs: Make option parsing more robust to code modificationsHugo Mills2015-01-27
| | | | | | | | | | | | | | 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>
* btrfs-progs: qgroup: make large size alignedFan Chengniang2015-01-27
| | | | | | | | | 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>
* btrfs-progs: drop feature defines from C files, in favour of CFLAGS definesDimitri John Ledkov2015-01-27
| | | | | | | | | | | | | | | | | | | | | | 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>
* btrfs-progs: unify getopt table terminatorsDavid Sterba2015-01-21
| | | | Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: add --human-readable option where applicableDavid Sterba2015-01-21
| | | | | | | 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>
* btrfs-progs: use predefined getopt values for unit suffixesDavid Sterba2015-01-21
| | | | Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: define common geopt values for unit suffixesDavid Sterba2015-01-21
| | | | Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: make btrfs qgroups show human readable sizesFan Chengniang2015-01-21
| | | | | | | | | | | | | | | | 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>
* btrfs-progs: unify header file inclusion protectionsDavid Sterba2015-01-21
| | | | | | There are missing ifdefs or defines with very generic names. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: Doc: Add explain on 'source' and 'target' for btrfs-image.Qu Wenruo2015-01-21
| | | | | | | | | 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>
* btrfs-progs: Cleanup, use bitshift instead of immediate number in ↵Qu Wenruo2015-01-21
| | | | | | | | | 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>
* btrfs-progs: btrfstune: force to set seeding flagsFan Chengniang2015-01-19
| | | | | | | | | | 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>
* btrfs-progs: tests, use non-interactive sudo helperDavid Sterba2015-01-19
| | | | | | | | 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>
* btrfs-progs: fix check of running scrubDavid Sterba2015-01-19
| | | | | | | | 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>
* btrfs-progs: make getopt tables static constDavid Sterba2015-01-19
| | | | Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: cleanup, move getop long options close to their useDavid Sterba2015-01-19
| | | | | | Move long_option defintions just before getopt_long everywhere. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: tests, adjust alignment of the pretty command nameDavid Sterba2015-01-14
| | | | Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: tests, use the root helper in 012David Sterba2015-01-14
| | | | | | We need it to mount/umount, to traverse lost+found and stat the results. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: tests, add support for running commands under rootDavid Sterba2015-01-14
| | | | | | | | 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>
* btrfs-progs: Move extent tree rebuild test to its dirQu Wenruo2015-01-14
| | | | | | | 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>
* btrfs-progs: Move leaf-corruption no extent data case and add verification ↵Qu Wenruo2015-01-14
| | | | | | | | | | | | | | | 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>
* btrfs-progs: Move bad root items test cases to its corresponding dirQu Wenruo2015-01-14
| | | | | | | | 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>
* btrfs-progs: Move btrfs-image dump to corresponding dirQu Wenruo2015-01-14
| | | | | | | | 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>