From patchwork Tue May 21 17:11:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 13669570 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AA7E57711E for ; Tue, 21 May 2024 17:12:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.177.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716311563; cv=fail; b=O2YMLZBcbjbOY6LlfQ6dpeuJBsFj3AMc01UCq8TWA8qviMLJgAl7wwyZ5X3J91t9yEXYAAeH4abi9ItMMI8Bnku3dNQBO4hwFXfVbDSIBmd+nn6DxmVx2IEr0xFtW8b6BH474mTF0xX4GKooeitR7mBxJ3abyFvG/lEyt9330Ac= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716311563; c=relaxed/simple; bh=paIhwbwkHPbpUZ/4Zp/5PcxC0NUlCE/GXlG9+sQxGgg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=IiWVj8QSKB/AYfNLSim2TMP2gcYfLe6bdj30fBTR/pXxYHe4je2TcTm4DaKdTDZBhvrq8JHGBfDMOiAkqHPkN2V/0Hfh2NIrPja9oKuT8By3hzedxfVmmgNkm7kStS3NOiz1i+q2S2MK48L4RhQQt5cLVnEjr7BewqdU79N4OPE= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=bdTAnBJL; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=enSxOJNU; arc=fail smtp.client-ip=205.220.177.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="bdTAnBJL"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="enSxOJNU" Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 44LGx5wB008974 for ; Tue, 21 May 2024 17:12:40 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-11-20; bh=+v2dMCkXtmBJwXLmhyHqHQz2SkhyDJfkv6GubW6dXW8=; b=bdTAnBJLXetmoh9QIxFh8ty/8nRPOngdYQTquN36H3y0Uz1rTEXTLpjRbbg5TTEQ7VdI l6jAjoBBsNsUWfsFcz94iP/ois3R03ci6CkPX+fz4G6dTBu1sKpPjBWolbT0bXZujEtR yTDNHeeJAjW1/FmfXEQMvTquHLXm181X6rx6J63XdzFJf9QJQ32mCOUIfHPeCQhjPll4 fAdy7qgfUYWsG6Scvu3TasyYYl+JTbMXdnK8S+neCDwOLEtxHMeobvGI7t9xRoEQmaAg UBsiHobBUN29TK0mtveSpWbMHg0GU4K84a9HEDjjO+AU1s2n44pOautv1btiu934Kna5 1g== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3y6mcdwxpe-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 21 May 2024 17:12:40 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 44LGfbZO004968 for ; Tue, 21 May 2024 17:12:39 GMT Received: from nam02-sn1-obe.outbound.protection.outlook.com (mail-sn1nam02lp2041.outbound.protection.outlook.com [104.47.57.41]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3y6js88sfm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 21 May 2024 17:12:39 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aRrAbPxkyyWoeUOwntd/7GqKZ+bklRMhC/IJcIlN0nChV37ZHKKFP6fOTY+GwU5oQRlDVaWCBvu/OClyRAok3riO3zj2b9CwWjqSrQdQB9g0NRLsF0cKOWLrkulV/PeFbCTzrd4XuL1tV7zaxQXu9kP2AmPkceUG6WajuP6yA5COM5p92DhvCR2QS8pg6eUkjMX1L+CtWatKsvdXUs/0P83a9oUEe9mtRbDTmzTMoI/YGpF4Qei/Jgptlo4dFmx9dBzDXoLO7s3ofQiNa/R3GUxFxh3XypKjDC4X1h/JnslbQPXfu7B9Z+G5pX+cKsYTZyfhS7S8I+pzPbxgKhMiHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=+v2dMCkXtmBJwXLmhyHqHQz2SkhyDJfkv6GubW6dXW8=; b=FAoOH7gqW2+y6gFHjgcV9qAiN2gJn+Xnf3AlWDQdAFxpeiAni7XKfyfiq9ZbZETMDA11iJxqG6NcMWjcFhmPmGHhjW2P6Zzp0Y9Z15SPzhglq0uXaqVUxDFHOk+6EnveqbJt7bLZjNS20GCZIibtcZT0YNTyj/FBC3okMcmftkVG6et+E3XYmemwbihY0v6ZP42BN8vNWu3i1yp+WbBDvNrWvIjriKcxb5MD/IxSDcliNbw+KTSZQieeqk5nD6oAotZDT3EfqoF2M/9dhLU6AksBXkX7CZqqPD06+5sKKdbSuT7/5tTfsSlOMf1mRFvQWwn3FYRxEeFWj72qOd4KYg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+v2dMCkXtmBJwXLmhyHqHQz2SkhyDJfkv6GubW6dXW8=; b=enSxOJNUyLRyQ2pvjvJVa7bb5BaxZRTbjaXhREtvR8+C+zH0oGm+tLnEpAC+c3rzR5+PDNNchpfqCjZshfzB+DoZkchkKLbLI6UtP9n0f7CmzhTndmnuo9NG/+fXRTnp9tOQIwK/klNvAfrf6GTEimrwe9/1EJvdZnLVL9lGKCA= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by MN6PR10MB7520.namprd10.prod.outlook.com (2603:10b6:208:478::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7587.36; Tue, 21 May 2024 17:12:37 +0000 Received: from PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::fea:df00:2d94:cb65]) by PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::fea:df00:2d94:cb65%6]) with mapi id 15.20.7587.028; Tue, 21 May 2024 17:12:37 +0000 From: Anand Jain To: linux-btrfs@vger.kernel.org Cc: Anand Jain Subject: [PATCH v4 2/6] btrfs: rename ret to err in btrfs_recover_relocation() Date: Wed, 22 May 2024 01:11:08 +0800 Message-ID: <26786b9831677135798001d84ad11962b2be08f1.1716310365.git.anand.jain@oracle.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: References: X-ClientProxiedBy: SG2PR06CA0216.apcprd06.prod.outlook.com (2603:1096:4:68::24) To PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) Precedence: bulk X-Mailing-List: linux-btrfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR10MB5706:EE_|MN6PR10MB7520:EE_ X-MS-Office365-Filtering-Correlation-Id: d7da083a-a522-4463-2004-08dc79b93697 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|366007|1800799015|376005; X-Microsoft-Antispam-Message-Info: LMwSr54iXUfYxU83S/DKCAFauFvEx07zQjylyVOrDGDDsSrKQkoqeJEnhGFwXtOiWksEkATbVtVa21wyJPwnaYRIIxlqGD56WOScKChbhHYqj31XiP1ervwf2CnFwUrh4uU8rU1GAFT81/BLZB30C/8XzDo6o9hLHaGUsAC5AVEk1Ga8HgI1pUUBbn3mtGhmKY8PCsDgZNoJPM5aBUTpiPONByUCkLlfiC3YPVKHFEemWAfYWNwLxxkLXNbtjimlPgfLGDW6b1zqKOsOfwCu1ZxVx8pIos2ntbrazTTjEL2dI2iLdcmuFQne5Cb2L6qnE8JoffkLmunP0ROYnDUdVVFelNeUPCtROtsH1HvvWTU/13ZkbjSDNrAhYYzNiO3Tx8P708PfmlPvT4lXVB5Vk6B9OO3OlZW96cX8G0t3IIf2jg07XNfgXk4NIYIe0ksX8vwUXQpjiyD3YelQHDlFWx6nDli+BBdAWVJ1yOfimdrzGvWCciw9pA3p+ZuWwR0elWg+to6bn5gSB+pNOYQMLmlTze97E+HHIWUWVGD/AMDezaD1nNN7Hro0BNjbVdaIZffSNBfPH8A3uWQjUThaavMrCAgxGg38koUa8rom2rcxnjtZlUb9VKBdOQB0T+4OIiaD9xzFrvXthNXIAaMX2nfEoJGNAVn8QGSBfZ7Yg5wCAFGgyC+srQKxtwUQ81ZLekDFiLqpwHZXxJt8Oj/+3PFsk31zNaXkM8QDulpL/L9dRXPAx6P15eAZ37zBfjM1fxp/gcOLbtXDNNlxCXbomh4ZmY0Af9h4xO6Z7whL0qiAyffjAlP4GFnY3rhvagwDgxCCKs4ZeiswwlE7YgdV8sJWCd2Zk46U8+/tEQp49PcXY8xZsPWdAkpAUOdQU6VP3wwN+av6IM0/0YBAwR1BvaDZ1n02+f4ZXV1Chm1pZSiRD7slGGxicF7oHWFSd7lP2Zyc1iuWPMJIaKuqe6Zl8DjH2cb4/40AJj3o40nOtbMghNqj2RyQ+AxWc111T2R5AYM319moVdoJnVKHXPjFiZv4McCG2eNoxqPE12thpzkld3Cpojl1P+SKf+4QNrt5lhRDvF70sau9LrvTseDcFVN0AC4FNVtYgygMFjmt8aYLlNhtfTVl5ZWD5xki1MG13GlPuwU20Rc+7jRJawsRx5ELgUTdB8ryHVr4qSckRFJeA2u8oC80giA2Lc4F2J18VYPTMivN9Kn0qN+hn42GOAdmh3vdt08wKwdAhgYe/N/te9U8YXXlLkbn3AQs28zby0QaCj3pQbJMJ3p5iDEwqg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR10MB5706.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366007)(1800799015)(376005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: +SPoXwRsM7FRjOzjCq7MZVU5sEeCu4jjRv/84nBK1zE7kiuJHc9VBEThusVDNy1BcGxM7VFx9rKwpDPrcE3owaKaH+Qht5F87dJHXq0PgbTl2HVZau9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KhY1BJ531Hxcg9w+eEtu6lEXubxud690nxpL2gGT2AuM5GQIiRYuY/HKKqOzM= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: d7da083a-a522-4463-2004-08dc79b93697 X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB5706.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 May 2024 17:12:37.2911 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: GLOCX7R20lt+/Eoj/4yCFaGeZ1lcozRI2PVsX914mtQ5P6yQdus06atHqJ6F4wEq3FUB6zRHJtlHkeqxLB6DYA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN6PR10MB7520 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.650,FMLib:17.12.28.16 definitions=2024-05-21_10,2024-05-21_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 phishscore=0 suspectscore=0 mlxscore=0 adultscore=0 mlxlogscore=999 spamscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2405010000 definitions=main-2405210130 X-Proofpoint-ORIG-GUID: INQLLAvkKZu21Q0J9bj4bVrfVFTtnLL7 X-Proofpoint-GUID: INQLLAvkKZu21Q0J9bj4bVrfVFTtnLL7 In the function btrfs_recover_relocation(), currently the variable 'err' carries the return value and 'ret' holds the intermediary return value. However, in some lines, we don't need this two-step approach; we can directly use 'err'. So, optimize them, which requires reinitializing 'err' to zero at two locations. This is a preparatory patch to fix the code style by renaming 'err' to 'ret'. Signed-off-by: Anand Jain --- v4: title changed v3: splits optimization part from the rename part. fs/btrfs/relocation.c | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c index 8ce337ec033c..d0352077f0fc 100644 --- a/fs/btrfs/relocation.c +++ b/fs/btrfs/relocation.c @@ -4234,17 +4234,16 @@ int btrfs_recover_relocation(struct btrfs_fs_info *fs_info) key.offset = (u64)-1; while (1) { - ret = btrfs_search_slot(NULL, fs_info->tree_root, &key, + err = btrfs_search_slot(NULL, fs_info->tree_root, &key, path, 0, 0); - if (ret < 0) { - err = ret; + if (err < 0) goto out; - } - if (ret > 0) { + if (err > 0) { if (path->slots[0] == 0) break; path->slots[0]--; } + err = 0; leaf = path->nodes[0]; btrfs_item_key_to_cpu(leaf, &key, path->slots[0]); btrfs_release_path(path); @@ -4266,16 +4265,13 @@ int btrfs_recover_relocation(struct btrfs_fs_info *fs_info) fs_root = btrfs_get_fs_root(fs_info, reloc_root->root_key.offset, false); if (IS_ERR(fs_root)) { - ret = PTR_ERR(fs_root); - if (ret != -ENOENT) { - err = ret; + err = PTR_ERR(fs_root); + if (err != -ENOENT) goto out; - } - ret = mark_garbage_root(reloc_root); - if (ret < 0) { - err = ret; + err = mark_garbage_root(reloc_root); + if (err < 0) goto out; - } + err = 0; } else { btrfs_put_root(fs_root); } @@ -4297,11 +4293,9 @@ int btrfs_recover_relocation(struct btrfs_fs_info *fs_info) goto out; } - ret = reloc_chunk_start(fs_info); - if (ret < 0) { - err = ret; + err = reloc_chunk_start(fs_info); + if (err < 0) goto out_end; - } rc->extent_root = btrfs_extent_root(fs_info, 0);