summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAge
* btrfs-progs: inspect: Fix out of bounds string termination.Patrik Lundquist2015-06-26
| | | | | Signed-off-by: Patrik Lundquist <patrik.lundquist@gmail.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: doc: update defrag pageDavid Sterba2015-06-26
| | | | | | | - update wording for -t - add optional argument to -c Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: defrag, check target extent earlierDavid Sterba2015-06-25
| | | | | | Print a warning if the target extent size (option -t) is larger than 4G. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: fix defrag threshold overflowPatrik Lundquist2015-06-25
| | | | | | | | btrfs fi defrag -t 1T overflows the u32 thresh variable and default, instead of max, threshold is used. Signed-off-by: Patrik Lundquist <patrik.lundquist@gmail.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: doc: mkfs.btrfs: document -O^Adam Borowski2015-06-25
| | | | | Signed-off-by: Adam Borowski <kilobyte@angband.pl> Signed-off-by: David Sterba <dsterba@suse.cz>
* Btrfs progs v4.1David Sterba2015-06-22
| | | | Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: docs: new size options for fi showQu Wenruo2015-06-22
| | | | | Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: Allow "filesystem show" command to handle different unitsQu Wenruo2015-06-22
| | | | | | | | | | Now "filesystem show" command can handle different units now. This is handy for higher level programs to get accurate output from "fi show" command. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: INSTALL: fix typosDavid Sterba2015-06-22
| | | | Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: configure: fix typo in summaryDavid Sterba2015-06-22
| | | | Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: btrfstune: print correct current uuid during rewriteDavid Sterba2015-06-18
| | | | | | | | uuid_unparse is supposed to take the ASCII representation of a UUID, so we have to pass the raw fsid buffer. Reported-by: Mike Fleetwood <mike.fleetwood@googlemail.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: btrfstune: print lowercase uuid during uuid rewriteDavid Sterba2015-06-18
| | | | | | | We're using lowercase everywhere else. Reported-by: Mike Fleetwood <mike.fleetwood@googlemail.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: tests: verify btrfstune output during uuid-rewriteDavid Sterba2015-06-18
| | | | | | | The 'Current fsid:' value does not match the real fsid. Reported-by: Mike Fleetwood <mike.fleetwood@googlemail.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: map-logical: Rework map-logical logicsQu Wenruo2015-06-17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | [BUG] The original map-logical has the following problems: 1) Assert if we pass any tree root bytenr. The problem is easy to trigger, here the number 29622272 is the bytenr of tree root: # btrfs-map-logical -l 29622272 /dev/sda6 mirror 1 logical 29622272 physical 38010880 device /dev/sda6 mirror 2 logical 29622272 physical 1111752704 device /dev/sda6 extent_io.c:582: free_extent_buffer: Assertion `eb->refs < 0` failed. btrfs-map-logical[0x41c464] btrfs-map-logical(free_extent_buffer+0xc0)[0x41cf10] btrfs-map-logical(btrfs_release_all_roots+0x59)[0x40e649] btrfs-map-logical(close_ctree+0x1aa)[0x40f51a] btrfs-map-logical(main+0x387)[0x4077c7] /usr/lib/libc.so.6(__libc_start_main+0xf0)[0x7f80a5562790] btrfs-map-logical(_start+0x29)[0x4078f9] The problem is that, btrfs-map-logical always use sectorsize as default block size to call alloc_extent_buffer. And when it failes to find the block with the same size, it will free the extent buffer in a incorrect method(Free and create a new one with refs == 1). 2) Will return map result for non-exist extent. # btrfs-map-logical -l 1 -b 123456 /dev/sda6 mirror 1 logical 1 physical 1 device /dev/sda6 mirror 1 logical 4097 physical 4097 device /dev/sda6 mirror 1 logical 8193 physical 8193 device /dev/sda6 ... Normally, before bytenr 12582912, there should be no extent as that's the mkfs time temp metadata/system chunk. But map-logical will still map them out. Not to mention the 1 offset among all results. [FIX] This patch will rework the whole map logical by the following methods: 1) Always do things inside a extent Even under the following case, map logical will only return covered range in existing extents. |<------ range given ------->| |<-Extent A->| |<-Extent B->| |<---Extent C->| Result: |<-->| |<---------->| |<-->| So with this patch, we will search extent tree to ensure all operation are inside a extent before we do some stupid things. 2) No direct call on alloc_extent_buffer function. That low-level function shouldn't be called at such high level. It's only designed for low-level tree operation. So in this patch we will only use safe high level functions avoid such problem. [RESULT] With this patch, no assert will be triggered and better handle on non-exist extents. # btrfs-map-logical -l 29622272 /dev/sda6 mirror 1 logical 29622272 physical 38010880 device /dev/sda6 mirror 2 logical 29622272 physical 1111752704 device /dev/sda6 # btrfs-map-logical -l 1 -b 123456 /dev/sda6 No extent found at range [1,123457) Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* Btrfs-progs: map-logical: introduce write_extent_content functionQu Wenruo2015-06-17
| | | | | | | This function will write extent content info desired file. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* Btrfs-progs: map-logical: introduce print_mapping_info functionQu Wenruo2015-06-17
| | | | | | | | | | | The new function will print the mapping info of given range [logical, logical+len). Note, caller must ensure the ranges are completely inside an extent. Or btrfs_map_block can return -ENOENT. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: map-logical: introduce map_one_extent functionQu Wenruo2015-06-17
| | | | | | | | Introduce the function to get accurate extent length based on extent tree search. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: export read_extent_data functionQu Wenruo2015-06-17
| | | | | | | Export it for later btrfs-map-logical cleanup. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* Btrfs progs v4.1-rc1David Sterba2015-06-17
| | | | Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: Makefile: fix typo, dependencies for cmds-* filesDavid Sterba2015-06-16
| | | | | | | The dependency generation skipped all cmds-*.c files due to a typo in variable name, since day one. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: send utils: deprecate path_cat and path_cat3David Sterba2015-06-16
| | | | | | The functios do no allocation error handling, use _out variants instead. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: receive: use static buffer for cur_subvol pathDavid Sterba2015-06-16
| | | | | | | | The embedded 'path' is a pointera and we can't make it a path buffer due to API constraints. Use a separate buffer and sto using the unsafe path_cat interface. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: send utils: switch callbacks to patch_cat3_outDavid Sterba2015-06-16
| | | | | | | Also switch full_subvol_path to a static buffer as the interface semantics change. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: receive: use static buffer for write_pathDavid Sterba2015-06-16
| | | | Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: receive: use static buffer for root_subvol_pathDavid Sterba2015-06-16
| | | | Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: unify naming of key types in print-treeDavid Sterba2015-06-16
| | | | | | Drop the BTRFS_ prefix and _KEY suffix where applicable. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: send utils: switch callbacks to new helpersDavid Sterba2015-06-16
| | | | | | | Use a local buffer for full path(s) and avoid dynamic allocations that happend to be unchecked. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: and new path_cat helpers to send utilsDavid Sterba2015-06-15
| | | | | | | Add versions of path_cat and path_cat3 that do not allocate the memory. The unhandled memory allocations are still there. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: send: use static buffer for output file nameDavid Sterba2015-06-15
| | | | Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: receive: use static buffer for source fileDavid Sterba2015-06-15
| | | | | | We should copy the optarg anyway. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: receive: use static buffer for mount point option argumentDavid Sterba2015-06-15
| | | | Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: add helper for copying pathsDavid Sterba2015-06-12
| | | | | | Check the source path length and do the copy. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: receive: use static buffer for cur_subvolDavid Sterba2015-06-12
| | | | | | | Get rid of the allocation. The logic is changed so that a NULL cur_subvol::path means that no subvolume/snapshot has been found so far. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: properly set up ioctl argumentsDavid Sterba2015-06-12
| | | | | | | | At some places we do not clear the whole ioctl structure and could pass garbage to kernel. Zero the ioctl vol_args and use a helper for copying the path. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: use PATH_MAX instead of BTRFS_PATH_NAME_MAXDavid Sterba2015-06-12
| | | | | | | | | | The path bufferes should be PATH_MAX but BTRFS_PATH_NAME_MAX is shorter due to embedding in 4k aligned structures. The only reason to use BTRFS_PATH_NAME_MAX is for the respective structures btrfs_ioctl_vol_args::name. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: send: add option to for the no-data modeDavid Sterba2015-06-12
| | | | Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: receive: implement the update_extent callbackDavid Sterba2015-06-12
| | | | | | | The callback for the NO_FILE_DATA send flag is missing and would crash if such stream is received. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: make receive work inside of subvolumesJosef Bacik2015-06-12
| | | | | | | | | | | | | Kind of a big feature of btrfs is being able to have a default subvol. However the receive code generates the paths to the subvols from the root of the fs, even in the case of a default subvol. So instead figure out if we're inside of a subvol, either because we have a different default or we've chroot'ed and are using -m. Then strip this extra path off of the subvol we find so we can look up our parent properly. Thanks Reported-by: Neil Horman <nhorman@redhat.com> Signed-off-by: Josef Bacik <jbacik@fb.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: use less memory for pretty_size_mode buffersDavid Sterba2015-06-11
| | | | | | | | | | | | | | | | | | Anand reports that the static buffers used for pertty size strings cause a stack overflow on SPARC. Zach proposed to change the printf format to wrap the number and the suffix into a macro. This would require to change all callsites of pretty_size* and is not very convienient to write. This patch replaces the per-call-site static buffers with a limited number for slots that would be used on each invokation of pretty_size and wrap around. The number of array slots shall be 10 for now, in current codebase there are no more than 2 calls to pretty_size in a single argument list. Reported-by: Anand Jain <Anand.Jain@oracle.com> CC: Zach Brown <zab@zabbo.net> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: print error within test_num_disk_vs_raidDavid Sterba2015-06-11
| | | | | | | | The error string buffer passed as an argument is of a fixed size, though we could print up to PATH_MAX + something bytes. Print the error message directly. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: print error within test_dev_for_mkfsDavid Sterba2015-06-11
| | | | | | | | The error string buffer passed as an argument is of a fixed size, though we could print up to PATH_MAX + something bytes. Print the error message directly. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: accept --help as option in the standalone utilitiesDavid Sterba2015-06-11
| | | | Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: add missing includes to header filesDavid Sterba2015-06-10
| | | | | | | Add includes that let the header files compile or add explicit include of kerncompat if the uXX types are used. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: add helper to wait for subvolume cleaningDavid Sterba2015-06-09
| | | | Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: subvol: let sync check only current deletionsDavid Sterba2015-06-09
| | | | | | | | | | | | | | | | | | | | So far the subvol sync command takes a shortcut and looks if there are any deleted subvols at all. It does not print the deleted subvolumes as they get cleaned. Arguably this is what the user would like to see and has to do $ btrfs subvol sync /path $(btrfs subvol list -d /path | "extract the ids") to see the progress. Make it look for all currently deleted subvolumes automatically and print the progress as if the ids were listed manually. This is a slight change in the semantics of the command. Previously, any new subvol deletion would prevent subvol sync to return. To simulate the old behaviour, run 'subvol sync' in a loop until it returns 0. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: cleanup after errors in open_file_or_dir3David Sterba2015-06-09
| | | | | | | | We should zero the dirstream in case we close it ourselves, so the caller does not do it again. Most current callers do not do that and exit immediatelly. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: receive: fix minor resource leakDavid Sterba2015-06-09
| | | | | Resolves-coverity-id: 1302985 Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: print compact help for btrfsDavid Sterba2015-06-09
| | | | | | | | Running 'btrfs' without arguments will print complete help that spans a lot of lines and is really helpful. Print only subcommand group names with short descriptions, similar to what 'git' does. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: add command group info stringsDavid Sterba2015-06-09
| | | | | | They're printed in the 'btrfs' command group summary. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: fix argv0_buf handlingDavid Sterba2015-06-09
| | | | | | | | | | | | | | | | The variable argv0_buf was duplicated and the changes done in utils.c were not propagated to help.c. So if an unknown commandline token was found, the error message did not contain the known part: $ btrfs scrub test : unknown token 'test' instead of $ btrfs scrub test btrfs scrub: uknown token 'test' Signed-off-by: David Sterba <dsterba@suse.cz>