summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAge
* btrfs-progs: docs: fix typos in READMEs, INSTALL and CHANGESJosh Soref2018-11-26
| | | | | | | | Generated by https://github.com/jsoref/spelling Issue: #154 Author: Josh Soref <jsoref@users.noreply.github.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: docs: fix typos in DocumentationJosh Soref2018-11-26
| | | | | | | | Generated by https://github.com/jsoref/spelling Issue: #154 Author: Josh Soref <jsoref@users.noreply.github.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: pull zstd version 1.3.7 to the travis CIDavid Sterba2018-11-26
| | | | | | | There's a newer version of zstd, without any obvious changes that would affect our build testing coverage. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: link to libbtrfsutil/README from the main READMEDavid Sterba2018-11-26
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* libbtrfsutil: document API in READMEOmar Sandoval2018-11-26
| | | | | | | | | btrfsutil.h and the Python docstrings are thorough, but I've gotten a couple of requests for a high-level overview of the available interfaces and example usages. Add them to README.md. Signed-off-by: Omar Sandoval <osandov@fb.com> Signed-off-by: David Sterba <dsterba@suse.com>
* libbtrfsutil: bump version to 1.1.0Omar Sandoval2018-11-26
| | | | | | | | With the previous few fixes and features, we should bump the minor version. Signed-off-by: Omar Sandoval <osandov@fb.com> Signed-off-by: David Sterba <dsterba@suse.com>
* libbtrfsutil: relax the privileges of subvolume iteratorOmar Sandoval2018-11-26
| | | | | | | | | | | | | We can use the new BTRFS_IOC_GET_SUBVOL_ROOTREF and BTRFS_IOC_INO_LOOKUP_USER ioctls to allow non-root users to list subvolumes. This is based on a patch from Misono Tomohiro but takes a different approach (mainly, this approach is more similar to the existing tree search approach). Signed-off-by: Omar Sandoval <osandov@fb.com> Signed-off-by: David Sterba <dsterba@suse.com>
* libbtrfsutil: relax the privileges of subvolume_info()Omar Sandoval2018-11-26
| | | | | | | | | | | | Attempt to use the BTRFS_IOC_GET_SUBVOL_INFO ioctl (added in kernel 4.18) for subvolume_info() if not root. Also, rename get_subvolume_info_root() -> get_subvolume_info_privileged() for consistency with further changes. This is based on a patch from Misono Tomohiro. Signed-off-by: Omar Sandoval <osandov@fb.com> Signed-off-by: David Sterba <dsterba@suse.com>
* libbtrfsutil: allow tests to create multiple Btrfs instancesOmar Sandoval2018-11-26
| | | | | | | | Some upcoming tests will need to create a second Btrfs filesystem, so add support for this to the test helpers. Signed-off-by: Omar Sandoval <osandov@fb.com> Signed-off-by: David Sterba <dsterba@suse.com>
* libbtrfsutil: add test helpers for dropping privilegesOmar Sandoval2018-11-26
| | | | | | | | These will be used for testing some upcoming changes which allow unprivileged operations. Signed-off-by: Omar Sandoval <osandov@fb.com> Signed-off-by: David Sterba <dsterba@suse.com>
* libbtrfsutil: use SubvolumeIterator as context manager in testsOmar Sandoval2018-11-26
| | | | | | | | We're leaking file descriptors, which makes it impossible to clean up the temporary mount point created by the test. Signed-off-by: Omar Sandoval <osandov@fb.com> Signed-off-by: David Sterba <dsterba@suse.com>
* libbtrfsutil: document qgroup_inherit parameter in Python bindingsOmar Sandoval2018-11-26
| | | | | | | This has been supported since day one, but it wasn't documented. Signed-off-by: Omar Sandoval <osandov@fb.com> Signed-off-by: David Sterba <dsterba@suse.com>
* libbtrfsutil: change async parameters to async_ in Python bindingsOmar Sandoval2018-11-26
| | | | | | | | | | async became a keyword in Python 3.7, so, e.g., create_subvolume('foo', async=True) is now a syntax error. Fix it with the Python convention of adding a trailing underscore to the keyword (async -> async_). This is what several other Python libraries did to handle this. Signed-off-by: Omar Sandoval <osandov@fb.com> Signed-off-by: David Sterba <dsterba@suse.com>
* libbtrfsutil: use top=0 as default for SubvolumeIterator()Omar Sandoval2018-11-26
| | | | | | | | | | Right now, we're defaulting to top=5 (i.e, all subvolumes). The documented default is top=0 (i.e, only beneath the given path). This is the expected behavior. Fix it and make the test cases cover it. Reported-by: Jonathan Lemon <bsd@fb.com> Signed-off-by: Omar Sandoval <osandov@fb.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: docs: fix rendering of exponents in manual pagesDavid Sterba2018-11-20
| | | | | | | | Reported on IRC that the inode number limit appears to be 264, while the actual value is 2^64. Fix that for the manual page backend by redefining the format. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: README: add link to INSTALLDavid Sterba2018-11-13
| | | | | | Make clickable and more visible in the formatted text. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: kerncompat: rename swap to __swapDavid Sterba2018-11-13
| | | | | | | | | | | The 'swap' is too generic and clashes with some userspace tools that compile against btrfs, eg. snapper when including boost::smart_ptr::scoped_array after kerncompat.h: /usr/include/boost/smart_ptr/scoped_array.hpp:127:13: error: macro "swap" requires 2 arguments, but only 1 given a.swap(b); Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: treewide: Fix missing declarationsRosen Penev2018-11-13
| | | | | | | | | | | | Found using -Wmissing-prototypes in GCC. This should improve LTO behavior. Note that set_free_space_tree_thresholds is an unused function. Adding inline seems to remove the unused function warning. Reviewed-by: Nikolay Borisov <nborisov@suse.com> Signed-off-by: Rosen Penev <rosenp@gmail.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: task-utils: Fix comparison between pointer and integerRosen Penev2018-11-13
| | | | | | | | | pthread_t is an opaque type, not an integer one. The > 0 makes no sense and compiler throws a warning. Reviewed-by: Nikolay Borisov <nborisov@suse.com> Signed-off-by: Rosen Penev <rosenp@gmail.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: kernel-lib: bitops: Fix big endian compilationRosen Penev2018-11-13
| | | | | | | | | | | | | | Replaced bswap with _ variants bswap_32 etc. While it's a glibc extension, all of the popular libc implementations (glibc, uClibc, musl, BIONIC) seem to support it. Added static inline to two functions to match little endian variants. This fixes a linking error experienced when compiling on gcc 7.3.0 with LTO, possibly a bug that was fixed later. Reviewed-by: Nikolay Borisov <nborisov@suse.com> Signed-off-by: Rosen Penev <rosenp@gmail.com> Signed-off-by: David Sterba <dsterba@suse.com>
* Btrfs progs v4.19David Sterba2018-11-03
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: update CHANGES for v4.19David Sterba2018-11-03
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: doc: Update btrfs-qgroup regarding the rescan conditionsQu Wenruo2018-10-31
| | | | | | | | | | | | Add a new section, QUOTA RESCAN, to explain why and when we need a full quota rescan when assigning/removing qgroup relationship. Also, since 'remove' shares the same options of 'assign', add reference to 'assign' options for 'remove' subcommand. Signed-off-by: Qu Wenruo <wqu@suse.com> [ update ] Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: qgroup: make --rescan the default behavior after assignQu Wenruo2018-10-31
| | | | | | | | | | | | | Even though we have --rescan option, it still needs the user to manually specify it or call quota rescan command. This does not make much sense for the most common usecase and only confuses users. When the rescan is not desired, the --no-rescan option can be used, eg. when a mass qgruop assignment happens and the repeated rescan would slow things down. This is considered a marginal usecase. Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: qgroup: Use bool to replace int for @rescanQu Wenruo2018-10-31
| | | | | | | Use more appropriate type. Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: btrfstune: Rename change_header_uuid to change_buffer_header_uuidNikolay Borisov2018-10-31
| | | | | | | | | | | | Rename the function so its name falls in line with the rest of btrfs nomenclature. So when we change the uuid of the header it's in fact of the buffer header. Also remove the root argument since it's used solely to take a reference to fs_info which can be done via the mandatory eb argument. No functional changes. Reviewed-by: Qu Wenruo <wqu@suse.com> Signed-off-by: Nikolay Borisov <nborisov@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: btrfstune: Remove fs_info arg from change_device_uuidNikolay Borisov2018-10-31
| | | | | | | | | | This function already takes an extent buffer that contains a reference to the fs_info. Use that and reduce argument count. No functional changes. Reviewed-by: Qu Wenruo <wqu@suse.com> Signed-off-by: Nikolay Borisov <nborisov@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: print-tree: Use bool for @followQu Wenruo2018-10-31
| | | | | | | Just a minor cleanup to make the parameter easier to read. Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: print-tree: Introduce --bfs and --dfs optionsQu Wenruo2018-10-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Originally print-tree uses depth first search to print trees. This works fine until we reach 3 level trees (root node level is 2). For tall trees whose root level is 2 or higher, DFS will mix nodes and leaves like the following example: Level 2 A / \ Level 1 B C / | | \ Level 0 D E F G DFS will cause the following output sequence: A B D E C F G Which in term of node/leave is: N N L L N L L Such mixed node/leave result is sometimes hard for human to read. This patch will introduce 2 new options, --bfs and --dfs. --dfs: keeps the original output sequence, and to keep things compatible it's the default behavior. --bfs: uses breadth-first search, and will cause better output sequence like: A B C D E F G Which in term of node/leave is: N N N L L L L Much better sorted and may become default in the future. Reviewed-by: Nikolay Borisov <nborisov@suse.com> Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: print-tree: Introduce breadth-first searchQu Wenruo2018-10-31
| | | | | | | | | Introduce a new function, bfs_print_children(), to do breadth-first search to print a node. Reviewed-by: Nikolay Borisov <nborisov@suse.com> Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: Introduce function to find next sibling tree blockQu Wenruo2018-10-31
| | | | | | | | | | | | | | | | Introduce a new function, btrfs_next_sibling_tree_block(), which could find any sibling tree blocks at path->lowest_level, unlike level 0 limited btrfs_next_leaf(). Since this function is more generic than btrfs_next_leaf(), also make btrfs_next_leaf() a wrapper of btrfs_next_sibling_tree_block(), to keep the interface the same as kernel. This would provide the basis for later breadth-first search print-tree. Reviewed-by: Nikolay Borisov <nborisov@suse.com> Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: Replace root parameter using fs_info for reada_for_search()Qu Wenruo2018-10-31
| | | | | | | | | As the @root parameter is only used to get @fs_info, use fs_info directly instead. Reviewed-by: Nikolay Borisov <nborisov@suse.com> Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* libbtrfsutil: factor out btrfs_util_subvolume_info_fdMisono Tomohiro2018-10-31
| | | | | | | | | Factor out main logic of btrfs_util_subvolume_info_fd(). This is a preparation work to relax the root privilege of this function. No functional changes. Signed-off-by: Misono Tomohiro <misono.tomohiro@jp.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: ioctl/libbtrfsutil: add 3 definitions of new unprivileged ioctlMisono Tomohiro2018-10-31
| | | | | | | | | | | | | | Copy and add 3 definitions of new unprivileged ioctls: * BTRFS_IOC_GET_SUBVOL_INFO * BTRFS_IOC_GET_SUBVOL_ROOTREF * BTRFS_IOC_INO_LOOKUP_USER from kernel definitions. They will be used to implement the version of "btrfs subvolume list/show" that will not require root privileges. Signed-off-by: Misono Tomohiro <misono.tomohiro@jp.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: doc: update manual page of btrfs subvolumeMisono Tomohiro2018-10-31
| | | | | | | | | | | | | | | Some information is obsolete and updated as follows: - add missing explanations of some options - remove outdated explanation of "subvolrootid" mount option - reorder/group options of "subvolume list" so it matches the help message - add explanation of different meanings of parent in "parent ID/UUID" - fix indentation/spelling - add missing comma Signed-off-by: Misono Tomohiro <misono.tomohiro@jp.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: convert strerror to implicit %mDavid Sterba2018-10-31
| | | | | | | | | | | | | | | Similar to the changes where strerror(errno) was converted, continue with the remaining cases where the argument was stored in another variable. The savings in object size are about 4500 bytes: $ size btrfs.old btrfs.new text data bss dec hex filename 805055 24248 19748 849051 cf49b btrfs.old 804527 24248 19748 848523 cf28b btrfs.new Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: image: Warn about log tree generation mismatch when restoringQu Wenruo2018-10-31
| | | | | | | | | | | | | | | At restore time, btrfs-image will try to fixup dev extents, this will trigger a transaction. It's normally OK to start a new transaction, but for an image with log tree, a new transaction will increment generation, and log tree generation will not match super block generation + 1. There is no good way to solve it yet. Just output a warning for now. Signed-off-by: Qu Wenruo <wqu@suse.com> [ update error message ] Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: check: lowmem: Refactor extent type checks in check_file_extentNikolay Borisov2018-10-31
| | | | | | | | | | | | | Make the checks in check_file_extent a bit more explicit. First we check for unknown type and fail accordingly. Then we check for inline extent and handle it in the newly introduced check_file_extent_inline. Finally if none of the above checks triggered then we must have a regular or prealloc extents. Reviewed-by: Qu Wenruo <wqu@suse.com> Reviewed-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com> Signed-off-by: Nikolay Borisov <nborisov@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: check: lowmem: Refactor extent len test in check_file_extent_inlineNikolay Borisov2018-10-31
| | | | | | | | | | | | Instead of having another top-level if which checks for 'extent_num_bytes != item_inline_len' only if we are !compressed, just move the 'if' inside the 'else' branch of the first top-level if, since it has already checked for !compressed or not. No functional changes. Reviewed-by: Qu Wenruo <wqu@suse.com> Reviewed-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com> Signed-off-by: Nikolay Borisov <nborisov@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: check: lowmem: Factor out inline extent checking code in its ↵Nikolay Borisov2018-10-31
| | | | | | | | | | | | own function Since the inline extent code can be largely self-sufficient, factor it out from check_file_extent. No functional changes. Reviewed-by: Qu Wenruo <wqu@suse.com> Reviewed-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com> Signed-off-by: Nikolay Borisov <nborisov@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: consitfy keys passed to serch functionsSu Yanjun2018-10-25
| | | | | | | | | | | | | | | | When using gcc8 to compile btrfs-progs, it complains as below: ctree.c: In function 'btrfs_search_slot_for_read': ctree.c:1249:45: warning: passing argument 3 of 'btrfs_search_slot' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] ret = btrfs_search_slot(NULL, root, key, p, 0, 0); Change btrfs_search_slot prototype with 'const' qualifier for argument 3. Also fix similar problems as above change. Signed-off-by: Su Yanjun <suyj.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: Add the testcase for subvolume name length limit testSu Yanjun2018-10-25
| | | | | | | | | | | Total of three conditions are tested. One for short name, one with name length 255, the last one with more than 255. This case should pass after commit 'btrfs-progs: change filename limit to 255 when creating subvolume'. Signed-off-by: Su Yanjun <suyj.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: change filename limit to 255 when creating subvolumeSu Yanjun2018-10-25
| | | | | | | | | | Modify the file name length limit to meet the Linux naming convention. In addition, the file name length is always bigger than 0, no need to compare with 0 again. Issue: #145 Signed-off-by: Su Yanjun <suyj.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: convert: Output meaningful error messages for create_imageQu Wenruo2018-10-25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When convert failed, the error messsage would look like: create btrfs filesystem: blocksize: 4096 nodesize: 16384 features: extref, skinny-metadata (default) creating ext2 image file ERROR: failed to create ext2_saved/image: -1 WARNING: an error occurred during conversion, filesystem is partially created but not finalized and not mountable We can only know something wrong happened during "ext2_saved/image" file creation, but unable to know what exactly went wrong. This patch will add the following error messages for create_image() and its callee: 1) Sanity test error 2) Csum calculation error 3) Free ino number allocation error 4) Inode creation error 5) Inode mode change error 6) Inode link error With all these error messages, we should be pretty easy to locate the error without extra debugging. Reported-by: Serhat Sevki Dincer <jfcgauss@gmail.com> Reviewed-by: Nikolay Borisov <nborisov@suse.com> Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: convert: Make read_disk_extent return more -EIO instead of -1Qu Wenruo2018-10-25
| | | | | | | | | | | When pread64() returns value smaller than expected, it normally means EIO, so just return -EIO to replace the intermediate number. So when IO fails, we should be able to get more meaningful error number of than EPERM. Reviewed-by: Nikolay Borisov <nborisov@suse.com> Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: Eliminate remaining uses of strerror(errno)Rosen Penev2018-10-25
| | | | | | | %m allows a smaller filesize. Useful on embedded systems. Signed-off-by: Rosen Penev <rosenp@gmail.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: add runtime check for free-space-treeDavid Sterba2018-10-25
| | | | | | | The CI hosts have old kernel that does not support the FST, make the test fail gracefully. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: Test for FST corruption detection/repairNikolay Borisov2018-10-25
| | | | | | | | Simple test case which preps a filesystem, then corrupts the FST and finally repairs it. Tests both extent based and bitmap based FSTs. Signed-off-by: Nikolay Borisov <nborisov@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: check: Add support for freespace tree fixingNikolay Borisov2018-10-25
| | | | | | | | | | | | | Now that all the prerequisite code for proper support of free space tree repair is in, it's time to wire it in. This is achieved by first hooking the freespace tree to the __free_extent/alloc_reserved_tree_block functions. And then introducing a wrapper function to contains the existing check_space_cache and the newly introduced repair code. Finally, it's important to note that FST repair code first clears the existing FST in case of any problem found and rebuilds it from scratch. Signed-off-by: Nikolay Borisov <nborisov@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: Add freespace tree as compat_ro supported featureNikolay Borisov2018-10-25
| | | | | | | | | The RO_FREE_SPACE_TREE(_VALID) flags are required in order to be able to open an FST filesystem in repair mode. Add them to BTRFS_FEATURE_COMPAT_RO_SUPP. Signed-off-by: Nikolay Borisov <nborisov@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>