Commit Graph

3193 Commits

Author SHA1 Message Date
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
David Sterba
a7d8850f9f btrfs-progs: image: use embedded array for metadump cluster buffer
Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:31 +01:00
David Sterba
acd2580777 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>
2016-11-09 13:47:31 +01:00
David Sterba
84f9e8cfe3 btrfs-progs: image: add symbolic constant for max thread count
Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:31 +01:00
David Sterba
9459a505d0 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>
2016-11-09 13:47:31 +01:00
David Sterba
14eba91330 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>
2016-11-09 13:47:31 +01:00
David Sterba
33f07b0d03 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>
2016-11-09 13:47:31 +01:00
David Sterba
c0807cbfc4 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>
2016-11-09 13:47:31 +01:00
David Sterba
aca69c9d39 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>
2016-11-09 13:47:31 +01:00
David Sterba
a34b3b9273 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>
2016-11-09 13:47:31 +01:00
David Sterba
5a0645afb8 btrfs-progs: reduce size of btrfs_path::lowest_level
Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:31 +01:00
David Sterba
f0f40c400e 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>
2016-11-09 13:47:31 +01:00
David Sterba
b81edabe79 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>
2016-11-09 13:47:31 +01:00
David Sterba
7456592977 btrfs-progs: mkfs: constify some char parameters
Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:31 +01:00
David Sterba
8ade920c5b 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>
2016-11-09 13:47:31 +01:00
David Sterba
87596654ae 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>
2016-11-09 13:47:31 +01:00
David Sterba
35985c1521 btrfs-progs: check: unify type for inode_backref::itemtype
Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:31 +01:00
David Sterba
b759702b67 btrfs-progs: check: unify type for inode_backref::filetype
Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:31 +01:00
David Sterba
17a8c6d7e1 btrfs-progs: send: cleanup use of ctransid delta temporary variable in find_good_parent
Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:31 +01:00
David Sterba
62fb1a5c14 btrfs-progs: send: cleanup, rename send context variables
Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:31 +01:00
David Sterba
a9f407b9a6 btrfs-progs: send: cleanup, rename some variables in dump_thread
Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:31 +01:00
David Sterba
f3a00c630a 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>
2016-11-09 13:47:31 +01:00
David Sterba
aec1d7fa8b btrfs-progs: send: use proper type for read result, and rename the variable
Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:31 +01:00
David Sterba
76fc07e3a6 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>
2016-11-09 13:47:31 +01:00
David Sterba
88edac358c btrfs-progs: send: constify some arugments
Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:30 +01:00
David Sterba
29a1a78aaa 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>
2016-11-09 13:47:30 +01:00
David Sterba
b9ff0190cf btrfs-progs: dump-tree: convert dir-item-to-string to table
Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:30 +01:00
David Sterba
e6410f631d btrfs-progs: dump-tree: convert key-to-string to table
Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:30 +01:00
David Sterba
69f879eac9 btrfs-progs: dump-tree: cleanup types for item number iteration
Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:30 +01:00
David Sterba
56917b41fb btrfs-progs: dump-tree: move remaining item variables to the scope of use
Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:30 +01:00
David Sterba
e58cc23823 btrfs-progs: dump-tree: move variable declarations closer to their use
Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:30 +01:00
David Sterba
6b138f5367 btrfs-progs: dump-tree: rename extent buffer variable in btrfs_print_leaf
Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:30 +01:00
David Sterba
7541b53b34 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>
2016-11-09 13:47:30 +01:00
David Sterba
17a9d9013d btrfs-progs: dump-tree: constify char argument in print_root_ref
Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:30 +01:00
David Sterba
a15294f0c4 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>
2016-11-09 13:47:30 +01:00
David Sterba
5082ec84a8 btrfs-progs: dump-tree: return void from print_* functions
Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:30 +01:00
David Sterba
e9c1121495 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>
2016-11-09 13:47:30 +01:00
David Sterba
ae00d4a251 btrfs-progs: remove unused parameter from print_inode_item
Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:30 +01:00
David Sterba
15db981600 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>
2016-11-09 13:47:30 +01:00
David Sterba
cf5c55fba8 btrfs-progs: dump-tree: print dev stats
Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:30 +01:00
David Sterba
0f4ab474fe btrfs-progs: add dev stats on-disk structure
Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:30 +01:00
David Sterba
b74dbb86c0 btrfs-progs: dump-tree: print balance status item
Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:30 +01:00
David Sterba
ad5c75708a btrfs-progs: add balance status structures
Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:30 +01:00
David Sterba
8a50dc9600 btrfs-progs: teach print_leaf about temporary item subtypes
[ kernel patch 9f07e1d76eaeeddedcf9651395b4a8f870df31f0 ]
Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:30 +01:00