summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAge
...
| * btrfs-progs: Cleanup unneeded btrfs-find-root codesQu Wenruo2015-02-11
| | | | | | | | | | | | | | | | | | | | 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>
| * btrfs-progs: Switch btrfs-find-root to use the find-root infrastructureQu Wenruo2015-02-11
| | | | | | | | | | | | | | | | | | | | | | 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>
| * btrfs-progs: Add better search generation judgment for btrfs-find-rootQu Wenruo2015-02-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * btrfs-progs: Switch btrfs-find-root to use the new open_ctree flagsQu Wenruo2015-02-11
| | | | | | | | | | | | | | | | | | 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>
| * btrfs-progs: Add new find-root.[ch] infrastructureQu Wenruo2015-02-11
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * btrfs-progs: Add new btrfs_open_ctree_flags CHUNK_ONLYQu Wenruo2015-02-11
| | | | | | | | | | | | | | | | | | | | | | | | 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>
| * btrfs-progs: Add support to suppress tree block csum error outputQu Wenruo2015-02-11
| | | | | | | | | | | | | | | | | | | | | | | | 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>
| * btrfs-progs: Cleanup check_tree_block() functionQu Wenruo2015-02-11
|/ | | | | | | | | | | | | 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>
* Merge remote-tracking branch 'remotes/josef/for-kdave' into v3.19.xDavid Sterba2015-02-10
|\ | | | | | | | | | | | | | | "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."
| * Btrfs-progs: fix bad extent flagJosef Bacik2015-02-09
| | | | | | | | | | | | | | | | | | | | We can have FULL_BACKREF set or not set when we need the opposite, this patch fixes this problem by setting a bit when the flag is set improperly. This way we can either correct the problem when we re-create the extent item if the backrefs are also wrong, or we can just set the flag properly in the extent item. Thanks, Signed-off-by: Josef Bacik <jbacik@fb.com>
| * Btrfs-progs: skip opening all devices with restoreJosef Bacik2015-02-09
| | | | | | | | | | | | | | | | | | | | | | When we go to fixup the dev items after a restore we scan all existing devices. If you happen to be a btrfs developer you could possibly open up some random device that you didn't just restore onto, which gives you weird errors and makes you super cranky and waste a day trying to figure out what is failing. This will make it so that we use the fd we've already opened for opening our ctree. Thanks, Signed-off-by: Josef Bacik <jbacik@fb.com>
| * Btrfs-progs: make debug-tree spit out full_backref flagJosef Bacik2015-02-09
| | | | | | | | | | | | | | Currently btrfs-debug-tree ignores the FULL_BACKREF flag which makes it hard to figure out problems related to FULL_BACKREF. Thanks, Signed-off-by: Josef Bacik <jbacik@fb.com>
| * Btrfs-progs: make restore update dev itemsJosef Bacik2015-02-09
| | | | | | | | | | | | | | | | When we restore a multi disk image onto a single disk we need to update the dev items used and total bytes so that fsck doesn't freak out and that we get normal results from stuff like btrfs fi show. Thanks, Signed-off-by: Josef Bacik <jbacik@fb.com>
| * Btrfs-progs: unpin excluded extents as we fix thingsJosef Bacik2015-02-09
| | | | | | | | | | | | | | We don't want to keep extent records pinned down if we fix stuff as we may need the space and we can be pretty sure that these records are correct. Thanks, Signed-off-by: Josef Bacik <jbacik@fb.com>
| * Btrfs-progs: remove global transaction from fsckJosef Bacik2015-02-09
| | | | | | | | | | | | | | | | | | | | | | We hold a transaction open for the entirety of fixing extent refs. This works out ok most of the time but we can be tight on space and run out of space when fixing things. To get around this just push down the transaction starting dance into the functions that actually fix things. This keeps us from ending up with ENOSPC because we pinned everything and allows the code to be a bit simpler. Thanks, Signed-off-by: Josef Bacik <jbacik@fb.com>
| * Btrfs-progs: only build space info's for the main flagsJosef Bacik2015-02-09
| | | | | | | | | | | | | | | | | | | | | | Hitting enospc problems with a really corrupt fs uncovered the fact that we match any flag in a block group when creating space info's. This is a problem if we have a raid level set, we'll end up with only one space info that covers metadata and data because they share a raid level. We don't want this, we want to separate out the data and metadata space infos, so mask off the raid level and only use the main flags. Thanks, Signed-off-by: Josef Bacik <jbacik@fb.com>
| * Btrfs-progs: Introduce metadump_v2Josef Bacik2015-02-09
| | | | | | | | | | | | | | | | | | | | The METADUMP super flag makes us skip doing the chunk tree reading which isn't helpful for the new restore since we have a valid chunk tree. But we still want to have a way for the kernel to know that this is a metadump restore so it doesn't do things like verify data checksums. We also want to skip some of the device extent checks in fsck since those will obviously not match. Thanks, Signed-off-by: Josef Bacik <jbacik@fb.com>
| * Btrfs-progs: multi-thread btrfs-image restoreJosef Bacik2015-02-09
| | | | | | | | | | | | | | | | 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>
| * btrfs-progs: fix btrfs-image overlapping chunksJosef Bacik2015-02-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * Btrfs-progs: don't check csums for data reloc rootJosef Bacik2015-02-09
| | | | | | | | | | | | | | | | | | 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>
| * Btrfs-progs: don't try to repair reloc rootsJosef Bacik2015-02-09
| | | | | | | | | | | | | | | | | | 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>
| * Btrfs-progs: read super properly in btrfs-imageJosef Bacik2015-02-09
| | | | | | | | | | | | | | | | | | | | | | 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>
| * Btrfs-progs: handle -eagain properlyJosef Bacik2015-02-09
| | | | | | | | | | | | | | | | | | 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>
| * btrfs-progs: deal with no extent infoJosef Bacik2015-02-09
| | | | | | | | | | | | | | | | | | | | 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>
| * Btrfs-progs: let btrfs-corrupt-block specify a rootJosef Bacik2015-02-09
|/ | | | | | | | 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>
* Btrfs progs v3.19-rc2David Sterba2015-02-05
| | | | Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: build, do not install everything by defaultDavid Sterba2015-02-05
| | | | | | | | 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>
* btrfs-progs: autoconf: do not force fortify flagsDavid Sterba2015-02-05
| | | | | | Make it default, but let the user override it. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: autoconf: largefile support is driven by configureDavid Sterba2015-02-05
| | | | | | Don't force it in the makefile. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: autoconf: move custom CFLAGS from makefileDavid Sterba2015-02-05
| | | | | | | | 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>
* btrfs-progs: autoconf: set CFLAGS conditionallyDavid Sterba2015-02-05
| | | | | | | | | | | | 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>
* btrfs-progs: build, use the static library for the utilitiesDavid Sterba2015-02-04
| | | | | | | | | | 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>
* btrfs-progs: build, fix the source of btrfsck symlinkDavid Sterba2015-02-04
| | | | | | | | 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>
* btrfs-progs: autoconf: set exec_prefix in makefileDavid Sterba2015-02-04
| | | | | | | 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>
* Btrfs progs v3.19-rc1David Sterba2015-02-03
| | | | Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: qgroups, adjust help textDavid Sterba2015-02-03
| | | | | | | Minor rewording to make the line shorter and. Resolves-coverity-id: 1267280 Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: autoconf: check btrfs-convert dependenciesDavid Sterba2015-02-03
| | | | | | Use the standard pkg-config checks. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: autoconf: check if backtrace is really supportedDavid Sterba2015-02-03
| | | | Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: autoconf: print summary about featuresDavid Sterba2015-02-03
| | | | Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: autoconf: make btrfs-convert build optionalDavid Sterba2015-02-03
| | | | | | | Proposed at https://github.com/kdave/btrfs-progs/pull/6, I've added the configure options. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: autoconf: detect tools to build docsDavid Sterba2015-02-03
| | | | Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: build, fix version macro nameDavid Sterba2015-02-03
| | | | | | Autoconf changed it to PACKAGE_VERSION and moved to config.h. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: autoconf: use variable substitutions in doc makefileDavid Sterba2015-02-03
| | | | Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: autoconf: generate documentation makefile as wellDavid Sterba2015-02-03
| | | | | | This is plain move to .in. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: build, fix rules to clean temporary files in docsDavid Sterba2015-02-03
| | | | | | | | | | | | | | | | | $ 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>
* 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>