mbox series

[v2,00/30] btrfs: avoid repeated path computations and allocations for send

Message ID cover.1740049233.git.fdmanana@suse.com (mailing list archive)
Headers show
Series btrfs: avoid repeated path computations and allocations for send | expand

Message

Filipe Manana Feb. 20, 2025, 11:04 a.m. UTC
From: Filipe Manana <fdmanana@suse.com>

This eleminates repeated path allocations and computations for send when
processing the current inode. The bulk of this is done in patches 28/30
and 29/30, while the remainder are cleanups and simplifications, some of
them to simplify the actual work related to avoiding the repeated path
allocations and computations.

A test, and its result, is described in the change log of patch 29/30.

V2: Add 4 missing patches (cleanups).

Filipe Manana (30):
  btrfs: send: remove duplicated logic from fs_path_reset()
  btrfs: send: make fs_path_len() inline and constify its argument
  btrfs: send: always use fs_path_len() to determine a path's length
  btrfs: send: simplify return logic from fs_path_prepare_for_add()
  btrfs: send: simplify return logic from fs_path_add()
  btrfs: send: implement fs_path_add_path() using fs_path_add()
  btrfs: send: simplify return logic from fs_path_add_from_extent_buffer()
  btrfs: send: return -ENAMETOOLONG when attempting a path that is too long
  btrfs: send: simplify return logic from __get_cur_name_and_parent()
  btrfs: send: simplify return logic from is_inode_existent()
  btrfs: send: simplify return logic from get_cur_inode_state()
  btrfs: send: factor out common logic when sending xattrs
  btrfs: send: only use booleans variables at process_recorded_refs()
  btrfs: send: add and use helper to rename current inode when processing refs
  btrfs: send: simplify return logic from send_remove_xattr()
  btrfs: send: simplify return logic from record_new_ref_if_needed()
  btrfs: send: simplify return logic from record_deleted_ref_if_needed()
  btrfs: send: simplify return logic from record_new_ref()
  btrfs: send: simplify return logic from record_deleted_ref()
  btrfs: send: simplify return logic from record_changed_ref()
  btrfs: send: remove unnecessary return variable from process_new_xattr()
  btrfs: send: simplify return logic from process_changed_xattr()
  btrfs: send: simplify return logic from send_verity()
  btrfs: send: simplify return logic from send_rename()
  btrfs: send: simplify return logic from send_link()
  btrfs: send: simplify return logic from send_unlink()
  btrfs: send: simplify return logic from send_rmdir()
  btrfs: send: keep the current inode's path cached
  btrfs: send: avoid path allocation for the current inode when issuing commands
  btrfs: send: simplify return logic from send_set_xattr()

 fs/btrfs/send.c | 497 +++++++++++++++++++++++-------------------------
 1 file changed, 236 insertions(+), 261 deletions(-)

Comments

David Sterba Feb. 20, 2025, 11:46 p.m. UTC | #1
On Thu, Feb 20, 2025 at 11:04:13AM +0000, fdmanana@kernel.org wrote:
> From: Filipe Manana <fdmanana@suse.com>
> 
> This eleminates repeated path allocations and computations for send when
> processing the current inode. The bulk of this is done in patches 28/30
> and 29/30, while the remainder are cleanups and simplifications, some of
> them to simplify the actual work related to avoiding the repeated path
> allocations and computations.
> 
> A test, and its result, is described in the change log of patch 29/30.
> 
> V2: Add 4 missing patches (cleanups).
> 
> Filipe Manana (30):
>   btrfs: send: remove duplicated logic from fs_path_reset()
>   btrfs: send: make fs_path_len() inline and constify its argument
>   btrfs: send: always use fs_path_len() to determine a path's length
>   btrfs: send: simplify return logic from fs_path_prepare_for_add()
>   btrfs: send: simplify return logic from fs_path_add()
>   btrfs: send: implement fs_path_add_path() using fs_path_add()
>   btrfs: send: simplify return logic from fs_path_add_from_extent_buffer()
>   btrfs: send: return -ENAMETOOLONG when attempting a path that is too long
>   btrfs: send: simplify return logic from __get_cur_name_and_parent()
>   btrfs: send: simplify return logic from is_inode_existent()
>   btrfs: send: simplify return logic from get_cur_inode_state()
>   btrfs: send: factor out common logic when sending xattrs
>   btrfs: send: only use booleans variables at process_recorded_refs()
>   btrfs: send: add and use helper to rename current inode when processing refs
>   btrfs: send: simplify return logic from send_remove_xattr()
>   btrfs: send: simplify return logic from record_new_ref_if_needed()
>   btrfs: send: simplify return logic from record_deleted_ref_if_needed()
>   btrfs: send: simplify return logic from record_new_ref()
>   btrfs: send: simplify return logic from record_deleted_ref()
>   btrfs: send: simplify return logic from record_changed_ref()
>   btrfs: send: remove unnecessary return variable from process_new_xattr()
>   btrfs: send: simplify return logic from process_changed_xattr()
>   btrfs: send: simplify return logic from send_verity()
>   btrfs: send: simplify return logic from send_rename()
>   btrfs: send: simplify return logic from send_link()
>   btrfs: send: simplify return logic from send_unlink()
>   btrfs: send: simplify return logic from send_rmdir()
>   btrfs: send: keep the current inode's path cached
>   btrfs: send: avoid path allocation for the current inode when issuing commands
>   btrfs: send: simplify return logic from send_set_xattr()

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