platform/upstream/btrfs-progs.git
7 years agobtrfs-progs: restore: use on-stack path buffer in find_first_dir
David Sterba [Wed, 2 Nov 2016 23:37:51 +0000 (00:37 +0100)]
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>
7 years agobtrfs-progs: restore: use on-stack path buffer in do_list_roots
David Sterba [Wed, 2 Nov 2016 23:37:51 +0000 (00:37 +0100)]
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>
7 years agobtrfs-progs: restore: use on-stack path buffer in search_dir
David Sterba [Wed, 2 Nov 2016 23:37:51 +0000 (00:37 +0100)]
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>
7 years agobtrfs-progs: restore: use on-stack path buffer in copy_symlink
David Sterba [Wed, 2 Nov 2016 23:37:51 +0000 (00:37 +0100)]
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>
7 years agobtrfs-progs: restore: use on-stack path buffer in copy_file
David Sterba [Wed, 2 Nov 2016 23:37:51 +0000 (00:37 +0100)]
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>
7 years agobtrfs-progs: restore: use on-stack path buffer in copy_metadata
David Sterba [Wed, 2 Nov 2016 23:37:51 +0000 (00:37 +0100)]
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>
7 years agobtrfs-progs: restore: use on-stack path buffer in set_file_xattrs
David Sterba [Wed, 2 Nov 2016 23:37:51 +0000 (00:37 +0100)]
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>
7 years agobtrfs-progs: tree-stats: use on-stack path buffer in calc_root_size
David Sterba [Wed, 2 Nov 2016 23:37:51 +0000 (00:37 +0100)]
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>
7 years agobtrfs-progs: check: use on-stack path buffer in repair_root_items
David Sterba [Wed, 2 Nov 2016 23:37:51 +0000 (00:37 +0100)]
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>
7 years agobtrfs-progs: check: use on-stack path buffer in build_roots_info_cache
David Sterba [Wed, 2 Nov 2016 23:37:51 +0000 (00:37 +0100)]
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>
7 years agobtrfs-progs: check: use on-stack path buffer in fill_csum_tree_from_extent
David Sterba [Wed, 2 Nov 2016 23:37:51 +0000 (00:37 +0100)]
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>
7 years agobtrfs-progs: check: use on-stack path buffer in fill_csum_tree_from_fs
David Sterba [Wed, 2 Nov 2016 23:37:51 +0000 (00:37 +0100)]
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>
7 years agobtrfs-progs: check: use on-stack path buffer in fill_csum_tree_from_one_fs_root
David Sterba [Wed, 2 Nov 2016 23:37:51 +0000 (00:37 +0100)]
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>
7 years agobtrfs-progs: check: use on-stack path buffer in delete_bad_item
David Sterba [Wed, 2 Nov 2016 23:37:51 +0000 (00:37 +0100)]
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>
7 years agobtrfs-progs: check: use on-stack path buffer in recow_extent_buffer
David Sterba [Wed, 2 Nov 2016 23:37:51 +0000 (00:37 +0100)]
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>
7 years agobtrfs-progs: check: use on-stack path buffer in reset_balance
David Sterba [Wed, 2 Nov 2016 23:37:51 +0000 (00:37 +0100)]
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>
7 years agobtrfs-progs: check: use on-stack path buffer in reset_block_groups
David Sterba [Wed, 2 Nov 2016 23:37:51 +0000 (00:37 +0100)]
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>
7 years agobtrfs-progs: check: use on-stack path buffer in fixup_extent_flags
David Sterba [Wed, 2 Nov 2016 23:37:51 +0000 (00:37 +0100)]
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>
7 years agobtrfs-progs: check: use on-stack path buffer in fixup_extent_refs
David Sterba [Wed, 2 Nov 2016 23:37:51 +0000 (00:37 +0100)]
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>
7 years agobtrfs-progs: check: use on-stack path buffer in record_orphan_data_extents
David Sterba [Wed, 2 Nov 2016 23:37:51 +0000 (00:37 +0100)]
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>
7 years agobtrfs-progs: check: use on-stack path buffer in delete_duplicate_records
David Sterba [Wed, 2 Nov 2016 23:37:51 +0000 (00:37 +0100)]
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>
7 years agobtrfs-progs: check: use on-stack path buffer in check_extent_exists
David Sterba [Wed, 2 Nov 2016 23:37:51 +0000 (00:37 +0100)]
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>
7 years agobtrfs-progs: check: use on-stack path buffer in check_extent_csums
David Sterba [Wed, 2 Nov 2016 23:37:51 +0000 (00:37 +0100)]
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>
7 years agobtrfs-progs: check: use on-stack path buffer in verify_space_cache
David Sterba [Wed, 2 Nov 2016 23:37:51 +0000 (00:37 +0100)]
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>
7 years agobtrfs-progs: check: use on-stack path buffer in try_to_fix_bad_block
David Sterba [Wed, 2 Nov 2016 23:37:51 +0000 (00:37 +0100)]
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>
7 years agobtrfs-progs: check: use on-stack path buffer in repair_btree
David Sterba [Wed, 2 Nov 2016 23:37:51 +0000 (00:37 +0100)]
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>
7 years agobtrfs-progs: check: use on-stack path buffer in try_repair_inode
David Sterba [Wed, 2 Nov 2016 23:37:51 +0000 (00:37 +0100)]
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>
7 years agobtrfs-progs: check: use on-stack path buffer in find_normal_file_extent
David Sterba [Wed, 2 Nov 2016 23:37:51 +0000 (00:37 +0100)]
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>
7 years agobtrfs-progs: check: use on-stack path buffer in delete_dir_index
David Sterba [Wed, 2 Nov 2016 23:37:51 +0000 (00:37 +0100)]
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>
7 years agobtrfs-progs: check: use on-stack path buffer in add_missing_dir_index
David Sterba [Wed, 2 Nov 2016 23:37:51 +0000 (00:37 +0100)]
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>
7 years agobtrfs-progs: convert bitfield to separate variables in btrfs_path
David Sterba [Thu, 3 Nov 2016 16:09:16 +0000 (17:09 +0100)]
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>
7 years agobtrfs-progs: qgroup: use on-stack path buffer in repair_qgroup_status
David Sterba [Wed, 2 Nov 2016 23:37:51 +0000 (00:37 +0100)]
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>
7 years agobtrfs-progs: qgroup: use on-stack path buffer in repair_qgroup_info
David Sterba [Wed, 2 Nov 2016 23:37:51 +0000 (00:37 +0100)]
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>
7 years agobtrfs-progs: utils: remove useless check in make_btrfs
David Sterba [Thu, 3 Nov 2016 15:27:04 +0000 (16:27 +0100)]
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>
7 years agobtrfs-progs: fi du: don't redefine standard macro/function
David Sterba [Thu, 3 Nov 2016 15:24:05 +0000 (16:24 +0100)]
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>
7 years agobtrfs-progs: dump-tree: use new names for obsoleted keys
David Sterba [Thu, 3 Nov 2016 12:21:19 +0000 (13:21 +0100)]
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>
7 years agobtrfs-progs: image: use embedded array for metadump cluster buffer
David Sterba [Thu, 3 Nov 2016 00:23:18 +0000 (01:23 +0100)]
btrfs-progs: image: use embedded array for metadump cluster buffer

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: image: use fixed-size array for worker thread pointers
David Sterba [Wed, 2 Nov 2016 23:57:43 +0000 (00:57 +0100)]
btrfs-progs: image: use fixed-size array for worker thread pointers

No need to dynamically allocate the thread pointers.

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: image: add symbolic constant for max thread count
David Sterba [Wed, 2 Nov 2016 23:53:43 +0000 (00:53 +0100)]
btrfs-progs: image: add symbolic constant for max thread count

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: image: use on-stack path buffer in fixup_devices
David Sterba [Wed, 2 Nov 2016 23:37:51 +0000 (00:37 +0100)]
btrfs-progs: image: use on-stack path buffer in fixup_devices

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>
7 years agobtrfs-progs: image: use on-stack path buffer in create_metadump
David Sterba [Wed, 2 Nov 2016 23:37:51 +0000 (00:37 +0100)]
btrfs-progs: image: use on-stack path buffer in create_metadump

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>
7 years agobtrfs-progs: convert: use on-stack path buffer in link_subvol
David Sterba [Wed, 2 Nov 2016 23:37:51 +0000 (00:37 +0100)]
btrfs-progs: convert: use on-stack path buffer in link_subvol

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>
7 years agobtrfs-progs: convert: use on-stack path buffer in create_image
David Sterba [Wed, 2 Nov 2016 23:37:51 +0000 (00:37 +0100)]
btrfs-progs: convert: use on-stack path buffer in create_image

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>
7 years agobtrfs-progs: convert: use on-stack path buffer in record_file_blocks
David Sterba [Wed, 2 Nov 2016 23:37:51 +0000 (00:37 +0100)]
btrfs-progs: convert: use on-stack path buffer in record_file_blocks

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>
7 years agobtrfs-progs: mkfs: use on-stack path buffer in cleanup_temp_chunks
David Sterba [Wed, 2 Nov 2016 23:37:51 +0000 (00:37 +0100)]
btrfs-progs: mkfs: use on-stack path buffer in cleanup_temp_chunks

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>
7 years agobtrfs-progs: reduce size of btrfs_path::lowest_level
David Sterba [Thu, 3 Nov 2016 15:55:35 +0000 (16:55 +0100)]
btrfs-progs: reduce size of btrfs_path::lowest_level

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: reduce size of btrfs_path::reada
David Sterba [Thu, 3 Nov 2016 15:55:35 +0000 (16:55 +0100)]
btrfs-progs: reduce size of btrfs_path::reada

We use only a few values, reada accessed not in performance critical
contexts.

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: reduce size of btrfs_path, locks are not used
David Sterba [Thu, 3 Nov 2016 15:49:30 +0000 (16:49 +0100)]
btrfs-progs: reduce size of btrfs_path, locks are not used

Size of btrfs_path can be reduced by 32 bytes as we don't use the locks
array, down to 112 from 144 bytes.

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: mkfs: constify some char parameters
David Sterba [Wed, 2 Nov 2016 23:02:29 +0000 (00:02 +0100)]
btrfs-progs: mkfs: constify some char parameters

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: mkfs: use const char for unmodified members of directory_name_entry
David Sterba [Wed, 2 Nov 2016 23:01:51 +0000 (00:01 +0100)]
btrfs-progs: mkfs: use const char for unmodified members of directory_name_entry

We never modify the members, just point them to other strings.

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: check: reorder fields in inode_backref for better packing
David Sterba [Wed, 2 Nov 2016 15:50:47 +0000 (16:50 +0100)]
btrfs-progs: check: reorder fields in inode_backref for better packing

The structure size went from 56 bytes to 48, which could save some bytes
in larger scale.

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: check: unify type for inode_backref::itemtype
David Sterba [Wed, 2 Nov 2016 15:37:09 +0000 (16:37 +0100)]
btrfs-progs: check: unify type for inode_backref::itemtype

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: check: unify type for inode_backref::filetype
David Sterba [Wed, 2 Nov 2016 15:37:09 +0000 (16:37 +0100)]
btrfs-progs: check: unify type for inode_backref::filetype

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: send: cleanup use of ctransid delta temporary variable in find_good_parent
David Sterba [Wed, 2 Nov 2016 13:59:07 +0000 (14:59 +0100)]
btrfs-progs: send: cleanup use of ctransid delta temporary variable in find_good_parent

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: send: cleanup, rename send context variables
David Sterba [Wed, 2 Nov 2016 13:14:56 +0000 (14:14 +0100)]
btrfs-progs: send: cleanup, rename send context variables

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: send: cleanup, rename some variables in dump_thread
David Sterba [Wed, 2 Nov 2016 13:07:53 +0000 (14:07 +0100)]
btrfs-progs: send: cleanup, rename some variables in dump_thread

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: send: clean types in write_buf
David Sterba [Wed, 2 Nov 2016 13:04:06 +0000 (14:04 +0100)]
btrfs-progs: send: clean types in write_buf

Use matching types for buffer, return value and buffer sizes.

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: send: use proper type for read result, and rename the variable
David Sterba [Wed, 2 Nov 2016 13:00:07 +0000 (14:00 +0100)]
btrfs-progs: send: use proper type for read result, and rename the variable

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: send: increase size of transfer buffer
David Sterba [Wed, 2 Nov 2016 12:27:45 +0000 (13:27 +0100)]
btrfs-progs: send: increase size of transfer buffer

4K is quite small, increase it to 64K. This reduces number of
context switches and calls to read. Kernel sends us about 50K of data
per read, so increasing the buffer further does not make any
improvement.

Example run on tests/cli-tests/004-send-parent-multi-subvol:
4K:
  - ~800 context switches
  - ~5000 calls to read

64K:
  - ~450 context switches
  - ~500 calls to read

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: send: constify some arugments
David Sterba [Wed, 2 Nov 2016 12:17:31 +0000 (13:17 +0100)]
btrfs-progs: send: constify some arugments

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: tests: add test for multi-subvolume send from parent
David Sterba [Wed, 2 Nov 2016 12:07:15 +0000 (13:07 +0100)]
btrfs-progs: tests: add test for multi-subvolume send from parent

Fixed by "btrfs-progs: send: fix handling of multiple snapshots (-p
option)".

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: dump-tree: convert dir-item-to-string to table
David Sterba [Wed, 2 Nov 2016 10:16:12 +0000 (11:16 +0100)]
btrfs-progs: dump-tree: convert dir-item-to-string to table

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: dump-tree: convert key-to-string to table
David Sterba [Wed, 2 Nov 2016 10:16:12 +0000 (11:16 +0100)]
btrfs-progs: dump-tree: convert key-to-string to table

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: dump-tree: cleanup types for item number iteration
David Sterba [Wed, 2 Nov 2016 09:52:25 +0000 (10:52 +0100)]
btrfs-progs: dump-tree: cleanup types for item number iteration

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: dump-tree: move remaining item variables to the scope of use
David Sterba [Wed, 2 Nov 2016 09:50:40 +0000 (10:50 +0100)]
btrfs-progs: dump-tree: move remaining item variables to the scope of use

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: dump-tree: move variable declarations closer to their use
David Sterba [Wed, 2 Nov 2016 09:48:08 +0000 (10:48 +0100)]
btrfs-progs: dump-tree: move variable declarations closer to their use

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: dump-tree: rename extent buffer variable in btrfs_print_leaf
David Sterba [Wed, 2 Nov 2016 09:42:19 +0000 (10:42 +0100)]
btrfs-progs: dump-tree: rename extent buffer variable in btrfs_print_leaf

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: dump-tree: add untyped item ptr helper and use it
David Sterba [Wed, 2 Nov 2016 09:06:16 +0000 (10:06 +0100)]
btrfs-progs: dump-tree: add untyped item ptr helper and use it

There's lots of code that passes btrfs_item_ptr. Add a helper to extract
the ptr at the beginning, ignoring the type. The print functions take
the correct type, but we ignore it in the conversion macros as it does
not provide the type checking anyway.

If the typed variable is used more than once, it's kept in place.

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: dump-tree: constify char argument in print_root_ref
David Sterba [Wed, 2 Nov 2016 09:26:33 +0000 (10:26 +0100)]
btrfs-progs: dump-tree: constify char argument in print_root_ref

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: dump-tree: simplify and fix check for empty uuid
David Sterba [Wed, 2 Nov 2016 09:22:10 +0000 (10:22 +0100)]
btrfs-progs: dump-tree: simplify and fix check for empty uuid

Counting non-zero bytes is wasteful, besides that it would not recognize
uuids containing a 00 value.

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: dump-tree: return void from print_* functions
David Sterba [Wed, 2 Nov 2016 09:19:16 +0000 (10:19 +0100)]
btrfs-progs: dump-tree: return void from print_* functions

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: dump-tree: pass item size instead of item
David Sterba [Wed, 2 Nov 2016 09:15:32 +0000 (10:15 +0100)]
btrfs-progs: dump-tree: pass item size instead of item

Several functions take item but use just the size, we can factor the
item size and use that.

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: remove unused parameter from print_inode_item
David Sterba [Wed, 2 Nov 2016 09:08:55 +0000 (10:08 +0100)]
btrfs-progs: remove unused parameter from print_inode_item

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: dump-tree: consolidate data key names
David Sterba [Wed, 2 Nov 2016 08:54:31 +0000 (09:54 +0100)]
btrfs-progs: dump-tree: consolidate data key names

Rename to the structure members, add underscore so it's a single word.
Compression is also printed as raw value.

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: dump-tree: print dev stats
David Sterba [Wed, 2 Nov 2016 01:06:13 +0000 (02:06 +0100)]
btrfs-progs: dump-tree: print dev stats

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: add dev stats on-disk structure
David Sterba [Wed, 2 Nov 2016 01:10:52 +0000 (02:10 +0100)]
btrfs-progs: add dev stats on-disk structure

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: dump-tree: print balance status item
David Sterba [Tue, 1 Nov 2016 12:47:14 +0000 (13:47 +0100)]
btrfs-progs: dump-tree: print balance status item

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: add balance status structures
David Sterba [Tue, 1 Nov 2016 23:53:54 +0000 (00:53 +0100)]
btrfs-progs: add balance status structures

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: teach print_leaf about temporary item subtypes
David Sterba [Tue, 1 Nov 2016 12:39:44 +0000 (13:39 +0100)]
btrfs-progs: teach print_leaf about temporary item subtypes

[ kernel patch 9f07e1d76eaeeddedcf9651395b4a8f870df31f0 ]
Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: teach print_leaf about permanent item subtypes
David Sterba [Tue, 1 Nov 2016 12:36:58 +0000 (13:36 +0100)]
btrfs-progs: teach print_leaf about permanent item subtypes

[ kernel patch 585a3d0d238dfe42909cb58b0d05f644365fed14 ]
Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: switch dev stats item to the permanent item key
David Sterba [Tue, 1 Nov 2016 12:34:13 +0000 (13:34 +0100)]
btrfs-progs: switch dev stats item to the permanent item key

[ kernel patch 242e2956e4afde7727fffe21adc0a7b198b77f96 ]
Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: introduce key type for persistent permanent items
David Sterba [Tue, 1 Nov 2016 12:32:26 +0000 (13:32 +0100)]
btrfs-progs: introduce key type for persistent permanent items

The number of distinct key types is not that big that we could waste one
for something new we want to store in the tree.

Similar to the temporary items, we'll introduce a new name for an
existing key value and use the objectid for further extension.  The
victim is the BTRFS_DEV_STATS_KEY (248).

The device stats are an example of a permanent item.

[ kernel patch 50c2d5abe64c1726b48d292a2ab04f60e8238933 ]
Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: print-tree: extract offset from the item key
David Sterba [Tue, 1 Nov 2016 12:40:19 +0000 (13:40 +0100)]
btrfs-progs: print-tree: extract offset from the item key

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: introduce key type for persistent temporary items
David Sterba [Tue, 1 Nov 2016 12:29:25 +0000 (13:29 +0100)]
btrfs-progs: introduce key type for persistent temporary items

The number of distinct key types is not that big that we could waste one
for something new we want to store in the tree. We'll introduce a new
name for an existing key value and use the objectid for further
extension.  The victim is the BTRFS_BALANCE_ITEM_KEY (248).

The nature of the balance status item is a good example of the temporary
item. It exists from beginning of the balance, keeps the status until it
finishes.

[ kernel patch 0bbbccb17fea86818e1a058faf5903aefd20b31a ]
Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: mkfs: store creation time of the toplevel subvolume
David Sterba [Mon, 31 Oct 2016 16:06:15 +0000 (17:06 +0100)]
btrfs-progs: mkfs: store creation time of the toplevel subvolume

For unkonwn reasons, the creation time of the toplevel subvolume inode
item hasn't been set.

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: dump-tree: print missing data for file extent item
David Sterba [Mon, 31 Oct 2016 15:31:15 +0000 (16:31 +0100)]
btrfs-progs: dump-tree: print missing data for file extent item

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: dump-tree: print more root_item data
David Sterba [Mon, 31 Oct 2016 15:22:17 +0000 (16:22 +0100)]
btrfs-progs: dump-tree: print more root_item data

Print a few more missing items of root_item (there are still some
remaining). Drop key is printend unconditionally.

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: dump-tree: print missing dir_item data
David Sterba [Mon, 31 Oct 2016 13:25:03 +0000 (14:25 +0100)]
btrfs-progs: dump-tree: print missing dir_item data

Add items from dir_item that are not printed, plus other adjustments.

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: dump-tree: print missing inode_item data
David Sterba [Mon, 31 Oct 2016 13:25:03 +0000 (14:25 +0100)]
btrfs-progs: dump-tree: print missing inode_item data

Add items from inode_item that are not printed.

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: dump-tree: add helper to print timespec
David Sterba [Mon, 31 Oct 2016 15:00:53 +0000 (16:00 +0100)]
btrfs-progs: dump-tree: add helper to print timespec

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: dump-tree: factor inode_item dump to function
David Sterba [Mon, 31 Oct 2016 14:20:20 +0000 (15:20 +0100)]
btrfs-progs: dump-tree: factor inode_item dump to function

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: dump-tree: print missing dev_extent data
David Sterba [Mon, 31 Oct 2016 13:25:03 +0000 (14:25 +0100)]
btrfs-progs: dump-tree: print missing dev_extent data

Add items from chunk that are not printed, unify names according to
the member names and reorder a bit.

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: dump-tree: print missing chunk data
David Sterba [Mon, 31 Oct 2016 13:25:03 +0000 (14:25 +0100)]
btrfs-progs: dump-tree: print missing chunk data

Add items from chunk that are not printed, unify names according to
the member names and reorder a bit.

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: dump-tree: print missing dev_item data
David Sterba [Mon, 31 Oct 2016 13:25:03 +0000 (14:25 +0100)]
btrfs-progs: dump-tree: print missing dev_item data

Add items from dev_item that are not printed, unify names according to
the member names.

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: subvol show: print more details about toplevel subvolume
David Sterba [Mon, 31 Oct 2016 12:56:28 +0000 (13:56 +0100)]
btrfs-progs: subvol show: print more details about toplevel subvolume

The toplevel subvolume is special and the other listing code leaves it
out so we have to add several special cases to handle it. There's no
backreference so the path is built artificially. New helper
btrfs_get_toplevel_subvol is a reduced version of btrfs_get_subvol.

There's some information usually missing for the toplevel subvolume, eg.
the uuid or creation info. This has to be fixed on the mkfs side, the
other subvolumes are created by kernel.

Example:
/mnt
        Name:                   <FS_TREE>
        UUID:                   -
        Parent UUID:            -
        Received UUID:          -
        Creation time:          -
        Subvolume ID:           5
        Generation:             233
        Gen at creation:        0
        Parent ID:              0
        Top level ID:           0
        Flags:                  -
        Snapshot(s):
                                subv1

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: subvol list: better error message if subvol insertion fails
David Sterba [Mon, 31 Oct 2016 11:53:35 +0000 (12:53 +0100)]
btrfs-progs: subvol list: better error message if subvol insertion fails

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: subvol list: remove ugly goto construct
David Sterba [Mon, 31 Oct 2016 11:46:52 +0000 (12:46 +0100)]
btrfs-progs: subvol list: remove ugly goto construct

Jumping into an if is not considered nice.

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: remove trivial helper root_lookup_init
David Sterba [Mon, 31 Oct 2016 11:44:29 +0000 (12:44 +0100)]
btrfs-progs: remove trivial helper root_lookup_init

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: subvol list: consolidate uuid types accross functions
David Sterba [Mon, 31 Oct 2016 11:33:28 +0000 (12:33 +0100)]
btrfs-progs: subvol list: consolidate uuid types accross functions

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: subvol list: add simplified helper for adding root backrefs
David Sterba [Mon, 31 Oct 2016 11:27:08 +0000 (12:27 +0100)]
btrfs-progs: subvol list: add simplified helper for adding root backrefs

Signed-off-by: David Sterba <dsterba@suse.com>