From patchwork Thu May 16 11:12:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 13666002 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 2ABF9143747 for ; Thu, 16 May 2024 11:12:47 +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=1715857969; cv=fail; b=RBxPLuHFm1RiolnEqHHs2sPRLqiuqggIO4IJidSgHIxmx6KNhnDLP6rEA/MqEUAdVsXNPk6enNUsW3vr6GlxuW+adbwhaPOaVQSGc2/Y7CvSN1MNf24fTd48BuA7vjkwLzVTXpCeuOYXYIPAEXyXXaWc+p+cZOak2nbVwXoftLU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715857969; c=relaxed/simple; bh=NUTR+ZVtq/tfrIIO6YniA2IyaiUPiBP9WfhIuzyKesw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=pUeBSIJjn2sczebczQWkhgr6g3Enj6cXmV+mS+NQMc7BJLYPCSsm5P27OZYa41WLplDaIMnLHn1TfT788jDKoYq6xnlj1If0JMvB6Kg3K6GpySrJkw5rGii/wTJjeAQZu72EhQlx+F0BBY7Hpb6Krc453XSrdKjln0B+x6zGGHU= 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=gr7xFBa+; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=B3G2h/gG; 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="gr7xFBa+"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="B3G2h/gG" Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 44GAnHBe028714 for ; Thu, 16 May 2024 11:12:47 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=OLbj5TAEAwQU/Ik6cUw/qqQlbE9f9IP/FfS3PmElj14=; b=gr7xFBa+X3fZWnm2EvegcqJ89WlO+aRO++PLcEhQV2iTzNNLenyEALdWlCZvvMWKoj30 GZdvS0DCwZbLjxnO578bsm9CY/vbDPWyH6stMeN56c8Pn0X23dldy4LQnR8jXBJzBUVU rbEysG5FR1Y+POgzrALR0axvqwqyzjlVeB5nQbArbGoCAZcRxzBwKWhA2yJWYD4NGrFO Jn6DamH7Tv4OG0m66OKzQd4vM9Mqm+gtWs+Rs0JBsZHGvNy0H1BW8YNiHuHAPWwWOwpI 181N+AWd7FmMQ/N52Bt0h7dZp0Ib4gIcjfByvUKqkqgEphHHRDqYIrpANM51erIYpbbz Gg== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3y3tx36y30-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 16 May 2024 11:12:46 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 44GB7Fto018120 for ; Thu, 16 May 2024 11:12:46 GMT Received: from nam02-dm3-obe.outbound.protection.outlook.com (mail-dm3nam02lp2040.outbound.protection.outlook.com [104.47.56.40]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3y1y4g9t51-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 16 May 2024 11:12:46 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WNb0IHJGNJ26B7hO+ofTyZ1sgUod9dU/GMtEvcM7bXLHZlMiEoXjCwTk+jRTf+eBn9emqCqNn15NrzoAp9qYR0kllHjdvCDvMYKzLOO82pndm4dJmTtCmN0Tx9qWfhEbcE1NmLowauZF5xJpNOAT5lSNwXDsN5zz8z/GFMVH6PPQytR1KmC+RdwsRnOWVov6DDF/7Ef0d38cSPQpuVLfiFJHr+W/I1HMAXf2hPx90ullwYIH8IG0xgEpYdNJvVmnD85Xwv8vEdvWoqsfE4OpXhUOIoJ6KcLeYp1GQ0zLhGug5SI6SxfdB07u70lSOx0yDYH3QN5QdRVZVUz5EpWTGw== 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=OLbj5TAEAwQU/Ik6cUw/qqQlbE9f9IP/FfS3PmElj14=; b=HT9vuzluE52TgHG8lLzWo+zfgMrj+K2IAntdGNQCInQ2BIPHjLNObSUoSJtmHIl7H1eIBR3hCUb/AkpefstYZe02oEROIj1vSDDYnoVcu8AXJ+9EDtiuxjCGnTRrRYOeg3oi1fw1lMUSFo7VIu9O73SiSHQR6LRXL3H+LqhJx9m49QNXFm2zNA8BzTUXNZsQ5P2hGWFdYMn985YHqY1wWYxtnnX6YJBnthETvZfvf0jiGV8VzBUM5OCPe8PGvlime/56DCajQnF1OBO8AXzatuatc9mgCo4ZDMcRsnQv5hNRoMG7NCexCo/Y8y6GS46Lz3aqKk0J96Le8Z0lwyAtAA== 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=OLbj5TAEAwQU/Ik6cUw/qqQlbE9f9IP/FfS3PmElj14=; b=B3G2h/gGXb4bCPPZd06X0q6q0gofsnucw3jBiffS8s2LW47xr9lQrXCTlW63fWFP8ZZbUESZ5UjEOjb+vVwPS4T3AL7cljqBUEZjmhMCqXnwqtMamcA9rj2HNsxC+7e0WkcrU2jFeeeQxxOmPVSPwV977b3dSuSzT6u+3ErpIwM= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by DM6PR10MB4345.namprd10.prod.outlook.com (2603:10b6:5:21a::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7587.28; Thu, 16 May 2024 11:12:44 +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; Thu, 16 May 2024 11:12:44 +0000 From: Anand Jain To: linux-btrfs@vger.kernel.org Cc: Anand Jain Subject: [PATCH v3 1/6] btrfs: btrfs_cleanup_fs_roots handle ret variable Date: Thu, 16 May 2024 19:12:10 +0800 Message-ID: <2a831fc01d65612914702b968174945f2f7e1c79.1715783315.git.anand.jain@oracle.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: References: X-ClientProxiedBy: SG2PR03CA0127.apcprd03.prod.outlook.com (2603:1096:4:91::31) 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_|DM6PR10MB4345:EE_ X-MS-Office365-Filtering-Correlation-Id: a99888b9-ee3b-4458-93c9-08dc75991c28 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|366007|376005|1800799015; X-Microsoft-Antispam-Message-Info: 4WVTSkXq5aIMWpY6BYKvCJVZjOMPQbDNRIg11gLlFWgv3iBM+PvMtRKiS43Iwt/C4MRc84KthYGOJ3HeHi/wK0g/5AjaAEWCsNC69YGqC9ntwMpsk++XOyySyU9d2fVlOHCvpixuHw/bQJCNuj8AEdJqMbgxy+DdwmGiCJmr6Ax3RLV4IVi4pQkZSNaftwGG6DXbiSqv1WKe+nZm0d7HxFMAFxmCzd8Ue4uhEC+cXAIHHzMbRZZ4zgZJCJF87LhftRo6OqCK7ZMNlLGjWyWE+7sBeHr1BeMFcQ8zhG0iIGJGFWziUXYHbDyREFeWmViKmkLbqxGlUW/wv/cGA/a9Mc8ebxNTaqf/BWEAXqCbzwN3QqlWAuyUxiyFZ9g6UZcmZaW4OitZqTf2zAU6LDjivbpnEWUI3+4+1V/2OyInn7nUX9bbfGYKA/ASIIyvBGtHPxnx8aqnZhPzmbxIvnDZy9NVYJ/23mKz7ZKKrRLcgLm5xU9ED/2y8g1fVcTriRwvtoSDuNZ7zo8RNs86SBDsm+R0HNH4CDqIUVEiDVfLZj/QjX5ASq2Akz7fKSqA2olaklzsQ1zYzbdKRzwskjfX0MR8TKchOpU+BmNDHQf/Ord5HBoLhlHfu2zdHMs3JStXQo/3QhNZx6wRAuIfseHARPcnelfyhqy3F9FQHXw8PkkJ4zHkWPB1KZ+mMj3rEz8EDarnXMUc2ywaz1ey9hY7AJ6vGa6xOGbAzjS1A7OBkcvvGdwFGWx9Z2lPjBrRoP1l7h0JR1yacoWRZDDt3RE3sYBw4wLGvIUrn9GebhHWYikTJ6udMpRQ9+c7nH4P4fYxAgHLIv+ENHNvFhkn8Wrc0BYA0D1d4kIVZT70fLm1wHMwLcAKiAHuVlNO4PqfKHgskH2ZR7Fo+6g/0l93BkqrfCwd7AwQubTgKr2nW6GyuylWACu4+2HZsmtUqMygDSHfbvrRx7lHLAZ2hEC/eTZ5HsGeoUvW8MJ+s3FThnBHQ5E4bUtSyfrP7S/I1ZbS6LzVM/Px26Jj274yNnuKMaNX/NxN3HaRoG6qZ6a6M5ra71Wst3K+ieIW5lBrAQ360tc3mYZsDcUC5E53kXQDMJLUa/9HtDewAmDk4LaZVUqhemXHJkaWHsrP0zQckrhtGuqb3HG08dT9/XPVBQw0naSqiOEr1wEyRK2gSQfYoUNgxb2Nb2h9Aq9muc2jLEqAAw59148/NxeesTz85w5QZrUhSRePsA+c1dlQC4DE8scKwYCuMVdqGnifMb5opLgYvOv7qWkO1zvrK7wMSWO6Pe9spg== 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)(376005)(1800799015);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: pmIzHlL8mfigIEGdYa9dGQvUYT8R4yjjyMaB/162imMyM8A4MNxD90F528/cS67/rzV2MM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DYLhwBVG5/AnkeB0ngaUI2dQIbk5cX/+9Z9XuIcq5j5S0+obl35VsdogxOqUGL/wyeLXFeLy6G/EUKbeNwaNUooR//FKH12z0mWfWknDKF/XqhsdeCBnOkvA3A+kkknNYDxBBP2f/X89VjoRQeXDa7IVhFR1dUr25GblJc3rMXPG7dSB2ujPhiFis7Wpw6Qui9J2QPonX447ykD9CSR3Vh7NmXiLcN+fdi/5dGJtMJ15SqNLfzlNWr0/sy+KduMTcR68KIUltK/cAYDH/O0ClFMFaH48knjr+4gSUPcOGPqxPN8aHHm4Zt5npjNwCXcLT+vkslfWwTUpebdZhtUpux76V8albyw9XdKVQV7EZa1aRyH5Dnq4/2X9Tmrs2a8FlfyZsV78IwNDpXoJRM92TOj5O/gUJha8fJ55iyf3bFDdkK+qI9oobe/3fnyvNGN+pvWNKo3lHBpLbchp8A== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: qZKYAMU3fwrUd1q3ZTtDW4GUAuygpdA7ExkztuOw+skhK318x79iNcoQpEIcO/Ixf6KYHv3WQN+tO/qvlKvOgf5Wch8BKSKlLs4mfYgxBOzmIGz1TH9gcjWJMwtTOvTdpU6k/MYnBJ4niLQsGu5QWIJ3zigOOXFYE53+yz7gEiPYUfqq1WWD0QiP9aiFpc0eQ+LQQNhClexatCizez40z+6XnyzPNEdRmETRccLhoq7m8spGp0ntRxX9lYnNuv66kcsP7LY3sfltR1Yhdi8ktQtXpOU7oVYPnN+41csyDRROuEAvmSoJIG63y4BtzwFKJYPag0JUik9qbFM25R5LvzGtB+OeZm4FebfEqNMNFYBJFnvXLwWA3JF/WWTXDl7Bbr8I2jxFYql4snPIHZAtvA1cFYch3tLvF25glrxxPElody725KBnlRVUuLbW1thmtitCvJCUtvlWJYj5DYmvVZc7vduLvpv5T0B1y9oNZb9ynfpjMiwiawJxL+yda+arnVus6NA8eIlOoiLc7RZHlxUxZbfMsu8qKP6w1/tjtqfMvrWujEu+IjORx6sGy2VukL1xixOYJzmc73n5+U77/BWcCMB/ix92b9SU0PjMzjw= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: a99888b9-ee3b-4458-93c9-08dc75991c28 X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB5706.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 May 2024 11:12:44.5102 (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: zfHaWLS7ItQzCiwVmeLEldDbqF5d3BzuO/D2lM1i0HFJo9RhYFejfe+B8jJSZ7teO/Xh62bCt2/ftY0IJQS6Qw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB4345 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.650,FMLib:17.11.176.26 definitions=2024-05-16_05,2024-05-15_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxlogscore=999 adultscore=0 mlxscore=0 spamscore=0 suspectscore=0 phishscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2405010000 definitions=main-2405160080 X-Proofpoint-GUID: MGLQtQGMgyls4yb1FoOEwhFkY_gSU1He X-Proofpoint-ORIG-GUID: MGLQtQGMgyls4yb1FoOEwhFkY_gSU1He Since err represents the function return value, rename it as ret, and rename the original ret, which serves as a helper return value, to found. Also, optimize the code to continue call btrfs_put_root() for the rest of the root if even after btrfs_orphan_cleanup() returns error. Signed-off-by: Anand Jain --- v3: Add a code comment. v2: Rename to 'found' instead of 'ret2' (Josef). Call btrfs_put_root() in the while-loop, avoids use of the variable 'found' outside of the while loop (Qu). Use 'unsigned int i' instead of 'int' (Goffredo). fs/btrfs/disk-io.c | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index a91a8056758a..d38cf973b02a 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -2925,22 +2925,23 @@ static int btrfs_cleanup_fs_roots(struct btrfs_fs_info *fs_info) { u64 root_objectid = 0; struct btrfs_root *gang[8]; - int i = 0; - int err = 0; - unsigned int ret = 0; + int ret = 0; while (1) { + unsigned int i; + unsigned int found; + spin_lock(&fs_info->fs_roots_radix_lock); - ret = radix_tree_gang_lookup(&fs_info->fs_roots_radix, + found = radix_tree_gang_lookup(&fs_info->fs_roots_radix, (void **)gang, root_objectid, ARRAY_SIZE(gang)); - if (!ret) { + if (!found) { spin_unlock(&fs_info->fs_roots_radix_lock); break; } - root_objectid = btrfs_root_id(gang[ret - 1]) + 1; + root_objectid = btrfs_root_id(gang[found - 1]) + 1; - for (i = 0; i < ret; i++) { + for (i = 0; i < found; i++) { /* Avoid to grab roots in dead_roots. */ if (btrfs_root_refs(&gang[i]->root_item) == 0) { gang[i] = NULL; @@ -2951,24 +2952,25 @@ static int btrfs_cleanup_fs_roots(struct btrfs_fs_info *fs_info) } spin_unlock(&fs_info->fs_roots_radix_lock); - for (i = 0; i < ret; i++) { + for (i = 0; i < found; i++) { if (!gang[i]) continue; root_objectid = btrfs_root_id(gang[i]); - err = btrfs_orphan_cleanup(gang[i]); - if (err) - goto out; + /* + * Continue to release the remaining roots after the first + * error without cleanup and preserve the first error + * for the return. + */ + if (!ret) + ret = btrfs_orphan_cleanup(gang[i]); btrfs_put_root(gang[i]); } + if (ret) + break; + root_objectid++; } -out: - /* Release the uncleaned roots due to error. */ - for (; i < ret; i++) { - if (gang[i]) - btrfs_put_root(gang[i]); - } - return err; + return ret; } /* From patchwork Thu May 16 11:12:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 13666003 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.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 5AEC4145353 for ; Thu, 16 May 2024 11:12:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.165.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715857978; cv=fail; b=kThKy25HPF677NmpiY0CdXI5iK2Xc4eBH9RVYvw+HpDO0taGvlFaNn0S7PG0ae9NthDxllrnHZ9zWg7sIB3iYN0SBsaWh1uqU0y53MRwP5MGmRkvbOEU88HDMai8F6k1RsA/ZJxPKsMu/E/+z2KleDqSW1m+xEpKrxGrMyi2HUs= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715857978; c=relaxed/simple; bh=eCj19SJuaOBHItmWrrkRh6hvy67hBulDPU9rCVz1z80=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=NrPDhjxbYtHv41c9tTvZFYzMv97oIJ3d3QHCs1T9psdhdWkpmNov+mht9cp3++TgZzrDwZkzIFbR4sR95bgsYk8qJA+GSIDSlcZH4/cgvfmj1qKShmMe67EYTvou0NgRbQNEg9milOoRPuXHoeRNCYVRYnih1MpYCXOMDhtX8RQ= 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=HWLYo72Q; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=cSJUBhDY; arc=fail smtp.client-ip=205.220.165.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="HWLYo72Q"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="cSJUBhDY" Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 44GAAA1G026846 for ; Thu, 16 May 2024 11:12:54 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=Lh0GYKevP2ycccKAIrR9+uFE+GA3IFgHH0K8Jp7FTuQ=; b=HWLYo72QTMwdDJLU+Z6maJeAcQAg2mtqQ9zEPIUH+mGckbEI/mqJ/f+YRYFmogT8Q9lH It51VBWqO3BW8svjQXUefEYjjjfN7xoyaR/vpVe5XNxTqiiLCMtOBKFC4dw740J/5ydr gdMutSDLONKWCZCeiIs+XvPnjcC0E3bL5magz4cGIRAcZ84BJURKsM/pzSwOyvrmIFA2 IhAMLpKMA/XDNdQWUOp+Ixp6CYgTcq4CUizCeu1S4HzqUci7JkV7+pMLggMaF/Qr2Sc+ 14877ZB/y7aBXAFostEi9lSwOBC+tXgP4qZSWW8ZjgCs3yXdhF5zJ99veK5D5bPGvwEX VQ== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3y3t4rw89e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 16 May 2024 11:12:54 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 44G9Tfkk019298 for ; Thu, 16 May 2024 11:12:52 GMT Received: from nam02-dm3-obe.outbound.protection.outlook.com (mail-dm3nam02lp2041.outbound.protection.outlook.com [104.47.56.41]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3y3r87m0ft-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 16 May 2024 11:12:52 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FD5aVslG9H43qmsPddQdH8bGBC1YpPYeLLh6u3j8lJdOeWY11IQOuQbF0XepK5Y5v7SZ3aOu2PksVUUyFrHX/Yq8A0SLIyr+mfQ6mLDlmJ5XK0MLqLMKpy7vO972wB7iyfhZe7gIroSXIwYq2bNcgzsfL+yu2WWmMmEKevaaiZl+LzQvmKJfdvQw3AMi1pGAOnFuq1hDuK9ptpotp2ZMUS/PRGRYAPlw3Yxsmi2pBtfXG8Ctht3sI0DhUfhwx5R1SDrXjtK4bjA6/3iAeQaHQ4C06Kd4O/KNdOknd4ae+MATA3viufXmoFvUQTbzbTYSo2J4hGIxTLK3WUfEAIxwDw== 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=Lh0GYKevP2ycccKAIrR9+uFE+GA3IFgHH0K8Jp7FTuQ=; b=kbngatzF9vUKCBfABvn/GBkfymMyhm3nu6013hwh9hbb8yMbvjm4/lgkAMoU8pzUTj57V/rImLIUW0Uk5dR3ZlowceL1Yh+ChksAtMQOHoXkcQAhDqv0fdu0D6yjL6Uz/0YcX1CFgv9WWh/jZlWXkys1JsQgNhAR5R2ITVecBA2ixKF3gAkDF2keGv9LAByOa0Tss0UzGAhXtHzLlhZR67WEhY2peKqrZeiGzmMAWBNhh//BH/+wP2ENVVkRSEvPQTcP9MGx34BhFeAdTi0BrjGgHf5Z3prFFkDh1cLoPfaI14VlggZPqdmfJNaZXXh916MNycIXbSVqxNL+apHFbQ== 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=Lh0GYKevP2ycccKAIrR9+uFE+GA3IFgHH0K8Jp7FTuQ=; b=cSJUBhDYCSpimDI0IfvyugtUceEEYj+Ti7Ap816mqFr6R5wDiWGQDVyb9xXQ/feSYrC6grUqCRedQbYFCeXhsSxuT3kAgGgCsT8Hylha5lrvhpoavCWTn4LUsUzZFnl6IuylsCcjb+DFXHERM+ZY5m2mqbX02zVYO6i6JJyGJ+A= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by DM6PR10MB4345.namprd10.prod.outlook.com (2603:10b6:5:21a::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7587.28; Thu, 16 May 2024 11:12:50 +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; Thu, 16 May 2024 11:12:50 +0000 From: Anand Jain To: linux-btrfs@vger.kernel.org Cc: Anand Jain Subject: [PATCH v3 2/6] btrfs: simplify ret in btrfs_recover_relocation Date: Thu, 16 May 2024 19:12:11 +0800 Message-ID: X-Mailer: git-send-email 2.42.0 In-Reply-To: References: X-ClientProxiedBy: SG2PR03CA0111.apcprd03.prod.outlook.com (2603:1096:4:91::15) 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_|DM6PR10MB4345:EE_ X-MS-Office365-Filtering-Correlation-Id: e17c40f4-ee4a-40ad-411e-08dc75991fcd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|366007|376005|1800799015; X-Microsoft-Antispam-Message-Info: yXKJcu6+0i4B7ZQnAhoCvvfA1HgtuDYIMrUyHBkWNqbn66hxrkdmrFjD7NuLMOMG1UP3hGSn9Z7dk6a8UY4imxZGJxOfO4DCVFeiRsgalnI1CjFpaqPh2repYJdlwiemFp37EccsBtu+OaOxjp6C+HyAVf8XAdwSTXq8/HH2T/NTnBRWN0Um7dewMwAphAwAxeenKPmCtu+QYMkjfdhGPIimsVpVQi/BXvnPruJa7BN2gMxEc63CaRmFNd06FYdQR4IEsbj6WwV0HaFd/Qq+L4As6X//Rxs1E49QHgmM5x4jXzTC0sVlAJGG4NgNiopLW4FLFrPafWvmef+iEJCT2QfaN+b1/VqM+kbGsnBjoqpLlsoGl5vYfGuYLgaA0qXO5XwdjMGR29hkEi5O7tlUD5md2bRRji6WtQKG/HkFKQIMhtGz0xoK/Pt6hznBUoYd3Hg15l/Bm8oXKUlc7Bqj8B2dNmPXw9yckVTPPWv5rEWKfp05EwwM4r6OCzS3ABivmkw8fc3v5/uQrbwsGBfWgS7DmtFer3q/bBI/160JZxxxlZOZsZbtI5PNG2tJsaL2o3YbaBGsidiYTMp8wEWPpUlKy6Gh4PLRw1vSq92vsiZGdnWL7IUlY4b+JG3KP4J4eoF1yXgq/b5cYPpiJLF/Xrd6+QU7jykJgY62f+UMfyGrKDK7O2XLflEfClpmd7lMXWHNziekCIIkeM+5eWbOgfs65QNqgzxTsdvhohTSGsLgl8Pd8ue8Lj2UJTN3k4EQWf5RhBO8BEcFvmvH+RmgHNYfw1XMWWgNeCGECi0Lr2iRlsEBCmqIuEiuLJt3/REHfO/XBRwEQeYOvbJwFh9QRyvOts+pTyLEYzINhPjH6bi0Bmu95ocN8Jam+WqPj/4HSZ8B3xSdERtnLxjSMHxlg2S60uptJ0mn99Xpo1l9FPGfFzIjaceWB2lCGJec1HB7WjuYOIq1dq8BDcQpBqvujHJ6DYP04ioZGV6Q64jZ4KHFl7ZPOizEyEk/oKRRVQXu59/ar3ybqEmeWPcrOWcyeyixNDMHzUi+X9DDRsfrcn/NDTj39/44g7o+2kA9MePMzMVp0oLC9RaigoCoep7ewPyJaD/BFgMKIrtZuM928uvayxqSDPhLx1uLzNH6R39v6HLkztFwmr6VNxTsuM+L1tJ2yjbjCAP7xIVD8t1QOsBtj+NRa5qfPCy/j7bkcHwx+X4TmFhDBxsTxAoxi06jrQ1ZO7FU1+tuLYTtqCPaIk+kEnNeI2WD5XMna7LDfr7KeFo8uV8b0bdwEKCg9u/+EA== 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)(376005)(1800799015);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: MQN6LK3IBVYuOC6OZkqUomrG/Qn4m5UX46uQBRhyGvB0DRXJqIdZRechpWFcFbWhDlyEzwwAkq0YlM2nPl3TP5lkiAuKb69WlZsYvmF+RD2tpI4jfSSwq3z2Cko7YUwZB+DzHGUl+agO1bDVbygmgYnqSy+Z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6NA6t4A= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: e17c40f4-ee4a-40ad-411e-08dc75991fcd X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB5706.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 May 2024 11:12:50.6743 (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: mXG1ZkURI768Nn/qJG3L4UfNcCKRFQaGpa7Qi6ep0qj3IvrXQzu6vxMqJ0XT74NkOLKwnJAHdJNK5LPKBHfEuQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB4345 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.650,FMLib:17.11.176.26 definitions=2024-05-16_05,2024-05-15_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 bulkscore=0 mlxlogscore=999 spamscore=0 suspectscore=0 mlxscore=0 malwarescore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2405010000 definitions=main-2405160080 X-Proofpoint-GUID: edDdmVRtRRbIkOnuZnRXaK9S5_RaWB3D X-Proofpoint-ORIG-GUID: edDdmVRtRRbIkOnuZnRXaK9S5_RaWB3D 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 --- 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 8b24bb5a0aa1..bfcecf6701a0 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); From patchwork Thu May 16 11:12:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 13666004 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 830381459E3 for ; Thu, 16 May 2024 11:13:01 +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=1715857983; cv=fail; b=ndgjq2u/IFHLDgivvKty6e0JN4DWBS5foM6Khrqq5PfT1SALUPY+LbZLu/DuK8VKVvewr80zfsouhCVxzBs1cvo5PLxF4EJPxNezURF000+Yz30DD+vZ1tV4o9BYuxw6IpoP55SJRlgHimtWXvwAYfJIzLIiPPbKwwrGOKqeK4Y= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715857983; c=relaxed/simple; bh=hHVjBzWfMYNSTgRsgS6sMrWAtoj5qpMzGY/+sp4l/yc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=fzyROea5mMq1Pd2qwGhMMaRcY9qOq6BGE6Q2JLmyYgQyKCtEl1U+zn0TAkyMDOcfn67vyZwLveBr9NZcrXXoTlMQeOMFnD3trdLQm4U8jLFekVVFOBO16FCM46DKdDeSDAF6nmAjCaxVYc+hCR8Q3CLfd8u4L56JOnDcEvAQ2AI= 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=YcST+oWb; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=F/gPEnHC; 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="YcST+oWb"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="F/gPEnHC" Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 44GAnB7D028592 for ; Thu, 16 May 2024 11:13:00 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=xkLVG2x3eDKzSBAcRGOJ5O5apfApEN1QUwKNWuhScdo=; b=YcST+oWbG8LZMzLEan/UXMXfaarj4S8q6kPBkMpsfy61Qzu3lvIMjDfZYkapkNACRqzc oEq73pnNrjnS1G126oCWzHK+caIYhPMzp9TcYVq2wLTVnv2AWxc0GcxZ5nwMKR22y3Eo gG5287PKH5/kyRzl2oq4Cc+MdlcH6r2Z6T6JNcEbV7t+96Vb+sEX+PZMQ+rPPE9I53xT YkAAZgog43SIju5e77INk2v2NZSi1yZhve+AYTgC242nOskgYQKvsNfAxHgU/C9rIIJm DuLRV5fxF7AR2BcMqD6tHKQzdzoahjgP1wV0IvDTST2q1wuy6sjlf+7fa3spHQyVmXud lA== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3y3tx36y3g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 16 May 2024 11:13:00 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 44GA0kJp038472 for ; Thu, 16 May 2024 11:12:59 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2168.outbound.protection.outlook.com [104.47.57.168]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3y24pyu3ju-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 16 May 2024 11:12:59 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TmLzdZE0/uG1wBlIZtQ5csTeYL4/jUkBaBY4+z+YWVxYvYFvmFtj8gNO8aTEUHY/sWMK5ON67DGw2eNu9pSEhitjgeul8c6AX8lhrF9+XV6di7SFcfdNQH/ACQE6+pLnJw4oRKkyxUvRQQeSNhYND2ZCwg/uZ+h16GVwoOlyi9lFJVv7b09cs+BVrexjOi4K5QuLH4Gu9SgXccCyzLizNl/JuEVvpv49R8cHyOu0s/+JsatayLjVzgK5W+76/b/1tqvVDxPs4wg5wZHAZngEpCQoVGRk7BOcbCQ20j8RFc2TSX2uOdckGqTnUkbDzzLjMvLs6X+5ztVDRkLNKmiTgw== 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=xkLVG2x3eDKzSBAcRGOJ5O5apfApEN1QUwKNWuhScdo=; b=XItiOBzHE23URWiL4LRx9Mh0SMXcpIZdzXWdFZurAtraV8JuTMCOc8cgYAXuWnDUB9jC+4ODSyRS0w+9SRISB1lburS1BMfsEbMyMmuj57jQ3YViopwDA57eby9CgS4H0mjUnqUoHmCR/tjDybufbcYtjNU2WzCJP8pJNk/lHo0nbLgaEGW36wCUbI1FJez131SoBka1hyrPUnV6cXFbLWeOYDIqjFqxA+zbZCtoKFzU3T1KNwcVBb0OSXE39gULpso5lPRXV0C91tORePbGQoa17dXn/0xSDi8flQLiLSzMxzqYXvyIUOVi81Jd+9c8cQwxen/SKG1ukK+BuFI/bg== 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=xkLVG2x3eDKzSBAcRGOJ5O5apfApEN1QUwKNWuhScdo=; b=F/gPEnHCUPLf17DLwYay+XT0FeNdAtJBBZaXDBDzYppdzoOK4eIjFhi6Fc/cfFagZpK9MZbb837831S5EivuLBhTZ+kOQyDBAmjPfHsZQDpHNhsgw6c3hYz/BzphK+am32fbuuTb+H/8fEkdEcQ9nDqqkszCzOp/+/y60iywpTc= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by DM6PR10MB4345.namprd10.prod.outlook.com (2603:10b6:5:21a::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7587.28; Thu, 16 May 2024 11:12:57 +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; Thu, 16 May 2024 11:12:57 +0000 From: Anand Jain To: linux-btrfs@vger.kernel.org Cc: Anand Jain Subject: [PATCH v3 3/6] btrfs: rename ret in btrfs_recover_relocation Date: Thu, 16 May 2024 19:12:12 +0800 Message-ID: <3e29cfb3f7bfe3ac93e64029b1b0306a48c9936e.1715783315.git.anand.jain@oracle.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: References: X-ClientProxiedBy: SG2PR04CA0204.apcprd04.prod.outlook.com (2603:1096:4:187::16) 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_|DM6PR10MB4345:EE_ X-MS-Office365-Filtering-Correlation-Id: d6116e87-eed7-463e-715b-08dc759923c9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|366007|376005|1800799015; X-Microsoft-Antispam-Message-Info: AL9itEfg9FNrpzwTmFk2yeknrkiOSPpZeRMOad49Cvl92zTktJaxTKXmtIL4hYjR9lr3HYCGiiPgG9rgD4Jm2HIETG8wGERgNtXmUZucrq2jp8Bd2wXwXtcXgixDeEXX64ma68O61TO8vhQ0h8QFCP5SHGovBEGvkQPhE275Adrz1R6UUzvDjco4BbO2JGEByfkmbZtGAiRzYFdR4mI3kAAw1IoIPh32QYUF78EBQd9YPwHqC3j3YRFvCvFbGAIoVk1FAvlltfxMjD6AJ0ff28snPa+Fm8t2SNsj5A4Ygfu29KQOrK7Ewg5MEiKBJZP0DqCtlTCWuEswY/UkGn9KnenUx/9IGUG0o61EFfFeoU0Itiz5GEufO1QrC4ON349e3IkFfGBpQqdhutTEpqJHGFPpgSZh0SRVlBeRPFBrMADs/w+djn4XyUY4Iaa67wlJ97utUKIRAam46pf/CAfafmsSlK2lnGxuhPXkJYs5s2YN+7WaO+4AV2M3oTixIXtpUFa8gXnqgrEadq3az6hy99z1Vhkm8HoK7dkUMNlElTeRlfMjk/L2Q1sM9ePE2JtkkB/iT1uxtDsouEN8duA/41sI6e+7RHJE87HfQBaXYxT1T8AoHHD2pS6J70coAbgC5eEA0/WqRbOxSZvqfDITRg9I9nooiz1/ZhUC5+Y9TWLdOoH0Sy7ZTcRuu7PPPSDjQQr7rT+rB55/1uoPxPjMVJFWnCZQDyc8+JHDV3UU0BVxVnF/pKoBP4c3zCd60zskPi+k9TnoBV/xob2PIPbNmPasCMDRA9d0EAgsvyoF4j8LspTViwjcgdWVZIaA2m9GfEO+dcynMvK6ph6nIkXLW5QIxQkvHSGNX++4PPZ9/OvG4eKJGXVS1AocJYo4wQlsMkqqSKAhTA21rIVDPsIPL6xlFbiD9pVbA8xWKNTb3TxhcGgLX+O4oLoejX4z/iiBaXolExNUfQqHjfZNP3VfZW8wIv/SUrzQA4sPRbviHyI166EPnG1WzUfpEWZCh/xL/27jyo4sBOfp+db9gX2CIdh1b+tCQ8xs48altr245yk912gzHACnFA/rmMcq5SLOdrW6hZlYv7yO+gHT8rJ0sKCIkBtnkITpUQdC75iZwYJV+NM0LDtN/9XpNnuCIf6SU+uKlkdUJjyUen8mGzlihdSJepy3gJb8hGrleWHBamqjG2zamwKfOJWKu/cR7pVM2pROZuwXwb6xU5W8Y9LqtHsBs5dXEYRaFkEXrismCMHOHydAgUtdCLYlhzaVf9bCrjn7tgRPdtAdZgU5vkfCPw== 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)(376005)(1800799015);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: L7tEpTw7FXRNZbSHobljA2ja4xEEsEmSE48Uh8zmHAvVyAZ54VHHnvNcnpDPkDVWCBEUOS07jUy7tpxWn5UhCXTAONHSM4hp0aPy+/xCQAGjAQmTkVNvL3PJhRvLfP7Z7DIX67WzMA7JHb7c+Z1POCywzI0AZq6cpmRkodsPjbv18GNEfr1EFSKh7JjzXh7p6k1nyFQlwVZedRMV7A2rf/7kpZxCX3i/QNmdUQDs/4tQ35AX/qMjKk//ibijrWiogL8T/buzCyH71jDi0ZGk9HGhBIhVLOs0Ghh/fK6A8yU8dSdUDQRIrslb5fvEy0S1A+hMifaZxwKcQRNWxtOdJCChoOJ8qsMv/lpVV9tmB0DK/3ONqtrkWLy2kQANZJxosnXGH2nNOUkHt7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e8wYwDzFq5K7hhe4oL3976a4VJm5ShKrDxKrPUZ2mljfb2PvP3mQYBBjB72wtzmYkpFnHLSGyD+xCk2+lLjcwpwXFod72R5SZ4qaBwZ4cRIwCg1bnWbO8ai/c8eRKqFxA8GFor3g== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 0kK4+Vnl+NAVo3hJ1V4yezhDgVjz5QbN9LX+EBlrSIku0vd7tDgHp3eVK7mdkOOC/BExmQg1ZqWHcSM0AzPu6jX6kq+Uqw6kqrIJTwRXEc9+lJrhmDahm4dZDTq9wRrliH3HbN7E413pH3b20gLEILSoYK62kJAU7qm3Q4O2p6frbewY2pHkM7UTPPFnfTnwj1GXH3h+E9Okcl4aiamhNYLhGC4nbIJ9ws7ueLXw6TSejpWCbBqfUKXa4KayjYnfF1T7lo3+Y/lGq15AcMesLcaUbemGhWBZgYWYLz8668uwQs7JFB6qPQAWLkA+8ukyUBk0iY96DyZm64cMdg6CiNF6f829K4TRBM1ruk+F65CWBLzJ1rgWMpW1qu4+A3KQr7faytfrcRTqB+w25IN7BZ3fLxl1TBlrvpnX/rda52+Glqnol5k+oTPaxsoDfGGdUJOoFAX93EU3g9gM3v3lKXyHQ2xqcaZ214iquKkyaJ0U686RRaU0n0Pvg9P+6aE2yYXuhRytkWZP9wcS2SfpDXiw4WzLJbzteJmP0JBxi/okDXDyeXGIvvUPHhfhw7LemoDBqGwWBS05M9Dd7kREwElwgb+Z37g5XKW9sXr8rOo= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: d6116e87-eed7-463e-715b-08dc759923c9 X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB5706.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 May 2024 11:12:57.3385 (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: k/NHvJrR5rJBZwswwxRDmdNwfdxTN5urNyza5jo4FbKl15vGvhB6DK4k3Ys4VOk6/L5dhlnJIT/FzZFY4wP6wg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB4345 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.650,FMLib:17.11.176.26 definitions=2024-05-16_05,2024-05-15_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 adultscore=0 mlxscore=0 spamscore=0 phishscore=0 suspectscore=0 mlxlogscore=999 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2405010000 definitions=main-2405160080 X-Proofpoint-GUID: 2Wyj3dXwq-AFeQF7pHzDdid_4jRXM-e- X-Proofpoint-ORIG-GUID: 2Wyj3dXwq-AFeQF7pHzDdid_4jRXM-e- A preparatory patch to rename 'err' to 'ret', but ret is already used as an intermediary return value, so first rename 'ret' to 'ret2'. Signed-off-by: Anand Jain --- This patch can be merged with the next one; they were separated for easier review. Thx. v3: new fs/btrfs/relocation.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c index bfcecf6701a0..e24deb7f0504 100644 --- a/fs/btrfs/relocation.c +++ b/fs/btrfs/relocation.c @@ -4221,7 +4221,7 @@ int btrfs_recover_relocation(struct btrfs_fs_info *fs_info) struct extent_buffer *leaf; struct reloc_control *rc = NULL; struct btrfs_trans_handle *trans; - int ret; + int ret2; int err = 0; path = btrfs_alloc_path(); @@ -4356,9 +4356,9 @@ int btrfs_recover_relocation(struct btrfs_fs_info *fs_info) } err = btrfs_commit_transaction(trans); out_clean: - ret = clean_dirty_subvols(rc); - if (ret < 0 && !err) - err = ret; + ret2 = clean_dirty_subvols(rc); + if (ret2 < 0 && !err) + err = ret2; out_unset: unset_reloc_control(rc); out_end: From patchwork Thu May 16 11:12:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 13666005 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 CD20C145354 for ; Thu, 16 May 2024 11:13:07 +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=1715857989; cv=fail; b=t7ckGikV/24zhNOQMjd2xoQ5NSYqVJ66tEQxyTPFReSrB1r2fK45WxYw4n6C7jhcqOeWEHxmUAr3hP468YOaCV6Nq7EM2Su+8TLjDc3IDoUiL3bWHTe6LZW7wHRQVeiG3yLtUR7mbQdkdFPJY3m/ROOgJz2IfhcvL56Prh+OBAw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715857989; c=relaxed/simple; bh=UOIJIBx7VGiJ4cMSmUCrTKHbbyF6Y5WKiuTeXPYBEcg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=YzpuArfPHLcb+VLL+BpM4awrHuT1gcDYzpQlgiOhbXEnjPpbpe72t5ZQwCmiDrspvvoYLYgKdQN3sGEAVy2UiqueXo5yGMtwCfMuy7iM+oZ11C5bGj16xDw/1ukKFLIfgRhsb01fZbt8f/yO4skRlaTlMY/ut4CdCgSB79k2ojg= 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=eCYymtlA; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=IXK036BG; 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="eCYymtlA"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="IXK036BG" Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 44G9NTN1006682 for ; Thu, 16 May 2024 11:13:06 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=Gsu+Z2KD/wEoh/56A1O8vQ42XeScXWBHJH+jkhzDhVQ=; b=eCYymtlAV6SrXvVwmCCikMMsPtbxF0cJ04u57xQDjoWC8GXqCN5aKGDU96pzkgXEbA2U SVGC7rb5zUFVCYI3zbwVaoonLRCyOMDunXhH8etfqlWOGQiyG0zWVjWixQR45tN3czD+ N6Fw+r6oMYjTRIuGdcWQBU7ndlKB557TA36n6+xLViCCCnbyQOwnTuR4Ue+1/eTrDKjM iDdyjEUiuIaA9zaUQkA4FNcaNhPMUY7GPgutz8jPZOHaOqzKwbamQkMXmgJQCFUfqS19 ikmMBY5RQZWJoSG9Hd08Ra+AFgUpG7RC1dHFK38j1tY86HiSJydgT/hsOeulgX5Y3i1l Iw== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3y3rh7fbj8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 16 May 2024 11:13:06 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 44GB2MUC000624 for ; Thu, 16 May 2024 11:13:05 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2168.outbound.protection.outlook.com [104.47.57.168]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3y4fstd0p3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 16 May 2024 11:13:05 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YsrSmymiO67MxrGhZmUeziEay2B9KUq/+7YO0zN38gUA9j7r7GloMayOHbVvojTfhJ23KXP09HKWoqBojZTWl/fdNZQGqB7oJCNp1vhWVbzF1OGlFp8p9BVw8U1u4Foy0eKwH9RnZOCA1sqIKB96F35l0wXq+vdLj6ny+CAc4be7iVKl8xj23VgMS6wKHx7xsGJ638jDQbBckgZcbB6/vss8zhnJbk7L2iKD1UKqbsBmImskTwoQvTyAZANXf16NsrTwTpaJ7O6GSYd+xjRR4P3UDJ6S65hVAwU9cEM4Pw8ME3B1FRDOGoiDkk5HyfyuoS+iLw288FLxny9pcB3wnA== 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=Gsu+Z2KD/wEoh/56A1O8vQ42XeScXWBHJH+jkhzDhVQ=; b=bRVoxSeF67k03BeiZuF2jcp34PSqp7O/sR+HJFonUeWSFsNBnKPlXx+pUluNEtkVrUHR9WeD4/jBdbjgtDQD4FU2kStxQj568QDEUdgrLN8LnOahztujoWa0ZZH7t3qH3WMwoz4dMd2fr0Pim2QNPJBbycHwKquLaTvmDVT4O1hzB958wQIiObcliQ9HElhwKaIRDuBB5L22yCLX8EHMw7lhbSWRKwpLpMmMEoGzy+PFyMx6Kac+poXyZJtzTQKD1hr84HUV0RtgBDfqtXuhW0e7H2gLxCxqsCcySgUWvwm1uKYylMCeAAC6WK47vAF0UZL9sN96DnwdCe837pFsgA== 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=Gsu+Z2KD/wEoh/56A1O8vQ42XeScXWBHJH+jkhzDhVQ=; b=IXK036BGz6/fpb/Vihkycbbqnzs6Q5dcDPJf/jdYgSgBCJMZMozBEE6RPUajyvm9a+Xvbp1J8uHMgGXyOmC4eYAZnsfNogInSThTPU+PnifBXn2V6TTwJovRGd+17EVWiuZnbBx/lv6cIeJ0FaS6Ya1zpiCt38qpAiUQWCu/M4k= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by DM6PR10MB4345.namprd10.prod.outlook.com (2603:10b6:5:21a::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7587.28; Thu, 16 May 2024 11:13:03 +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; Thu, 16 May 2024 11:13:03 +0000 From: Anand Jain To: linux-btrfs@vger.kernel.org Cc: Anand Jain Subject: [PATCH v3 4/6] btrfs: rename err in btrfs_recover_relocation Date: Thu, 16 May 2024 19:12:13 +0800 Message-ID: X-Mailer: git-send-email 2.42.0 In-Reply-To: References: X-ClientProxiedBy: SG2PR04CA0199.apcprd04.prod.outlook.com (2603:1096:4:187::13) 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_|DM6PR10MB4345:EE_ X-MS-Office365-Filtering-Correlation-Id: 0d335e1f-6f99-49cd-f604-08dc75992765 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|366007|376005|1800799015; X-Microsoft-Antispam-Message-Info: ot+T367pyYi+GZ3obx7hICXBVi+/84i19O3/2fOJsKDtc19YUdGgedvuPeTQhigSXErZzj8nzACZhuTeyUTWxhubwgW3srg6Li73JgWq+lUHDl3lP6ns6f+c2j+M7pE1Koxb1s2kMblLxta+xubxFLAyKRlo9RTR+3wYMrGFDZN/RIlTyrFHvCXZyQ/iuS+8Rr7OBeh+Q9NjFwCU56QcRdz+2/CLJJWLEXndTfTdwNUmvhYoJgH3z+WkyoAI5ZYov/CYfft79/zzzv5bpQ54ag6xN9lLclrWXduTMB9HRjJeUQpK+/bFC1a6VsJtnzIQeQGK1ik78pKnZCYh4xe15J14a2y4OToCdqA5WORMxhAmgZNJAWhHpkYCZBE+3yiRLmKe55/ifeVXNijN4qakPdYtyYHcHefcSFcrBpvXLeVyrhMEbIBc7SMtDge2UhBioRTquPJrKgKOxSfLt+DnH5JMNlDvO0Ukw8kx0HDXI4aXmpCfpBWxb5eI2wDR+O6BpvVJeOFBmai5J+CGmIFyG13NC69BhWgexgkQOaEUqKITjUBUs/UaT+IdxKZJtUlQVcL21cwcWoXOgVrYjwHvfcUKvBK9tcETO6WPm1QA8j4flmFib8cpmtBAE3bt8Fo84l2CagiOPe7OKb82t9l6eyWmOLCEvm4iK3Vjs6y+hYyGp0uIcTjBx3RrY7KgkUGpSfa+cvtshke7pRtDP803oNlcus6P7DkqxVG9knAVXG4m+EvsIJhBheRvrgJaMPPvwTmYzQZKGQJhqEA2DKWl9e75E5JyDFeuZm3/JYBPPs0eK8ZR3EA+4+E2Mlue96mIEefq6qW+MYP1rxdbeALgTmGItno+XqJFPaTQkcGmaQH0izy5PO3UiXTCh/et4hGgqCkq0jI7HtUXvjZ0lPRQUKkg8vQInL89SBMttE3OY9BJdzF/AnJ8JOWBQ8oCCKjmreC+Ud5j4cO1CSu14MPlrRrCP+2kBGwGLd2wLwHN2U7hF4pQrf0zAG85GMuwP0PVAeoysfCXrCRdd3NHbLr+FO5456B68aHxMfbkGrh26n8KbjSTsVvA7r5RtTtSWyoMXfoTLGYct+9pqUTDCFSq+oP2rKeZErMp1sNvHFvZ7QWg+JFkVXxyvhL0UELRxZg7w55guJKQvhDgxZR5DDKRn6kwp+M1UjXF5i3kouWhwrZ7dbpn2xCcabojK+3kMa/4oEMc3RjZN5OkR31Jwe7n6H1IYcHmdItf0aeXjsk4nnxzItkLUlyKZhiansAZ2JA5SRCCiPllertdqR+UwpdnAg== 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)(376005)(1800799015);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: fZpYIJkRDIj/21RKddBd7xxuBr2r5a7AteQlqqgdYsCzIeEuHjmNt+cgJIY3Hv+XbVaTxiSPTlkK85dEvUHOpsAg3WYZwJLIJvU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jbx/kx2E9DauM2jTijdXmqnthLixGlXgGJ1isKOyfWf9ibtvpDHeATL96A8Rc= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0d335e1f-6f99-49cd-f604-08dc75992765 X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB5706.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 May 2024 11:13:03.3707 (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: mR9hUJJlbpjEeLRKaXy8UL7RTwzyzDp3fFSPvmdR1BQVEv7sfmO2tm+V+kEk5Vv6icNCnD3mHEF3Rvf3FMPeYw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB4345 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.650,FMLib:17.11.176.26 definitions=2024-05-16_05,2024-05-15_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxlogscore=999 mlxscore=0 spamscore=0 bulkscore=0 phishscore=0 malwarescore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2405010000 definitions=main-2405160080 X-Proofpoint-ORIG-GUID: 4oOY5z7L-s-6-KxnZ3KwUuWaextkFW6W X-Proofpoint-GUID: 4oOY5z7L-s-6-KxnZ3KwUuWaextkFW6W Fix coding style: rename the return variable to 'ret' in the function btrfs_recover_relocation instead of 'err'. Signed-off-by: Anand Jain --- v3: new fs/btrfs/relocation.c | 56 +++++++++++++++++++++---------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c index e24deb7f0504..ccaa359648ef 100644 --- a/fs/btrfs/relocation.c +++ b/fs/btrfs/relocation.c @@ -4222,7 +4222,7 @@ int btrfs_recover_relocation(struct btrfs_fs_info *fs_info) struct reloc_control *rc = NULL; struct btrfs_trans_handle *trans; int ret2; - int err = 0; + int ret = 0; path = btrfs_alloc_path(); if (!path) @@ -4234,16 +4234,16 @@ int btrfs_recover_relocation(struct btrfs_fs_info *fs_info) key.offset = (u64)-1; while (1) { - err = btrfs_search_slot(NULL, fs_info->tree_root, &key, + ret = btrfs_search_slot(NULL, fs_info->tree_root, &key, path, 0, 0); - if (err < 0) + if (ret < 0) goto out; - if (err > 0) { + if (ret > 0) { if (path->slots[0] == 0) break; path->slots[0]--; } - err = 0; + ret = 0; leaf = path->nodes[0]; btrfs_item_key_to_cpu(leaf, &key, path->slots[0]); btrfs_release_path(path); @@ -4254,7 +4254,7 @@ int btrfs_recover_relocation(struct btrfs_fs_info *fs_info) reloc_root = btrfs_read_tree_root(fs_info->tree_root, &key); if (IS_ERR(reloc_root)) { - err = PTR_ERR(reloc_root); + ret = PTR_ERR(reloc_root); goto out; } @@ -4265,13 +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)) { - err = PTR_ERR(fs_root); - if (err != -ENOENT) + ret = PTR_ERR(fs_root); + if (ret != -ENOENT) goto out; - err = mark_garbage_root(reloc_root); - if (err < 0) + ret = mark_garbage_root(reloc_root); + if (ret < 0) goto out; - err = 0; + ret = 0; } else { btrfs_put_root(fs_root); } @@ -4289,12 +4289,12 @@ int btrfs_recover_relocation(struct btrfs_fs_info *fs_info) rc = alloc_reloc_control(fs_info); if (!rc) { - err = -ENOMEM; + ret = -ENOMEM; goto out; } - err = reloc_chunk_start(fs_info); - if (err < 0) + ret = reloc_chunk_start(fs_info); + if (ret < 0) goto out_end; rc->extent_root = btrfs_extent_root(fs_info, 0); @@ -4303,7 +4303,7 @@ int btrfs_recover_relocation(struct btrfs_fs_info *fs_info) trans = btrfs_join_transaction(rc->extent_root); if (IS_ERR(trans)) { - err = PTR_ERR(trans); + ret = PTR_ERR(trans); goto out_unset; } @@ -4323,15 +4323,15 @@ 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)) { - err = PTR_ERR(fs_root); + ret = PTR_ERR(fs_root); list_add_tail(&reloc_root->root_list, &reloc_roots); btrfs_end_transaction(trans); goto out_unset; } - err = __add_reloc_root(reloc_root); - ASSERT(err != -EEXIST); - if (err) { + ret = __add_reloc_root(reloc_root); + ASSERT(ret != -EEXIST); + if (ret) { list_add_tail(&reloc_root->root_list, &reloc_roots); btrfs_put_root(fs_root); btrfs_end_transaction(trans); @@ -4341,8 +4341,8 @@ int btrfs_recover_relocation(struct btrfs_fs_info *fs_info) btrfs_put_root(fs_root); } - err = btrfs_commit_transaction(trans); - if (err) + ret = btrfs_commit_transaction(trans); + if (ret) goto out_unset; merge_reloc_roots(rc); @@ -4351,14 +4351,14 @@ int btrfs_recover_relocation(struct btrfs_fs_info *fs_info) trans = btrfs_join_transaction(rc->extent_root); if (IS_ERR(trans)) { - err = PTR_ERR(trans); + ret = PTR_ERR(trans); goto out_clean; } - err = btrfs_commit_transaction(trans); + ret = btrfs_commit_transaction(trans); out_clean: ret2 = clean_dirty_subvols(rc); - if (ret2 < 0 && !err) - err = ret2; + if (ret2 < 0 && !ret) + ret = ret2; out_unset: unset_reloc_control(rc); out_end: @@ -4369,14 +4369,14 @@ int btrfs_recover_relocation(struct btrfs_fs_info *fs_info) btrfs_free_path(path); - if (err == 0) { + if (ret == 0) { /* cleanup orphan inode in data relocation tree */ fs_root = btrfs_grab_root(fs_info->data_reloc_root); ASSERT(fs_root); - err = btrfs_orphan_cleanup(fs_root); + ret = btrfs_orphan_cleanup(fs_root); btrfs_put_root(fs_root); } - return err; + return ret; } /* From patchwork Thu May 16 11:12:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 13666006 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 97C92145354 for ; Thu, 16 May 2024 11:13:12 +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=1715857994; cv=fail; b=ghojBtteeGc0LWzsYTQOoqh5Menv4gTcVt8t/xFgs1csVOh8z7f/VWnpSK+Mny3zjKMPRaG0BcYBeg8hTqJWjrseBCRg4L2pHgqpFtymTPu27ukd/HNGH5KRvL0yS6OrbCsVcwdyNCTq8iVWNDu6d0XYhR/rIWUETMJx0k1LUIc= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715857994; c=relaxed/simple; bh=o6b7K3DThPHsX043p1yeNSnm2ba6ZdSNSZJ2xA1iJPg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=NARE5pIAwa/aO0fexaGtMs6CpnG4Je+wJwzF1tqFjmAfL26jyieyGtJ/wvVGzhrxH4Vk24y/xZ/lms4bqGNunumUIANP283hT766yZJW0LQirXY+ZtvwhoKGWVW/MKIDeGoY9J8BBhvw9yk3XYKOj4kAAXbmlYMOQVMe+kEVlWM= 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=ohgzraj+; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=e+KaN4gG; 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="ohgzraj+"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="e+KaN4gG" Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 44G9NTN3006682 for ; Thu, 16 May 2024 11:13:11 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=Zn77/r6A6x/37bZS5A1sARr355sPnVuIIdGpbfLak2U=; b=ohgzraj+ADOhixPCTDDM1v+k0B348GC93+6qvlsaVxCwriqFn3QxVzJ5UamiqNpwpceV M7Pwfm1GUiyCxgPgtb0GUbc5UmakWJnqt3xXJq8yBaVqfKn90k1MW4uMyKN5H5IVF6ho S4f/4DYh/BOHuzNt5Q7RM5VZvAUuFVj5g73rVPmr5s6lXzu5KsI+kFx4nQF8vNoydng6 V/ZRvwfmLnmH6g14naYbHImjlYSAsHUieLKodFvvVlppEbSDCFwzy7xQ49X+q0tiYgAD flKuNURRG7mkSnIuf/0Ih8XsFf+6cK4eBrIxy8Fn2Jep7jPz2yalBr3TbAaHZkfrJIP0 3w== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3y3rh7fbjg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 16 May 2024 11:13:11 +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 44GA9u15018835 for ; Thu, 16 May 2024 11:13:10 GMT Received: from nam02-dm3-obe.outbound.protection.outlook.com (mail-dm3nam02lp2041.outbound.protection.outlook.com [104.47.56.41]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3y1y4ad9d4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 16 May 2024 11:13:10 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XF1mvbV7g72weNLhzC1s8ovolKelZ6F1upAscFQRX/BWGzGKQwiGLQoXwBLdmv/UJbXwIwxlT1wF18s4EmoTVChlIKTTkdhl80SNf40yFa1N0ew+D+AtPPAa59gMhwZw2PGQCwl6cyH3i+AOc4iVrj2Q9WX9yinA7cg9/2IvV4xABnzpuZhMjLAxZqH39ttcnpNow3ieHs0eCiOt25Xz05+X+wUDAzMoIo0me8UUGQcMWaaEV3Z1kiD0+uX0/WWv3f6EQ9YfHVYIq2sINMAnHTGzdTZefAjzjW6FzkUSG3dQOzZ4PCrdWwW+f2/gR/BmdBcuLXTpLR0GEqh22czNeQ== 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=Zn77/r6A6x/37bZS5A1sARr355sPnVuIIdGpbfLak2U=; b=PM1vM8xOw+OJRPJ92UZX6ENHcYzKi1YaZin9b25cH+dCFvFDuvQ7dE5u+0i1AzUurTdmBLm1IaGUKImjLnE27zxIaN2vN0+MuIe2MLloEx7DMwmv2xWQW5dcq3sDCe/d58EhF1WKfjRezziojo4Ubv0LGQaJ4qVNn7xjJ5gi0r+O7qOwEel5DJNu8YJvhzgS5Pjw6noB0G6jg/AeTA9gf4LHQmawOQBcDfFa4bFElafQuFTL/hA+aRtQRvVmWXDFz3ZSi6xly9NTqupluwmlE86QYoMpR2crxCICd4Y9nnwE77KnKORN89pXC7LshlI2wcyGZDEvpoRNejKtHZx0GA== 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=Zn77/r6A6x/37bZS5A1sARr355sPnVuIIdGpbfLak2U=; b=e+KaN4gGXIfY8rn53CzIZfif4qCjcx2LpHryVoot0/kz9Wo+M6yolWeU7N9todVwCapP/x6s+TOoh4rhfSeDs5h6D7EO8SlcRuz3K0Rn0cG6pENnL6/o7hC4IWhsSVMIoquC3mTatuBk9KG+bxmk6XpSPNThgmsvlBTze5Vcwds= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by DM6PR10MB4345.namprd10.prod.outlook.com (2603:10b6:5:21a::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7587.28; Thu, 16 May 2024 11:13:08 +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; Thu, 16 May 2024 11:13:08 +0000 From: Anand Jain To: linux-btrfs@vger.kernel.org Cc: Anand Jain Subject: [PATCH v3 5/6] btrfs: btrfs_drop_snapshot optimize return variable Date: Thu, 16 May 2024 19:12:14 +0800 Message-ID: <7a99b67d236f7c98389f4e5b693014d59955a256.1715783315.git.anand.jain@oracle.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: References: X-ClientProxiedBy: SG2PR04CA0216.apcprd04.prod.outlook.com (2603:1096:4:187::18) 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_|DM6PR10MB4345:EE_ X-MS-Office365-Filtering-Correlation-Id: abf14ce2-51b0-4093-0707-08dc75992a78 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|366007|376005|1800799015; X-Microsoft-Antispam-Message-Info: pWeSUhhpyEzU9YjDMuOJaYGmKyaG7vdFuPZKrd50Rh7qrLd+pZ2AoaluWJ6meTb+jOAmN2Q0s+tjLzlGlbsNjLwR3kaJC70WPE1yDglwDzk9/bv9MIYBZG/PbIrVEA5TiQCEA7X7EAoOMJyRoxQIT0lZ9Ozg5vlF2KPNAdeJBP+2QXObp5ESZ8mrNfGYWjb+d2Ftpwuff0B5uBWnnvfEiWlrrJYdykDjtNvPjEm07t4eplbIrOX2YdV4qwCCVPB25BHWPPcGFor1eLb8XUAI2B6UZ0wyD6R8Cun75UgdEh8gpi21uldwqL+xTyuK0PiKBt2cOD9plVtkvFWA7QFVy+lvL67w8/1IarEYGDO8eNhFcUglkUDSug1rPQ916nq/jD55lD2u1GhjKx29qQzOX7N+a351Ab8iblrZ0dIp86lmda8tmK3z+24xur+IrCPT2c8v3BgbSEzfhdD3VsRxAXXLabMHIkvClWYIx9/r0TB6cyWlIYHhwajdH+hyUuCgIc0C2HhlY+ee/I0GCgPij91hCvruVGy5rGPgRmjW8VpZyosXmgEJz3Qo3mk5B4eSkiCyxpdFDyavkdN5O+0P6cvlZsTUE9nTl732/H1I6erGhRCKghwnUauxSfstYDJ3joWRMBkQa1M/z+0MK7FG+KNWFYaA/IsMMrcQKCUKL66/4L+MqNQe1dGF2Htod6oFrKPr/X8GZbSgOi65GPJmjN1DxifTQYwMkw6iUVeXIFEZIg+0zdaF14JY4jRjmkU0stIP/ePtpR8ATdAUHt16jI+eIl1g7rJYvo4XAznkvAGHxmPYjqJYWkR5puIN8gV9jI7rIXr/VCyKiwkLXB7bqUVFBVjs3Mz3WwakGRdRhHbXl4f1TMTpFIppYNnvXIuwWlxd3OUKbEidzxjNXMrWD4qBcVUB0sUjOWTalO6nQOHqV6kp1FzO/xqxVQV7hWy7diALzOXZt/5OA612uN2pnfPSRmsM3+5qqbeg6mDvuwBIOOO6s5GxWn9LrvLFGTEjVIMYckNo0vPCKZD4/227T5uhudteO4kJY88VTVDce7liFHT0623qDLLV+K32SztFUTb1a9PxbO0z7zBnyEklMQgrzG5MVllAKbYaQSbnxziSkIHYoCxiMxSNuTk4K+bIPxj6kBMhtgAUcqCes0F726mYGfW1yF3QABnWt0/UM40VEdTviHJ1qQroIJpvmohvEm5cB9boR7NXBtIfZhbYf7sGxpJ6vTtCqHWmlmDVXceInrXqb/tLeZPblthx9NYwjUcE8Uu1wkgxYh2yvWOe+Q== 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)(376005)(1800799015);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: UkGumxUSqOiJiLTwHz3dexXIiANSdXdwWw3z+5lEH3NcIjgvB6lS0dUmH34PK97ssOD93Yhdvt7IxjHasHDLj9id0i9I/v7YFpsn5wiylZwS3SZCMORc6gOaRPZz4fM0Lt+bnlTrAambwDZ7RygvkmXqFoVzzFA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ukkXDbNlI= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: abf14ce2-51b0-4093-0707-08dc75992a78 X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB5706.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 May 2024 11:13:08.5362 (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: WVBXKXIlXBQKH2o29w9Get5+XN/T1wRz5aDA/ZQv5mIwaKi++2a0W2AEqL0IhSuQjMVBjKx4maqx/d/a67943A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB4345 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.650,FMLib:17.11.176.26 definitions=2024-05-16_05,2024-05-15_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 mlxlogscore=999 adultscore=0 bulkscore=0 phishscore=0 suspectscore=0 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2405010000 definitions=main-2405160080 X-Proofpoint-ORIG-GUID: zE_4FyBFCoOwJedIPC1_5UVReqH_TjxH X-Proofpoint-GUID: zE_4FyBFCoOwJedIPC1_5UVReqH_TjxH Drop the variable 'err', reuse the variable 'ret' by reinitializing it to zero where necessary. Signed-off-by: Anand Jain --- v3: Fix comment formatting. v2: handle return error better, no need of original 'ret'. (Josef). fs/btrfs/extent-tree.c | 48 +++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 47d48233b592..578a0e2ec884 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -5833,8 +5833,7 @@ int btrfs_drop_snapshot(struct btrfs_root *root, int update_ref, int for_reloc) struct btrfs_root_item *root_item = &root->root_item; struct walk_control *wc; struct btrfs_key key; - int err = 0; - int ret; + int ret = 0; int level; bool root_dropped = false; bool unfinished_drop = false; @@ -5843,14 +5842,14 @@ int btrfs_drop_snapshot(struct btrfs_root *root, int update_ref, int for_reloc) path = btrfs_alloc_path(); if (!path) { - err = -ENOMEM; + ret = -ENOMEM; goto out; } wc = kzalloc(sizeof(*wc), GFP_NOFS); if (!wc) { btrfs_free_path(path); - err = -ENOMEM; + ret = -ENOMEM; goto out; } @@ -5863,12 +5862,12 @@ int btrfs_drop_snapshot(struct btrfs_root *root, int update_ref, int for_reloc) else trans = btrfs_start_transaction(tree_root, 0); if (IS_ERR(trans)) { - err = PTR_ERR(trans); + ret = PTR_ERR(trans); goto out_free; } - err = btrfs_run_delayed_items(trans); - if (err) + ret = btrfs_run_delayed_items(trans); + if (ret) goto out_end_trans; /* @@ -5899,11 +5898,11 @@ int btrfs_drop_snapshot(struct btrfs_root *root, int update_ref, int for_reloc) path->lowest_level = level; ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); path->lowest_level = 0; - if (ret < 0) { - err = ret; + if (ret < 0) goto out_end_trans; - } + WARN_ON(ret > 0); + ret = 0; /* * unlock our path, this is safe because only this @@ -5916,14 +5915,17 @@ int btrfs_drop_snapshot(struct btrfs_root *root, int update_ref, int for_reloc) btrfs_tree_lock(path->nodes[level]); path->locks[level] = BTRFS_WRITE_LOCK; + /* + * btrfs_lookup_extent_info() returns 0 for success, + * or < 0 for error. + */ ret = btrfs_lookup_extent_info(trans, fs_info, path->nodes[level]->start, level, 1, &wc->refs[level], &wc->flags[level], NULL); - if (ret < 0) { - err = ret; + if (ret < 0) goto out_end_trans; - } + BUG_ON(wc->refs[level] == 0); if (level == btrfs_root_drop_level(root_item)) @@ -5949,19 +5951,18 @@ int btrfs_drop_snapshot(struct btrfs_root *root, int update_ref, int for_reloc) ret = walk_down_tree(trans, root, path, wc); if (ret < 0) { btrfs_abort_transaction(trans, ret); - err = ret; break; } ret = walk_up_tree(trans, root, path, wc, BTRFS_MAX_LEVEL); if (ret < 0) { btrfs_abort_transaction(trans, ret); - err = ret; break; } if (ret > 0) { BUG_ON(wc->stage != DROP_REFERENCE); + ret = 0; break; } @@ -5983,7 +5984,6 @@ int btrfs_drop_snapshot(struct btrfs_root *root, int update_ref, int for_reloc) root_item); if (ret) { btrfs_abort_transaction(trans, ret); - err = ret; goto out_end_trans; } @@ -5994,7 +5994,7 @@ int btrfs_drop_snapshot(struct btrfs_root *root, int update_ref, int for_reloc) if (!for_reloc && btrfs_need_cleaner_sleep(fs_info)) { btrfs_debug(fs_info, "drop snapshot early exit"); - err = -EAGAIN; + ret = -EAGAIN; goto out_free; } @@ -6008,19 +6008,18 @@ int btrfs_drop_snapshot(struct btrfs_root *root, int update_ref, int for_reloc) else trans = btrfs_start_transaction(tree_root, 0); if (IS_ERR(trans)) { - err = PTR_ERR(trans); + ret = PTR_ERR(trans); goto out_free; } } } btrfs_release_path(path); - if (err) + if (ret) goto out_end_trans; ret = btrfs_del_root(trans, &root->root_key); if (ret) { btrfs_abort_transaction(trans, ret); - err = ret; goto out_end_trans; } @@ -6029,10 +6028,11 @@ int btrfs_drop_snapshot(struct btrfs_root *root, int update_ref, int for_reloc) NULL, NULL); if (ret < 0) { btrfs_abort_transaction(trans, ret); - err = ret; goto out_end_trans; } else if (ret > 0) { - /* if we fail to delete the orphan item this time + ret = 0; + /* + * If we fail to delete the orphan item this time * around, it'll get picked up the next time. * * The most common failure here is just -ENOENT. @@ -6067,7 +6067,7 @@ int btrfs_drop_snapshot(struct btrfs_root *root, int update_ref, int for_reloc) * We were an unfinished drop root, check to see if there are any * pending, and if not clear and wake up any waiters. */ - if (!err && unfinished_drop) + if (!ret && unfinished_drop) btrfs_maybe_wake_unfinished_drop(fs_info); /* @@ -6079,7 +6079,7 @@ int btrfs_drop_snapshot(struct btrfs_root *root, int update_ref, int for_reloc) */ if (!for_reloc && !root_dropped) btrfs_add_dead_root(root); - return err; + return ret; } /* From patchwork Thu May 16 11:12:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 13666007 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.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 413FB14534F for ; Thu, 16 May 2024 11:13:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.165.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715858000; cv=fail; b=d7nGplhTDVxV49Srat2H99kyP+T4mbi7p/aCEPZZcUYvBCLZYfh0pKU6Toh5TqD9UDGusUcdRMJHRYtbu+bixoulhBVbQY5Nt+KAKLhlPDpIto4zODhIYgiGr4VNU/sQ5g4B0s93znrGvHa4MoCY5YwaIAIIhDe/szhnijAUAKE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715858000; c=relaxed/simple; bh=LyA79a7QPRdSNA9/t8eW4S6K6J5jzKGyXlMLNgsmxFI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=b8eCaVIF/5Kc5OKDViU9TE7+JLEw3p0SPMf7RIwij8q5qGCzTrXaI0GV6zR2thxnBvbO8GL78blxzbssulwiGSuFwNGXuvNPYzK3vWh8sXW76f/oh8ulmyXF1BiqNq4JWb7CSR2PSNkerJ7E4hJn4MB87p0cEv76eBTqe5yfd7w= 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=NAzKlsO2; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=X1MNuXRK; arc=fail smtp.client-ip=205.220.165.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="NAzKlsO2"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="X1MNuXRK" Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 44G9mf46001501 for ; Thu, 16 May 2024 11:13:18 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=miSj5111mFR1+BnYbMZ+zfwuteooPL/1JsjHDM8KdeA=; b=NAzKlsO2F7gJjnoYhaks/uxnFNg2D6Fvt/SWUPHR4pbM/PjmKU0yB+1bMUvXG7wHOUtN f0dykyOd7S4hSEqThzKqLuxpgfcitdW2dWB5owurrztvaw4goy6cZKgjH1r2LkZ7hN5r 6FYKin97+p7DlJy5dxMjqywOHGBA6vXfj2TrZbFVE8XVZlRbnwSB4zkD3WUTAPEiu/Wo geBZiLEzRgzGiGh25Bbyw+HLMjAhgvV/Boztnh50BCP3mpmXA6SvIapt7Bo6dDNX5xSM yAIdad/MYOhjlWRNHfryDatLSkuU2qG3H7wY50luB2FGBGAG5CZyz07WeinVAfr2DBzG Sw== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3y3srrwaf1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 16 May 2024 11:13:18 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 44GBBYG0019247 for ; Thu, 16 May 2024 11:13:16 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2168.outbound.protection.outlook.com [104.47.57.168]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3y3r87m0x2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 16 May 2024 11:13:16 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bUPojnMpLL7gPk0eH7ntwg/dtFS0x+cI4Rum9zrHi/SFQZvReCntfM9TddowH2isI2Ft53t/tOlsXQKjxx+hX20I1XEfLgc9Gz4D4Onf7Yy2x60/8fwehmGCLuOLVzWY+o5G14BATCOrGVOGP75ZCM8TM2pgHqRV6WumObv5DQyR3DycCbXav5ij+JP4PkNlAw8y3eMzhGZO3ZTRhgqTzNoW0+CfLQ6w/S0UJfNEm+dTVIar/iemDpuSM7PE0d2Mb10TQte2epR6Gjsqzjf6vQXG/zus4htLeJrGc7pfe02DybGGJoqCH2V3WjyVXbONKFVD6bO20sFaiSoJVZ4Sqg== 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=miSj5111mFR1+BnYbMZ+zfwuteooPL/1JsjHDM8KdeA=; b=bseLRHvJRo30wEIpWT2Xah0Ximw5JPMVDj6RugVk65/6H796HW/K2iMQJmIntynpchYXnloaI+vJDZ9mbywXfFwgD1X6FHRwbe7eKbhLO0WIiESgVBHH6qLRyTZguwfEiYr5f42srMKU11p9jczCkPxGXKzUYaRZnRgbHL136vmgeWSknRoB4yYBAJh9y9Vwo7dbW6/obFpjVdKi3Grp8l2l40QWyK6nnL9WPajAfNllI7Qn9VyXrGBLn7t+iXkFO29DeBr9GA5DaPpLhYCFMaX/vKiopMgaFU9O1ffK2Oh/TtIVLcm+21VEh1da+FpoaIjp3LFDWAAJCTWx8BviyQ== 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=miSj5111mFR1+BnYbMZ+zfwuteooPL/1JsjHDM8KdeA=; b=X1MNuXRKzF63H4Kz5tEuKTykyisAeKvNJl5vh5DDb1JVoThB7tRcaksFogJxt04RamLQ8RFTj2Gcr8GzRjo+d1O9nQBdiwFL+qhRlxbAYriCIHByghh2QuZUHCqubhMqBg00ZWrxPaiaYCzxpBMwDc7tkHzNZzguXRqiKE/NDlM= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by DM6PR10MB4345.namprd10.prod.outlook.com (2603:10b6:5:21a::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7587.28; Thu, 16 May 2024 11:13:15 +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; Thu, 16 May 2024 11:13:15 +0000 From: Anand Jain To: linux-btrfs@vger.kernel.org Cc: Anand Jain Subject: [PATCH v3 6/6] btrfs: rename and optimize return variable in btrfs_find_orphan_roots Date: Thu, 16 May 2024 19:12:15 +0800 Message-ID: <7b9f87e3ca3368648e9df1d124161a6d4b8e1e9a.1715783315.git.anand.jain@oracle.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: References: X-ClientProxiedBy: SG2P153CA0015.APCP153.PROD.OUTLOOK.COM (2603:1096::25) 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_|DM6PR10MB4345:EE_ X-MS-Office365-Filtering-Correlation-Id: 97a4c2ab-fdaa-4287-4f19-08dc75992e64 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|366007|376005|1800799015; X-Microsoft-Antispam-Message-Info: fN0e25SPeNTlCe45AvWmBRjD6dsFEbDJ0R1+2h/nBwEvOf4+6CCR+CP8M5fOiJDZgT959uNvSNeIk4Kn4E72EZjuUWDA1VwtklTP4qmRvJFYCHHTD5UPaxi1jPFzcFGtDyFS9CYtc0fcuZzzPp9D96FJYvW7LBbdvqisn88WTUUHRtoEx8xWHj4YdJbzo2VqPyVvc+mp1ySqDx9EdZK4Q6sP8qxkSC42yA3fsgQpaHTwWEi7AYL1csIPjFfeyOi3a6SOD74vM5jrbdKbA+MWMRu2VZivirdof19dRHzhzYcCRs5lUYAeOcYSnomgG74/qELP44rPjT3KHR/E4oJoimNvVZuTnso09zoLlUSIc2A8DBlJ4ciOXP2iNyerWC7VMASEiUkbTPQGR9w9bj4x8Y77O6A4V2oJWeNdWGIYr5Ii1QzKZhpTFf6HYOpX/Ywxpd5mr6JlDI/Jw72UAAhTaX6qJRHDI/zVShF8YhhFKL+rZxtiO+JBPxsnbKwH7f5xNQtkmAWjHV6qQT+7PcdR4Bqz1kCBK5Xa2uhN87mkNYOBxmMLU5MRyn2y6tM6lFnAZ4o7fTHXx2FdvXD08Xlb7TH65Q0Husq8B5sWEM11PZ8r3FFOXke1BI0JYZ/TYQjRzCjoSIGO9J2eaZ602T7H+Bgpq1w4ogmYLQnGU6mJFRywTTRtrwuav7yKr/b66LUUyu/v15TcT+G90F1BiO/MkGNmfuhV7VqXalg4QVgwzL0UB3jfh/cvnQtrGHFCr8r6uFv/eizVITwxYGqIZmLOq3kDAg7VIMZgjKMYAtnfKtlzF9TsViZDuH5sqF2laA+6LNlshnVYCPVCA9sHGf/GLi/3MKt61N80TZY/3BmZprGNh2QCjDLaf9r6+RtvVPqEoO3ZrBJoxi15UwunqCZprTKGiYoHancXgc2pigD3ApPtaYyl8omSmrFqFSGwflQzHFjQiuIJNWi4psL7SBgs38LxeloaZwwQlmAYU+uEPdb8xf0j1czw69SlnBD2v6GJ8N3ytOQJu9adH3YkKkSLmZecxUoFEyiMKmTkcnDUn3kMWIeV6trD1Rbxf2b4eWYLvaEZ9+XJfmf/Cj4FXsVRWgc++ZV1VYvwNVhDrQ9ADeNQ2VBir7CtnvNtItIovLJC26tXo+p9aC9uKSa4bRWhjoqgLW62FLwSb2qS+Cb+TYCLykiDDIElhdU7ySw0M6fz+d4ltdUYipXQ4lHSa3aRUHNN1knj9c4fh0XOvTd2fGePkIJURzkeuvuuTlA8ROYpCIstnUu0SjZkQFfFPpb9Vw== 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)(376005)(1800799015);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Alyrpxzh0RVXUgTTWgqgxQWwd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9re3b2bVwFrKrJLF75t+kQoeBmO0Dw3+fC+RDaGsXTd/pCHwfxSrRvXgUWORNT7e9gIEAygiLGU8qJu4wQL2dy/7XylPK18lAhX+jVoSM7jcH270HcIODX1MP6zus/kI5zLrFIgnYZ0NpVY= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 97a4c2ab-fdaa-4287-4f19-08dc75992e64 X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB5706.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 May 2024 11:13:14.9762 (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: nmL4+WcJs6K5M3OVdV/kZ1kNvlhUbj8PLk2gzKhzC/TEVr6+7wrGEvfjqpIgDUHk/F4JO6keMr0VEyfI+QgzNA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB4345 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.650,FMLib:17.11.176.26 definitions=2024-05-16_05,2024-05-15_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 bulkscore=0 mlxlogscore=999 spamscore=0 suspectscore=0 mlxscore=0 malwarescore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2405010000 definitions=main-2405160080 X-Proofpoint-ORIG-GUID: XpK2VSGM2XmsV3unH5nIv3XC2AxpkArm X-Proofpoint-GUID: XpK2VSGM2XmsV3unH5nIv3XC2AxpkArm The variable err is the actual return value of this function, and the variable ret is a helper variable for err, which actually is not needed and can be handled just by err, which is renamed to ret. Signed-off-by: Anand Jain --- v3: drop ret2 as there is no need for it. v2: n/a fs/btrfs/root-tree.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/fs/btrfs/root-tree.c b/fs/btrfs/root-tree.c index 33962671a96c..c11b0bccf513 100644 --- a/fs/btrfs/root-tree.c +++ b/fs/btrfs/root-tree.c @@ -220,8 +220,7 @@ int btrfs_find_orphan_roots(struct btrfs_fs_info *fs_info) struct btrfs_path *path; struct btrfs_key key; struct btrfs_root *root; - int err = 0; - int ret; + int ret = 0; path = btrfs_alloc_path(); if (!path) @@ -235,18 +234,19 @@ int btrfs_find_orphan_roots(struct btrfs_fs_info *fs_info) u64 root_objectid; ret = btrfs_search_slot(NULL, tree_root, &key, path, 0, 0); - if (ret < 0) { - err = ret; + if (ret < 0) break; - } + ret = 0; leaf = path->nodes[0]; if (path->slots[0] >= btrfs_header_nritems(leaf)) { ret = btrfs_next_leaf(tree_root, path); if (ret < 0) - err = ret; - if (ret != 0) break; + if (ret > 0) { + ret = 0; + break; + } leaf = path->nodes[0]; } @@ -261,26 +261,26 @@ int btrfs_find_orphan_roots(struct btrfs_fs_info *fs_info) key.offset++; root = btrfs_get_fs_root(fs_info, root_objectid, false); - err = PTR_ERR_OR_ZERO(root); - if (err && err != -ENOENT) { + ret = PTR_ERR_OR_ZERO(root); + if (ret && ret != -ENOENT) { break; - } else if (err == -ENOENT) { + } else if (ret == -ENOENT) { struct btrfs_trans_handle *trans; btrfs_release_path(path); trans = btrfs_join_transaction(tree_root); if (IS_ERR(trans)) { - err = PTR_ERR(trans); - btrfs_handle_fs_error(fs_info, err, + ret = PTR_ERR(trans); + btrfs_handle_fs_error(fs_info, ret, "Failed to start trans to delete orphan item"); break; } - err = btrfs_del_orphan_item(trans, tree_root, + ret = btrfs_del_orphan_item(trans, tree_root, root_objectid); btrfs_end_transaction(trans); - if (err) { - btrfs_handle_fs_error(fs_info, err, + if (ret) { + btrfs_handle_fs_error(fs_info, ret, "Failed to delete root orphan item"); break; } @@ -311,7 +311,7 @@ int btrfs_find_orphan_roots(struct btrfs_fs_info *fs_info) } btrfs_free_path(path); - return err; + return ret; } /* drop the root item for 'key' from the tree root */