Commit Graph

3236 Commits (4e2275bd27bb20cdd9bb43f65e8f770c891f5280)
 

Author SHA1 Message Date
David Sterba 84d1f29d47 btrfs-progs: send: check for output file existence before creating
In some cases the root might not be able to create the output file (and
streaming to stdout is not an option). Make the output file creation two
step and let it work if the file is already created.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-11 16:23:29 +01:00
Tsutomu Itoh 7d405df0da btrfs-progs: send: fix handling of -c option
When two or more -c options are specified, cannot find a suitable
parent. So, output stream is bigger than correct one.

[before]
At subvol Snap1
At subvol Snap2
At subvol ../SnapY
-rw------- 1 root root 3153 Oct 19 10:37 /tmp/data1

[after]
At subvol Snap1
At subvol Snap2
At subvol ../SnapY
-rw------- 1 root root 1492 Oct 19 10:39 /tmp/data1

Signed-off-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com>
[ constify subvol argument, renamed single letter variables ]
Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-11 16:23:29 +01:00
David Sterba 45827710e2 btrfs-progs: tests: teach extract_image about packed streams
Packed streams for testing purposes should be packed with 'xz -9' and
use suffix .stream.xz .

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-11 16:23:29 +01:00
David Sterba c29fea4344 btrfs-progs: use correct type for device id iteration in get_fs_info
Coverity reports (CID 1374096) that there's return value overflow of
ret from get_device_info, but this most likely cannot happen. There's
another minor issue where we use int to iterate over devids.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:35 +01:00
David Sterba 92847b5cd6 btrfs-progs: crc32: use fallback implementation for unaligned buffers
ASAN reports that at some point the crc function gets an unaligned
buffer. It's the optimized intel version that casts char to ulong, the
buffer is the embedded filename in the directory items.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:35 +01:00
David Sterba 0bd0d9c062 btrfs-progs: tests: teach scan-results about more errors
ASAN detects use after free.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:35 +01:00
David Sterba 3934ba255d btrfs-progs: fix search tree v2 ioctl detection
The result of the test applies per-filesystem, so we can't simply cache
it. The function hasn't been used yet.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:35 +01:00
David Sterba 92576929fb btrfs-progs: fix unaligned u64 access in btrfs_alloc_data_chunk
The key.offset member is not well-aligned as the key is packed, use a
temporary variable to pass the argument. Reported by ASAN in misc test
002.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:34 +01:00
David Sterba 9e0dd182b4 btrfs-progs: docs: update mkfs help string and manual page
Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:34 +01:00
David Sterba d75ea3ca87 btrfs-progs: mkfs: simplify checks in directory_select
Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:34 +01:00
David Sterba 8c4e5fbe89 btrfs-progs: btrfstune: use on-stack path buffer in change_devices_uuid
We don't need to conserve stack space too much unlike kernel, also
remove one error condition.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:34 +01:00
David Sterba ac2a089560 btrfs-progs: btrfstune: use on-stack path buffer in change_extents_uuid
We don't need to conserve stack space too much unlike kernel, also
remove one error condition.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:34 +01:00
David Sterba a75e84a819 btrfs-progs: chunk-recover: use on-stack path buffer in rebuild_block_group
We don't need to conserve stack space too much unlike kernel, also
remove one error condition.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:34 +01:00
David Sterba e680b4e5ad btrfs-progs: check: remove unused variable in record_extent
In a similar code, it's used for a message. Not used in this code since
the beggingin, safe to remove.

Resolves-coverity-id: 1364085
Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:34 +01:00
David Sterba d1ec1fe602 btrfs-progs: restore: use on-stack path buffer in find_first_dir
We don't need to conserve stack space too much unlike kernel, also
remove one error condition.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:34 +01:00
David Sterba 6dfe365b4b btrfs-progs: restore: use on-stack path buffer in do_list_roots
We don't need to conserve stack space too much unlike kernel, also
remove one error condition.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:33 +01:00
David Sterba 61b72497bb btrfs-progs: restore: use on-stack path buffer in search_dir
We don't need to conserve stack space too much unlike kernel, also
remove one error condition.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:33 +01:00
David Sterba 69b7e72345 btrfs-progs: restore: use on-stack path buffer in copy_symlink
We don't need to conserve stack space too much unlike kernel, also
remove one error condition.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:33 +01:00
David Sterba 047f343721 btrfs-progs: restore: use on-stack path buffer in copy_file
We don't need to conserve stack space too much unlike kernel, also
remove one error condition.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:33 +01:00
David Sterba 51e564543b btrfs-progs: restore: use on-stack path buffer in copy_metadata
We don't need to conserve stack space too much unlike kernel, also
remove one error condition.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:33 +01:00
David Sterba e79daa7a82 btrfs-progs: restore: use on-stack path buffer in set_file_xattrs
We don't need to conserve stack space too much unlike kernel, also
remove one error condition.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:33 +01:00
David Sterba 951e6276e6 btrfs-progs: tree-stats: use on-stack path buffer in calc_root_size
We don't need to conserve stack space too much unlike kernel, also
remove one error condition.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:33 +01:00
David Sterba 9733b4b926 btrfs-progs: check: use on-stack path buffer in repair_root_items
We don't need to conserve stack space too much unlike kernel, also
remove one error condition.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:33 +01:00
David Sterba 5ec9951e7d btrfs-progs: check: use on-stack path buffer in build_roots_info_cache
We don't need to conserve stack space too much unlike kernel, also
remove one error condition.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:33 +01:00
David Sterba 1b42d77eb6 btrfs-progs: check: use on-stack path buffer in fill_csum_tree_from_extent
We don't need to conserve stack space too much unlike kernel, also
remove one error condition.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:33 +01:00
David Sterba 02ca1e8a0f btrfs-progs: check: use on-stack path buffer in fill_csum_tree_from_fs
We don't need to conserve stack space too much unlike kernel, also
remove one error condition.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:33 +01:00
David Sterba c050db55e2 btrfs-progs: check: use on-stack path buffer in fill_csum_tree_from_one_fs_root
We don't need to conserve stack space too much unlike kernel, also
remove one error condition.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:33 +01:00
David Sterba 5cbedb02e1 btrfs-progs: check: use on-stack path buffer in delete_bad_item
We don't need to conserve stack space too much unlike kernel, also
remove one error condition.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:33 +01:00
David Sterba 29bfb8318b btrfs-progs: check: use on-stack path buffer in recow_extent_buffer
We don't need to conserve stack space too much unlike kernel, also
remove one error condition.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:32 +01:00
David Sterba d0c3fa4d5b btrfs-progs: check: use on-stack path buffer in reset_balance
We don't need to conserve stack space too much unlike kernel, also
remove one error condition.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:32 +01:00
David Sterba 54db6df0e8 btrfs-progs: check: use on-stack path buffer in reset_block_groups
We don't need to conserve stack space too much unlike kernel, also
remove one error condition.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:32 +01:00
David Sterba 848e7f01ad btrfs-progs: check: use on-stack path buffer in fixup_extent_flags
We don't need to conserve stack space too much unlike kernel, also
remove one error condition.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:32 +01:00
David Sterba 1e1bb046e5 btrfs-progs: check: use on-stack path buffer in fixup_extent_refs
We don't need to conserve stack space too much unlike kernel, also
remove one error condition.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:32 +01:00
David Sterba 1f7f342b26 btrfs-progs: check: use on-stack path buffer in record_orphan_data_extents
We don't need to conserve stack space too much unlike kernel, also
remove one error condition.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:32 +01:00
David Sterba f2f7da66c5 btrfs-progs: check: use on-stack path buffer in delete_duplicate_records
We don't need to conserve stack space too much unlike kernel, also
remove one error condition.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:32 +01:00
David Sterba 919f914483 btrfs-progs: check: use on-stack path buffer in check_extent_exists
We don't need to conserve stack space too much unlike kernel, also
remove one error condition.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:32 +01:00
David Sterba bd4376a987 btrfs-progs: check: use on-stack path buffer in check_extent_csums
We don't need to conserve stack space too much unlike kernel, also
remove one error condition.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:32 +01:00
David Sterba e036805d29 btrfs-progs: check: use on-stack path buffer in verify_space_cache
We don't need to conserve stack space too much unlike kernel, also
remove one error condition.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:32 +01:00
David Sterba a88c8f17cb btrfs-progs: check: use on-stack path buffer in try_to_fix_bad_block
We don't need to conserve stack space too much unlike kernel, also
remove one error condition.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:32 +01:00
David Sterba 4cf9b7e2a1 btrfs-progs: check: use on-stack path buffer in repair_btree
We don't need to conserve stack space too much unlike kernel, also
remove one error condition.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:32 +01:00
David Sterba 3640b6a6ef btrfs-progs: check: use on-stack path buffer in try_repair_inode
We don't need to conserve stack space too much unlike kernel, also
remove one error condition.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:32 +01:00
David Sterba f24d4d6847 btrfs-progs: check: use on-stack path buffer in find_normal_file_extent
We don't need to conserve stack space too much unlike kernel, also
remove one error condition.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:32 +01:00
David Sterba 7e47022599 btrfs-progs: check: use on-stack path buffer in delete_dir_index
We don't need to conserve stack space too much unlike kernel, also
remove one error condition.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:32 +01:00
David Sterba f26af74da4 btrfs-progs: check: use on-stack path buffer in add_missing_dir_index
We don't need to conserve stack space too much unlike kernel, also
remove one error condition.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:32 +01:00
David Sterba 5b3c976bc2 btrfs-progs: convert bitfield to separate variables in btrfs_path
We don't have that many bitfields that would save space.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:32 +01:00
David Sterba 64e9dbf550 btrfs-progs: qgroup: use on-stack path buffer in repair_qgroup_status
We don't need to conserve stack space too much unlike kernel, also
remove one error condition.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:32 +01:00
David Sterba b059f926b8 btrfs-progs: qgroup: use on-stack path buffer in repair_qgroup_info
We don't need to conserve stack space too much unlike kernel, also
remove one error condition.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:32 +01:00
David Sterba c6a0cb7d6d btrfs-progs: utils: remove useless check in make_btrfs
A leftover when fs_uuid was dynamically allocated, the condition was
always true, no functional change.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:32 +01:00
David Sterba 1b1a49b1e6 btrfs-progs: fi du: don't redefine standard macro/function
The macro dprintf is defined in stdio.h, rename it.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:31 +01:00
David Sterba 5103e80b21 btrfs-progs: dump-tree: use new names for obsoleted keys
The DEV_STATS and BALANCE_ITEM have been deprecated in favor of more
general items, print the new names in the dump.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:31 +01:00