Re: [PATCH 23/29] btrfs: lookup_extent_data_ref rename ret to ret2 and err to ret

Anand Jain
2024-04-18T06:55:33Z

On 3/20/24 02:17, Josef Bacik wrote:
> On Tue, Mar 19, 2024 at 08:25:31PM +0530, Anand Jain wrote:
>> First, rename ret to ret2, compile, and then rename err to 'ret',
>> to ensure that no original ret remains as the new ret.
>>
>> Signed-off-by: Anand Jain <anand.jain@oracle.com>
>> ---
>> fs/btrfs/extent-tree.c | 24 ++++++++++++------------
>> 1 file changed, 12 insertions(+), 12 deletions(-)
>>
>> diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
>> index 1a1191efe59e..4b0a55e66a55 100644
>> --- a/fs/btrfs/extent-tree.c
>> +++ b/fs/btrfs/extent-tree.c
>> @@ -448,9 +448,9 @@ static noinline int lookup_extent_data_ref(struct btrfs_trans_handle *trans,
>> struct btrfs_extent_data_ref *ref;
>> struct extent_buffer *leaf;
>> u32 nritems;
>> - int ret;
>> + int ret2;
>> int recow;
>> - int err = -ENOENT;
>> + int ret = -ENOENT;
>>
>> key.objectid = bytenr;
>> if (parent) {
>> @@ -463,14 +463,14 @@ static noinline int lookup_extent_data_ref(struct btrfs_trans_handle *trans,
>> }
>> again:
>> recow = 0;
>> - ret = btrfs_search_slot(trans, root, &key, path, -1, 1);
>> - if (ret < 0) {
>> - err = ret;
>> + ret2 = btrfs_search_slot(trans, root, &key, path, -1, 1);
>> + if (ret2 < 0) {
>> + ret = ret2;
>> goto fail;
>> }
>>
>> if (parent) {
>> - if (!ret)
>> + if (!ret2)
>> return 0;
>
> You don't need ret2, you can just rework this to
>
> if (parent) {
> if (ret)
> return -ENOENT;
> return 0;
> }
>
>> goto fail;
>> }
>> @@ -479,10 +479,10 @@ static noinline int lookup_extent_data_ref(struct btrfs_trans_handle *trans,

This changes applied with the reinitialize of ret.

+ ret = -ENOENT;

Thanks, Anand

>> nritems = btrfs_header_nritems(leaf);
>> while (1) {
>> if (path->slots[0] >= nritems) {
>> - ret = btrfs_next_leaf(root, path);
>> - if (ret < 0)
>> - err = ret;
>> - if (ret)
>> + ret2 = btrfs_next_leaf(root, path);
>> + if (ret2 < 0)
>> + ret = ret2;
>> + if (ret2)
>> goto fail;
>
> Just rework this to
>
> ret = btrfs_next_leaf(root, path);
> if (ret) {
> if (ret > 1)
> return -ENOENT;
> return ret;
> }
>
> Thanks,
>
> Josef