mbox series

[00/29] trivial adjustments for return variable coding style

Message ID cover.1710857863.git.anand.jain@oracle.com (mailing list archive)
Headers show
Series trivial adjustments for return variable coding style | expand

Message

Anand Jain March 19, 2024, 2:55 p.m. UTC
Rename variable 'err'; instead, use 'ret', and the 'ret' helper variable
is renamed to 'ret2'.

https://btrfs.readthedocs.io/en/latest/dev/Development-notes.html#code

In functions where 'ret' is already used as a return helper (but not the
actual return), to avoid oversight, first rename the original 'ret'
variable to 'ret2', compile it, and then rename 'err' to 'ret'.

Anand Jain (29):
  btrfs: btrfs_cleanup_fs_roots rename ret to ret2 and err to ret
  btrfs: btrfs_initxattrs rename err to ret
  btrfs: send_extent_data rename err to ret
  btrfs: btrfs_rmdir rename err to ret
  btrfs: btrfs_cont_expand rename err to ret
  btrfs: btrfs_setsize rename err to ret2
  btrfs: btrfs_find_orphan_roots rename ret to ret2 and err to ret
  btrfs: btrfs_ioctl_snap_destroy rename err to ret
  btrfs: __set_extent_bit rename err to ret
  btrfs: convert_extent_bit rename err to ret
  btrfs: __btrfs_end_transaction rename err to ret
  btrfs: btrfs_write_marked_extents rename werr to ret err to ret2
  btrfs: __btrfs_wait_marked_extents rename werr to ret err to ret2
  btrfs: build_backref_tree rename err to ret and ret to ret2
  btrfs: relocate_tree_blocks rename ret to ret2 and err to ret
  btrfs: relocate_block_group rename ret to ret2 and err to ret
  btrfs: create_reloc_inode rename err to ret
  btrfs: btrfs_relocate_block_group rename ret to ret2 and err ro ret
  btrfs: mark_garbage_root rename err to ret2
  btrfs: btrfs_recover_relocation rename ret to ret2 and err to ret
  btrfs: quick_update_accounting rename err to ret2
  btrfs: btrfs_qgroup_rescan_worker rename ret to ret2 and err to ret
  btrfs: lookup_extent_data_ref rename ret to ret2 and err to ret
  btrfs: btrfs_drop_snapshot rename ret to ret2 and err to ret
  btrfs: btrfs_drop_subtree rename retw to ret2
  btrfs: btrfs_dirty_pages rename variable err to ret
  btrfs: prepare_pages rename err to ret
  btrfs: btrfs_direct_write rename err to ret
  btrfs: fixup_tree_root_location rename ret to ret2 and err to ret

 fs/btrfs/disk-io.c        |  22 +--
 fs/btrfs/extent-io-tree.c |  58 ++++----
 fs/btrfs/extent-tree.c    | 122 ++++++++---------
 fs/btrfs/file.c           |  80 +++++------
 fs/btrfs/inode.c          |  88 ++++++------
 fs/btrfs/ioctl.c          |  66 ++++-----
 fs/btrfs/qgroup.c         |  44 +++---
 fs/btrfs/relocation.c     | 280 +++++++++++++++++++-------------------
 fs/btrfs/root-tree.c      |  36 ++---
 fs/btrfs/send.c           |   4 +-
 fs/btrfs/transaction.c    |  56 ++++----
 fs/btrfs/xattr.c          |  10 +-
 12 files changed, 434 insertions(+), 432 deletions(-)

Comments

David Sterba March 22, 2024, 2:32 a.m. UTC | #1
On Tue, Mar 19, 2024 at 08:25:08PM +0530, Anand Jain wrote:
> Rename variable 'err'; instead, use 'ret', and the 'ret' helper variable
> is renamed to 'ret2'.
> 
> https://btrfs.readthedocs.io/en/latest/dev/Development-notes.html#code
> 
> In functions where 'ret' is already used as a return helper (but not the
> actual return), to avoid oversight, first rename the original 'ret'
> variable to 'ret2', compile it, and then rename 'err' to 'ret'.
> 
> Anand Jain (29):
>   btrfs: btrfs_cleanup_fs_roots rename ret to ret2 and err to ret
>   btrfs: btrfs_initxattrs rename err to ret
>   btrfs: send_extent_data rename err to ret
>   btrfs: btrfs_rmdir rename err to ret
>   btrfs: btrfs_cont_expand rename err to ret
>   btrfs: btrfs_setsize rename err to ret2
>   btrfs: btrfs_find_orphan_roots rename ret to ret2 and err to ret
>   btrfs: btrfs_ioctl_snap_destroy rename err to ret
>   btrfs: __set_extent_bit rename err to ret
>   btrfs: convert_extent_bit rename err to ret
>   btrfs: __btrfs_end_transaction rename err to ret
>   btrfs: btrfs_write_marked_extents rename werr to ret err to ret2
>   btrfs: __btrfs_wait_marked_extents rename werr to ret err to ret2
>   btrfs: build_backref_tree rename err to ret and ret to ret2
>   btrfs: relocate_tree_blocks rename ret to ret2 and err to ret
>   btrfs: relocate_block_group rename ret to ret2 and err to ret
>   btrfs: create_reloc_inode rename err to ret
>   btrfs: btrfs_relocate_block_group rename ret to ret2 and err ro ret
>   btrfs: mark_garbage_root rename err to ret2
>   btrfs: btrfs_recover_relocation rename ret to ret2 and err to ret
>   btrfs: quick_update_accounting rename err to ret2
>   btrfs: btrfs_qgroup_rescan_worker rename ret to ret2 and err to ret
>   btrfs: lookup_extent_data_ref rename ret to ret2 and err to ret
>   btrfs: btrfs_drop_snapshot rename ret to ret2 and err to ret
>   btrfs: btrfs_drop_subtree rename retw to ret2
>   btrfs: btrfs_dirty_pages rename variable err to ret
>   btrfs: prepare_pages rename err to ret
>   btrfs: btrfs_direct_write rename err to ret
>   btrfs: fixup_tree_root_location rename ret to ret2 and err to ret

Several patches got coments that would need an update but I think for
the simple err -> ret renames that did not involve anything else you can
add it to for-next. If you're not sure about some case then send it in
v2.
Anand Jain March 25, 2024, 9:37 a.m. UTC | #2
On 3/22/24 08:02, David Sterba wrote:
> On Tue, Mar 19, 2024 at 08:25:08PM +0530, Anand Jain wrote:
>> Rename variable 'err'; instead, use 'ret', and the 'ret' helper variable
>> is renamed to 'ret2'.
>>
>> https://btrfs.readthedocs.io/en/latest/dev/Development-notes.html#code
>>
>> In functions where 'ret' is already used as a return helper (but not the
>> actual return), to avoid oversight, first rename the original 'ret'
>> variable to 'ret2', compile it, and then rename 'err' to 'ret'.
>>
>> Anand Jain (29):
>>    btrfs: btrfs_cleanup_fs_roots rename ret to ret2 and err to ret
>>    btrfs: btrfs_initxattrs rename err to ret
>>    btrfs: send_extent_data rename err to ret
>>    btrfs: btrfs_rmdir rename err to ret
>>    btrfs: btrfs_cont_expand rename err to ret
>>    btrfs: btrfs_setsize rename err to ret2
>>    btrfs: btrfs_find_orphan_roots rename ret to ret2 and err to ret
>>    btrfs: btrfs_ioctl_snap_destroy rename err to ret
>>    btrfs: __set_extent_bit rename err to ret
>>    btrfs: convert_extent_bit rename err to ret
>>    btrfs: __btrfs_end_transaction rename err to ret
>>    btrfs: btrfs_write_marked_extents rename werr to ret err to ret2
>>    btrfs: __btrfs_wait_marked_extents rename werr to ret err to ret2
>>    btrfs: build_backref_tree rename err to ret and ret to ret2
>>    btrfs: relocate_tree_blocks rename ret to ret2 and err to ret
>>    btrfs: relocate_block_group rename ret to ret2 and err to ret
>>    btrfs: create_reloc_inode rename err to ret
>>    btrfs: btrfs_relocate_block_group rename ret to ret2 and err ro ret
>>    btrfs: mark_garbage_root rename err to ret2
>>    btrfs: btrfs_recover_relocation rename ret to ret2 and err to ret
>>    btrfs: quick_update_accounting rename err to ret2
>>    btrfs: btrfs_qgroup_rescan_worker rename ret to ret2 and err to ret
>>    btrfs: lookup_extent_data_ref rename ret to ret2 and err to ret
>>    btrfs: btrfs_drop_snapshot rename ret to ret2 and err to ret
>>    btrfs: btrfs_drop_subtree rename retw to ret2
>>    btrfs: btrfs_dirty_pages rename variable err to ret
>>    btrfs: prepare_pages rename err to ret
>>    btrfs: btrfs_direct_write rename err to ret
>>    btrfs: fixup_tree_root_location rename ret to ret2 and err to ret
> 
> Several patches got coments that would need an update but I think for
> the simple err -> ret renames that did not involve anything else you can
> add it to for-next.

Yeah, to better manage the patches, I have just pushed the patch
which are direct err->ret renames and does not involve ret2 and
have comments/suggestions for better ideas.

I'll be sending v2 for the remaining patches.

Thanks, Anand

> If you're not sure about some case then send it in
> v2.