From patchwork Tue Feb 21 07:34:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yuezhang.Mo@sony.com" X-Patchwork-Id: 13147439 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 677A5C61DA3 for ; Tue, 21 Feb 2023 07:34:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229545AbjBUHex (ORCPT ); Tue, 21 Feb 2023 02:34:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34638 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232650AbjBUHev (ORCPT ); Tue, 21 Feb 2023 02:34:51 -0500 Received: from mx08-001d1705.pphosted.com (mx08-001d1705.pphosted.com [185.183.30.70]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D09FF233E1 for ; Mon, 20 Feb 2023 23:34:50 -0800 (PST) Received: from pps.filterd (m0209320.ppops.net [127.0.0.1]) by mx08-001d1705.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 31L4uH2v019482; Tue, 21 Feb 2023 07:34:40 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sony.com; h=from : to : cc : subject : date : message-id : content-type : content-transfer-encoding : mime-version; s=S1; bh=5P/jDAqF3xaPT7piuideXCRyzLQddmdgCWbXY5mpjsg=; b=LGi6scSpI+I1QbtChDU9hbZ1MzIRwJLeNgeqvXjD4PyRYVxOujXa6mddGp28z5B9E8Rk vhTcDzHDNPgpt51NkprF/cUIYCheLMDeqaTP1XmU9q71TAcUAtSSA2Van/0uFQXpNy/F ShgSXWDRpYbviFIPNP+abzeBIgoESZVj46cWE9J/Q4k4JwWJAf69kalwT0a+stVQc7E1 leSiqztAIGyNNDSpJAlvk9Z4QDleKJAAuJAE20n7tB96zatNfw5HG94m10zvXfFeNPIp SfUzWJ5E7uxq4UPIslywkcmkzHi2PbQzSLCAMmFxzxH1y09ANDcGs3pEqFZQ2OI5+SE8 5w== Received: from apc01-tyz-obe.outbound.protection.outlook.com (mail-tyzapc01lp2048.outbound.protection.outlook.com [104.47.110.48]) by mx08-001d1705.pphosted.com (PPS) with ESMTPS id 3ntmjn2vem-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 21 Feb 2023 07:34:40 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kSIGYdYMYbArPUNhCaUkU8bBaYxBlfaVRc7+xds5rNGqh4tzb2OVBBqloFaknRqSJOFEulZTAgQc5Fyqr+9b1IEnu7K6K6sf1vMze+cSVFHsZZJJNxBXBzSfUf36sTmwYoXycU25RK25B6Q8ng49GSpWitFNOrS9mzzgysvMBqACfLGuL+hbqKt9GL9OpJOW9bDdLiiM1Ivpm2kXnF9ScRA2ducvY9DMQM8W4ARE2coy0cypW2w8JOnoPfxk/wS7zd1bUFFDrpgrkbVSUgdCMkbFKT/AJ60SYGnirMajHypJS5wd9fTNS31Lot2n57MhgL3kQN67mLX0sux6JK95WQ== 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=5P/jDAqF3xaPT7piuideXCRyzLQddmdgCWbXY5mpjsg=; b=WQrVCID0al65xPKosYllvy5fBJz31FbJRWyhCgZxFKH+jDciQ7pAWBha2hvN6TfF3wWo5TCtw+TePt/8BAiQQ3Sy5pRAvqlvCarS6wm6gny18P29DZKk9eQuPCivPeMkar6DWAyKAQYEAnactpvEfkDEA9OlXU7IooV36DfTiwe/DH7dysOllSonr02k2FCVr+yixvZdB8sgCQj2NT8uUDKqX6lYtm7wwnl9+amLGRvkKJ3c95pJFmwdIOaVIj4E/gj8yhN7ZdLzNSre2AbIfZppoLCdLltv8CM+Bc5GVqXJzS8RSEXdDePYYaOgJiN7fSZKis7B5nzctFZtr+gCZQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=sony.com; dmarc=pass action=none header.from=sony.com; dkim=pass header.d=sony.com; arc=none Received: from PUZPR04MB6316.apcprd04.prod.outlook.com (2603:1096:301:fc::7) by PSAPR04MB4165.apcprd04.prod.outlook.com (2603:1096:301:34::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6111.21; Tue, 21 Feb 2023 07:34:35 +0000 Received: from PUZPR04MB6316.apcprd04.prod.outlook.com ([fe80::779:3520:dde5:4941]) by PUZPR04MB6316.apcprd04.prod.outlook.com ([fe80::779:3520:dde5:4941%7]) with mapi id 15.20.6111.020; Tue, 21 Feb 2023 07:34:35 +0000 From: "Yuezhang.Mo@sony.com" To: "linkinjeon@kernel.org" , "sj1557.seo@samsung.com" CC: "linux-fsdevel@vger.kernel.org" , "Andy.Wu@sony.com" , "Wataru.Aoyama@sony.com" Subject: [PATCH 1/3] exfat: remove unneeded code from exfat_alloc_cluster() Thread-Topic: [PATCH 1/3] exfat: remove unneeded code from exfat_alloc_cluster() Thread-Index: AdlFxb0R0myNhmzvSuqdhLs/CmEyKw== Date: Tue, 21 Feb 2023 07:34:35 +0000 Message-ID: Accept-Language: zh-CN, en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: PUZPR04MB6316:EE_|PSAPR04MB4165:EE_ x-ms-office365-filtering-correlation-id: 0023a39a-d1e4-426b-5bcf-08db13de14a8 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: EZhrU+sKQC0R49I6SrzvMugICUcCfiApBZhDQzfBtb/7SahQcwhbpPTPKf/IxaGwGpIdywpGoYiNQlUR3CA6AA58wv1/JI4NC++otGj/e5E+q3Dd43DBH5vfYa06kodIKdVmOfw+RXu+Ne8wy2vA/n2y8tmUv+9S1LoZJo9get80cN3bSAZ4ZfwMEdXu7fSswy/a69hcmRD0lUFMMeCVPDSD0AtYH/w85JFu6LfkxP6j6dtURsJCnvIZLZYzmptkZngV1RxiEGvtAtwHzGkg7sWSDKWsSpu/RtSC7jLgQ4SetdgIlMK4rB4fMbeS3mR9Tfd07fZtUuw8kXoQ/PvzGh3WQTNnd96INM1ewEkmKmgKskzo8YX3U9GKCeHrqmDPz9HB0QxeT7nOwBoYfPa41UlM2DmoIayh2oAcnDLwDT2s6I0pbouNV2bjPjIBJU6yY6jfUnWEgdFdeJKMvnCZXebxhnlqouhpe6VLjY2ptbMtnFYmNl8qUaRdmOMbD7+Kl0q7LU4yGfbLfDZRlrGc5NMaTgs6v57MOL51WzNu3HEze6xNm5KV0pHrCTQsevFiJUr+LgbVzaNdp3qkmH4gVz575jErCt9UMKRnDjEi/8BZaqAIJaZQmCIfAyUqr1Ontz9P0IQlkHG8Khj667vYYEYm3xoKa0PfMNX3E19IyAlw6M7XtK+EGm3XWDhrtWZu x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PUZPR04MB6316.apcprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(4636009)(136003)(376002)(366004)(39860400002)(396003)(346002)(451199018)(82960400001)(122000001)(38100700002)(4744005)(83380400001)(86362001)(316002)(54906003)(8936002)(5660300002)(64756008)(66476007)(8676002)(4326008)(110136005)(55016003)(41300700001)(478600001)(38070700005)(107886003)(33656002)(7696005)(76116006)(66946007)(2906002)(71200400001)(66556008)(66446008)(52536014)(9686003)(186003)(6506007)(26005);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?q?yqZvtlEVB6oykvu8D3wdYtEGWiZq?= =?utf-8?q?YtfDEjsFM7hORh0Ow3PIdrKBh3YLmWH9S4cQ4PS+Ma7NuSYBvE4tqWMzFUbQ98x2K?= =?utf-8?q?lpTNElkUQwoi2BTxpwtUupDlfiIcaOMpkqFXPlidb1MVXvFbj7MQU6z5VJylP8QHE?= =?utf-8?q?fCboUMDDp3OfTnzT0dIgbsUaELSRN+53q+4M4ppuO/AjvJHALOtcYFiUaNYlTuEjm?= =?utf-8?q?0KEz7gxM8uJqAtnefJclX26f6JnuMtEgZFSweFnEmn3pPS/6E3dJAewZw1Hwy7W8T?= =?utf-8?q?KVcYB/VMdLBJ37nGTOntYl9gBROgimH6xWqBhupF7VZ0XenrsIyDKpsnnsjT7Suuv?= =?utf-8?q?/xoqDbhTMC5swQd5ZS8jK1+CQAVLY2KYxI6rVCSRd7NqNQytFipAScLuZMMif/0tt?= =?utf-8?q?liO19rZLORNafTKFCPecfYpnMmHvj3u5Cr+g8FxFleq+wZ5ntmtG0+bo+twtIFaC5?= =?utf-8?q?Sby6+hYT/IHrxByRx8XUSBeDmBCEh/c83Ohe3wfSImx/urexozlBhkq2iAY9PjyY6?= =?utf-8?q?Ez/E1rsccGKh+B74HkHboFBam4rNfeJZ6uBpxdzmVMzxdScT8Zd3B/O7IGHOFMhcT?= =?utf-8?q?4xAXHtQTIaMAU1UsUP1Ulwh5SwaDyhZC1A9bXTg/WofnB6pcnk5AbPfF6BKf2ObU0?= =?utf-8?q?BlarNvRmVDdfqvj2Gz6jbvmK3QfvXJKqPvuAu/O+XRiYGNJyxJ78DzJIfOclh3uZD?= =?utf-8?q?CJoGsgfKtgt6IPGblZS5Wp7lFcLoBlpxsH/88SDdbKrUk6bkwQIO09AuXo5l/59bQ?= =?utf-8?q?lT72q+TF16+HhflRQY3aifTeoFs7GXYGwUVm79vg1BRBK32/JwedK5nmimenCwSja?= =?utf-8?q?V3Oq0VStn9kUShRqk708lLnxymU9aUIK8BSoCJDwIHgLXjiDupVg/+AMCXf7CVyT2?= =?utf-8?q?HYmQH+Tw/YzhpkCh+xSOqejGkRaY2enDTyhJ5BgXGsLupGimObEYEiFqcK0YPcmKe?= =?utf-8?q?c7RzgqPGehJGXwpoF115lwY83OxJOEFdyB66UBYXj69/opd2w5YMzCDt4PufX9q1B?= =?utf-8?q?NEiE+JwkLS1NpH8Bc7QqGWO4JVcN1d78yPWClD5bw1cDD0kVSesvI6znLBNMb6/56?= =?utf-8?q?rADA0RGxw2UDzGZGXGR1z3eQGweHWQ9ZYSOq32PAjFg3/lYC4YJTEF/l2amVHgZ/1?= =?utf-8?q?0iOK8LGWVFrZV2+Q5Vx0VfqK+/Ox9nswasOkVudQh6PmNg3RaP/H8imZ543vfh7jS?= =?utf-8?q?JrONFTNEmz1kGliY1G0DVYfqSAakQmeLAcCu9T8mcWDGJ/a3flhN7F3e617Mj6c7s?= =?utf-8?q?/xQ8IkmJvGKb7V9IHOAwCSSJfdGChERm9lJBXGmyy0Ia7yKHbiyoldmTjbe7RK63A?= =?utf-8?q?1rl7z07waENjA+iDOBtbMw+61URlAwFCVPVdXrp+P6ag/mmUMAR7/FzqgpnIe9GVJ?= =?utf-8?q?+aIEAfsxJCr+HHpHGpKtKIqxJiQNqi1UTiHkkznkhjPIR6DKNrBemlPRmhAlsrRoV?= =?utf-8?q?bBsHamdr5z73Q8n70AaIKNO5eJ2SNJ1MBbx2tRh6GZQX8NwYOya3O/JHLOVNx92w+?= =?utf-8?q?1ybsmqymZit2?= MIME-Version: 1.0 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: K54O1Ry84Yz3y1OdoHI7Uaw3j8dD/TlZTg9RmChmmhRgZYmssPNxxaMcFdWIJgFlIZ9eaYhGtgHiHwBIrlidWYiLYwnJB14zxAwAWYQ3sROaM6LSVeN17QtDpn67NGathnZxyJ0UwQf7uJEa9tJqLOypyyBbe3Kp4ALAErr1bxshb64o7pwUy9iThHJ8Y1sGQSITKAoB4W/nUmg5epD1ALXPa2XCqm4oJ3HbsA9QcvKG70JDYVyr5l1JJ6wPzOVXKO6t4p2IQNyZRg887+ghEZTNv1C5nRFHqQVoND9AQeZzaqh5pU5vVpUG4nZO0yIWP1fSNmGw9Ei4u4YbdG7fqPG95y72FgxmWbK2N48+aezpdNckCr161kQp8AGI6sh1pX3DTm66XG1ZyMnFSMwRcmkSxD2U06GcSY8ryrdIAeMB3tLNmTbZ1v5pNnFTW8Pohn7q7GhZ4US6mv+YXtBaCsW/v3tJAeWor2zuwJ2ANuHXsk5BzJa7MiUpkF4l5a67wNh9b4pZ5WJQMe/bvO8Ps3dTx3RMf3/nyZXAI8l1Vxt6SgzZORLkRPoi7soEHmCxSAcZfDmlxGVzjBYTJEcdkJHyS9fYa74HkwJBOgdToEtE9XzxPaNTU+b32i/Fr52/zDHgY8hilHN97Ve9REuDK6GvUGZ+1L+j7UUXhrLARwbbq4et6lI8ao9cUBqILRqXYmbI/r2jU2spyDicx0U6g8+Xn6NuwP59BbB9x8kmDFthlzM4nCXxrtW4t3q27xgI9qJRGRhdpVkVxsQArNWOEMfj+SOYoBNSPkUwOOhTmh9AY5EpzuSTsiv2If8pkmzQIlobIjMqsiFTo/FZo6bdfQ== X-OriginatorOrg: sony.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PUZPR04MB6316.apcprd04.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0023a39a-d1e4-426b-5bcf-08db13de14a8 X-MS-Exchange-CrossTenant-originalarrivaltime: 21 Feb 2023 07:34:35.2990 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 66c65d8a-9158-4521-a2d8-664963db48e4 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 1R2FEY/D94yYROxk4vsyfNXSgLH0jGS5THhuoJpYoUuXbNLY4u6OVw9WkFkYHl3Ufo32gN4Ru3H7d74gbnhvvA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PSAPR04MB4165 X-Proofpoint-GUID: xguHjfrFbEDHgT5h3eD0LAofx2tonPva X-Proofpoint-ORIG-GUID: xguHjfrFbEDHgT5h3eD0LAofx2tonPva X-Sony-Outbound-GUID: xguHjfrFbEDHgT5h3eD0LAofx2tonPva X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.170.22 definitions=2023-02-21_04,2023-02-20_02,2023-02-09_01 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org In the removed code, num_clusters is 0, nothing is done in exfat_chain_cont_cluster(), so it is unneeded, remove it. Signed-off-by: Yuezhang Mo Reviewed-by: Andy Wu --- fs/exfat/fatent.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/fs/exfat/fatent.c b/fs/exfat/fatent.c index 41ae4cce1f42..65a8c9fb072c 100644 --- a/fs/exfat/fatent.c +++ b/fs/exfat/fatent.c @@ -347,14 +347,7 @@ int exfat_alloc_cluster(struct inode *inode, unsigned int num_alloc, exfat_err(sb, "hint_cluster is invalid (%u)", hint_clu); hint_clu = EXFAT_FIRST_CLUSTER; - if (p_chain->flags == ALLOC_NO_FAT_CHAIN) { - if (exfat_chain_cont_cluster(sb, p_chain->dir, - num_clusters)) { - ret = -EIO; - goto unlock; - } - p_chain->flags = ALLOC_FAT_CHAIN; - } + p_chain->flags = ALLOC_FAT_CHAIN; } p_chain->dir = EXFAT_EOF_CLUSTER; From patchwork Tue Feb 21 07:34:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yuezhang.Mo@sony.com" X-Patchwork-Id: 13147440 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DDF38C61DA3 for ; Tue, 21 Feb 2023 07:35:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233657AbjBUHfD (ORCPT ); Tue, 21 Feb 2023 02:35:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34758 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232650AbjBUHe7 (ORCPT ); Tue, 21 Feb 2023 02:34:59 -0500 Received: from mx08-001d1705.pphosted.com (mx08-001d1705.pphosted.com [185.183.30.70]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D58B823302 for ; Mon, 20 Feb 2023 23:34:58 -0800 (PST) Received: from pps.filterd (m0209319.ppops.net [127.0.0.1]) by mx08-001d1705.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 31L6rl2Q003747; Tue, 21 Feb 2023 07:34:49 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sony.com; h=from : to : cc : subject : date : message-id : content-type : content-transfer-encoding : mime-version; s=S1; bh=c1cMvyK3NSTnm5NRLqdZRfYYSZ/wK6CedQmmoBPGvt8=; b=dsv8e4nbs3uhWsBxWvm/0TWfuvMyhL2G+/XnMIeEx6vd+tvHTYMFl7E7dmrSAT7PkW9A gkK0cRWROCgJHlVdPg9o4t6Ij9U7RnFXa3+Rp7VIXzxEcJM3slOgcrQrMcg39F6VIfXz wT7mKMw6xVLnuw/wI4XW33oKXuUlnWAdo7vGxenIUI6LFqlzE6svwI4ts55Vb2tNWQ+u b/rjjnU4maE3GKXSmmC9XnQkgDs/ID+Ueub1oJIusJdW7uTNjC7SDfUGQV2zpznROq6S cZVII8d2Qm9jUJhZSwfuwIQNL7wrlXWiQu0wMiN2aaka81bZwhqKN7mhGbrFIeOrRecZ /w== Received: from apc01-tyz-obe.outbound.protection.outlook.com (mail-tyzapc01lp2046.outbound.protection.outlook.com [104.47.110.46]) by mx08-001d1705.pphosted.com (PPS) with ESMTPS id 3ntq2sttb1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 21 Feb 2023 07:34:48 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KtP77k00/0T3XI3B8GAVKXHvxWgWQbCX5K9Lw/iEUuck8ML3FwfmnrYC1wf0OFDK4zPjg//RX2R8JV6wNolcBNcylvcde5v48lhZpuFDFivsLD1vHfgUu+g6VZ3O5TpqJVuxY2dZ5qZDTZvnxTwSfV2N5VLbQzV1ivO/Re6KGn0I4GHSaGI/oaN0HQyk9moFvAxWToKSDUEQCIASs5f8lrnGiT35y0LI+Kg4Ml5hMn8mwaEjYh+XNJlBdsjVTNxE95hf7hLWP5H6dQRtt/DZrwyEcNqctk3hxbBaR3gXew3akhPYiQUuoP/EriW+07jPb0xytvKtPNY0BbXQa8ge0w== 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=c1cMvyK3NSTnm5NRLqdZRfYYSZ/wK6CedQmmoBPGvt8=; b=GcxkF9eeih1IdLTkVo+Yvx378Llorm9HVaQOxTEPfwhzyngkNDs+hsJP5l1igiEd2Rfmdw4SQdmfhaRpvj294WqwyEaoTqAa1raQBIezGtUM3nBJB/hVkTWEKFmoh8sFf+AlfswKAbPZY0cn1r1dK9WIXccnS2NL/THyVmTRjVkxvCtKyCFnMJRegp/61Yw8wpe02GVtbeu1t30TZHENBQ99FBQjfQbl1hM+rrt3BUF5z6vOQFbZMPy1pptqwvFpIZ7u4Np2tudQlHTWoZtpk37vU5UyRsmXW6g0/ZxzvuE/ieEck4pDePIs1KzWiHp+rFZLAje+LzB+tkFFrzJk/w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=sony.com; dmarc=pass action=none header.from=sony.com; dkim=pass header.d=sony.com; arc=none Received: from PUZPR04MB6316.apcprd04.prod.outlook.com (2603:1096:301:fc::7) by PSAPR04MB4165.apcprd04.prod.outlook.com (2603:1096:301:34::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6111.21; Tue, 21 Feb 2023 07:34:42 +0000 Received: from PUZPR04MB6316.apcprd04.prod.outlook.com ([fe80::779:3520:dde5:4941]) by PUZPR04MB6316.apcprd04.prod.outlook.com ([fe80::779:3520:dde5:4941%7]) with mapi id 15.20.6111.020; Tue, 21 Feb 2023 07:34:42 +0000 From: "Yuezhang.Mo@sony.com" To: "linkinjeon@kernel.org" , "sj1557.seo@samsung.com" CC: "linux-fsdevel@vger.kernel.org" , "Andy.Wu@sony.com" , "Wataru.Aoyama@sony.com" Subject: [PATCH 2/3] exfat: don't print error log in normal case Thread-Topic: [PATCH 2/3] exfat: don't print error log in normal case Thread-Index: AdlFxiFlnzIOBZgURkO2gsQA24A40Q== Date: Tue, 21 Feb 2023 07:34:42 +0000 Message-ID: Accept-Language: zh-CN, en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: PUZPR04MB6316:EE_|PSAPR04MB4165:EE_ x-ms-office365-filtering-correlation-id: 60ee57f1-a70a-4c4f-6b30-08db13de1904 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: jFNkGFhvGH5j29AFXGx3Zt2eBfNHYO2DwZHJhObdHdm+mABCk4XTGCKSdPCYApD4jJm8Qxp16MkCF6xG2oyHY2VzG/fk/F9zyJl851Gh9BOWQRiVX48oEipyzYINgKjEkYiHt1nGUg9blULAsMxG714zcG4qaeqBTdtCkKJR/Z3te7lZC/XhZIXGElI0hdcdSWgmnN6QESq4INHbxVmxPK2jbaWNyuJ26Cegd3m3fZuPDjofnJNCR3CeoayEC5gYaQ8U8wJWga2RyoIqVMrNuMXiZ1qopkf3jwUtUmLhgPKTVjggfB48mAgbYBSYpRa/FwucW7sPgk6ft31eHz4IW6rdJwc4beEbx5Qe2/qI32ZeLLY/rSQxAUgZArzZHC+2AfpiJtFrU24sNxWBYAt5+0+kz34C+Z/1j7DJYoeMlJDW5aM5rNJD4YQbf24NMXQ/PoXvyikQzcyCbK2WZY6v3aEQ7NqmEkfq/pyXx+Kd1UUHvMjdAq10IT9ivhwo9zWaII8hiyuH539bDTyuN+zkf6oQJPWlLXGdzOUNbZHWd8etBpZ3gYt/oVjkmZVUCvapQsHSHpoWAGIPck7zQPxS/mXKEGDq8GyS3ncGA6GY92dhNquRlqRbFp76Qu2YT7AVYnHj/ww354oFgL7/XTYdWCcsvFK5GhYmikOmCS9k19DPfBZrPoi+7P99FpyMpASQMKXmaCDCIGsIyHZEHZSBBA== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PUZPR04MB6316.apcprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(4636009)(136003)(376002)(366004)(39860400002)(396003)(346002)(451199018)(82960400001)(122000001)(38100700002)(83380400001)(86362001)(316002)(54906003)(8936002)(5660300002)(64756008)(66476007)(8676002)(4326008)(110136005)(55016003)(41300700001)(478600001)(38070700005)(107886003)(33656002)(7696005)(76116006)(66946007)(2906002)(71200400001)(66556008)(66446008)(52536014)(9686003)(186003)(6506007)(26005);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?q?G19ul9ScsjEbiVKFgTNhEWcXa1B8?= =?utf-8?q?A3iLhJGXl5WZX4Y6OQl/Gs9BJXaSMgbOliPk++pT2cXfuwdjrjU5vkz9Gh+/xBvMa?= =?utf-8?q?lZPF8bdwMarunyLGKgO3rO8zO6ODgu+4ho8yqMQ+099vHsj7L/22/G02P6oPgJLQ7?= =?utf-8?q?cKGVzduiI3dhkT4mASa/CTwe6gUBssirRe3d5paHWt2MozZ70nQ9egfsAo5bpY1JM?= =?utf-8?q?gQJfalmqcJ2lz7TnaGmf3kFRQl9o5+yVnelHqiruSTXeDNdsFLsLUw7FFoSNpdUIV?= =?utf-8?q?hwfyfdejMmaWF7GiNCj6uaCFZQVP8Rq/FQDdoCstV/PTJiTZhUDam/nhGpIal1FU2?= =?utf-8?q?7/11tyNA4aWmWNWhIe3sFCHDwcsYOaFjhSvLEDsoBe8gMHoqTksYQk5rPldzntj9N?= =?utf-8?q?UT5aEBOGP5vVduZjZLpWtzUvM91iN32Hd5PGeAA31FQ/L59Ch+ViinNwymaO7PWer?= =?utf-8?q?oYpK21pqUsxyswSV+2fKB8mkLFEbK4yE11EeeiqVLxlm4oSq+jvTsYIuzokZgs7bs?= =?utf-8?q?SkxLj/nLKU4k9duj5xuaef8ZSyDdeMPUPTkMQSadQGux4dL3I8sPQgGk2rtT/7235?= =?utf-8?q?TgwnaqBdP3xHTzeGFXurHFIFmsonINE8gq0sWuKMQC8gdB5AH2iQJoRcCK7lAMXuj?= =?utf-8?q?TB79nggXT+LsJrWK0VLYdTwsMxgAEXGEpO5SGYRVJXOFci9cqsWix+p/h31oUWjqv?= =?utf-8?q?MW7zVwheEQWpEELr0BQ2bZCNe/EhxWjzIkmbr+x+Niask2nAOyYPiA2IK/l+Gxek0?= =?utf-8?q?1N7BXf9OJIOcyYRQj6hvZRzLC9kr4iI4pB+f6mNQhAnJavYYfOJiPqpFdUxGN8Vdd?= =?utf-8?q?HtSfnndjG1Yuwyh+zeQdyrJmMmy4InMAAJoQShzu4zK6u0Ma6S7aa8gx2qooU22Ef?= =?utf-8?q?pK+tcdWileRaGKD2api4C6kUhqZl/HHaRlKQ09K/aJymO+XJJwUk0uPwAqNcvmOZ3?= =?utf-8?q?9fX+khLXjPBZtQTLVtq5SyZhnx+UpZK3B6TZCgXy3jYwRT662tWXgvn1ikQrqbKDJ?= =?utf-8?q?KiSy0yiY4NeKVCyyategWt6JAcQ2dwnj1nxcNLQzeYdaozjCQvl1LxBeCffdnkzPH?= =?utf-8?q?/Hqnt49Per4IQgjE7qu7aAneUgrmUXuMdnXgayBPV6a0XNBbTyVi4RdvZzx7/3UgQ?= =?utf-8?q?8cv1htaw7qAxVEcsqtEJsg51ENEtDyLz0RJpR+lnWMTvrm5V/3OA4xplNFQtyQfWT?= =?utf-8?q?smqxjbv7j2tzwHchzczsGy4MjojSLYgxWr64Zi9tPrJ5vzKHWXPWY/bo9qaGPK1M7?= =?utf-8?q?Bp0EIDRzAz8fQ6enoXh0pj9FJK+a0yncd4BqsMfS97NO1HgkgOgcEeonigetYHUPw?= =?utf-8?q?MrerQ6m5Z4USizh/U9OgkoHgnYTJMQdJKzZbFAT54lOLZUPBxL2BKyOcxYxLmliBA?= =?utf-8?q?LbtExJfZZda9L3QODTOoVjlqyuJngs9svLGiVkcT7FVhNS3srYd8T+7cg5cBk0d9/?= =?utf-8?q?vmNW8+h+pZd/xdt4N6GzqnDjB3FC1sfIZ+fEovIotIrA+YFZMI5qCzAUiZuBnZPYQ?= =?utf-8?q?huW37p4JohsF?= MIME-Version: 1.0 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: Me5jP2Q6J+C7TYbUAMG7bpAt6wqu4KmxSgXppLa9ZwCTZXcmPEvOnfwk8b1Q8GU6ZXRKquKzEi6MOuQ/arUPSZjgBQkhwbT+sjS8w4We5ECOHMjTDCCuLja2YGMlLC80O9yU8RcwqTEA2pQzYe+FPcSCjAVMYWAmPrzk7U/4cgBqGU4vFQkT/rIKmgMgRRUwn68iEZP34G5jpPWglfrAE44y/WKV+DdWaWHlgpPQr4mcleh7+XDrsgsgiGDpvZnLhF9YQNmLeXAVXEK4JBs+9kCkqZD8aBnU4hmgOn6gjcIvXbux+xVGiwM4avBA9LSWpqKyEQZdvajptsHuchexYdXhSCsR3lx8BMRWd+DclO3mrsq9zke+tm4XF56lhSxcXCx4RK/PiclUskS6yh/QDUX9XnvgbEyCbdHFXmEQBf5lC/L1gNQBpySnvHQACt1LZk+wrPWJt47UhP1r9CSbnNaCOvsjD43jDBaiF3wEJkweMhMSgc/eZTMPIJRotkWQeTiC9Ae9DSS0CYJSIdoMLjvKpZROgtsB5JIW/pdf18AfYR/b+0B3aB6GlnolViLtFbVrSIajCVHcdITU0nRkdvKaV2ETIbSNndVrIw9MKzIhvbK6CatHK3HO/P8OHsxBBusy2/kAdAidzAycHl3UL9lIqoSBFEr4cExO38cFyMSt8Ev19xIWtfyinCgzu5nm5BnkL2iAaxwAMutEiw2zmasI+BM0E+4wkyWfb/VJJZX7vReEfB0/35FUGKcKfrwmmuKrjgReKEzqPoYvU7UwigWSRob0sm66SFCX9KKwGlW8olMqe8wqjP9FJXvgk+Upo4tZ9q7cjbrCb5c82qupMw== X-OriginatorOrg: sony.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PUZPR04MB6316.apcprd04.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 60ee57f1-a70a-4c4f-6b30-08db13de1904 X-MS-Exchange-CrossTenant-originalarrivaltime: 21 Feb 2023 07:34:42.5819 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 66c65d8a-9158-4521-a2d8-664963db48e4 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: WhCz/g2BFC+txt2urrN2grc7ANMhmN0Vl4TD6QnKz3YFiHbNu/C4zivmQrf+OgQeXYax6LMiKDcrgmY/5fAXiQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PSAPR04MB4165 X-Proofpoint-ORIG-GUID: pQzcIuFm85-G_ODrNWadcNJBiIB1YTUA X-Proofpoint-GUID: pQzcIuFm85-G_ODrNWadcNJBiIB1YTUA X-Sony-Outbound-GUID: pQzcIuFm85-G_ODrNWadcNJBiIB1YTUA X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.170.22 definitions=2023-02-21_04,2023-02-20_02,2023-02-09_01 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org When allocating a new cluster, exFAT first allocates from the next cluster of the last cluster of the file. If the last cluster of the file is the last cluster of the volume, allocate from the first cluster. This is a normal case, but the following error log will be printed. It makes users confused, so this commit removes the error log. [1960905.181545] exFAT-fs (sdb1): hint_cluster is invalid (262130) Signed-off-by: Yuezhang Mo Reviewed-by: Andy Wu --- fs/exfat/fatent.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/fs/exfat/fatent.c b/fs/exfat/fatent.c index 65a8c9fb072c..b4ca533acaa9 100644 --- a/fs/exfat/fatent.c +++ b/fs/exfat/fatent.c @@ -342,14 +342,18 @@ int exfat_alloc_cluster(struct inode *inode, unsigned int num_alloc, } } - /* check cluster validation */ - if (!is_valid_cluster(sbi, hint_clu)) { - exfat_err(sb, "hint_cluster is invalid (%u)", - hint_clu); + if (hint_clu == sbi->num_clusters) { hint_clu = EXFAT_FIRST_CLUSTER; p_chain->flags = ALLOC_FAT_CHAIN; } + /* check cluster validation */ + if (!is_valid_cluster(sbi, hint_clu)) { + exfat_err(sb, "hint_cluster is invalid (%u)", hint_clu); + ret = -EIO; + goto unlock; + } + p_chain->dir = EXFAT_EOF_CLUSTER; while ((new_clu = exfat_find_free_bitmap(sb, hint_clu)) != From patchwork Tue Feb 21 07:34:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yuezhang.Mo@sony.com" X-Patchwork-Id: 13147441 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 26B2DC61DA3 for ; Tue, 21 Feb 2023 07:35:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233658AbjBUHfJ (ORCPT ); Tue, 21 Feb 2023 02:35:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233656AbjBUHfE (ORCPT ); Tue, 21 Feb 2023 02:35:04 -0500 Received: from mx08-001d1705.pphosted.com (mx08-001d1705.pphosted.com [185.183.30.70]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B4C2A270 for ; Mon, 20 Feb 2023 23:35:03 -0800 (PST) Received: from pps.filterd (m0209323.ppops.net [127.0.0.1]) by mx08-001d1705.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 31L6sUUq013847; Tue, 21 Feb 2023 07:34:53 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sony.com; h=from : to : cc : subject : date : message-id : content-type : content-transfer-encoding : mime-version; s=S1; bh=7ohFektqA0LiNvF7AArgLumAu2Q7Yl5BbjRcnIgmNNQ=; b=HNijkcTnxtwhh8nvQSPtpeyih3kGhP+YewqgQmYq+9+O1vKjxbKxoVKirL/bGpLUlkwW YBJw5SWQKwitX64Ovy/dPlwIWqEhTWLgkcgPJw+agdukoqrVtcWZ78o8cTAzMZSdK8K/ MK1sdKAjBH5TrPvUskI2zvXMVk5BhLX9ahNxycQF0sznUBULdm2K8Ho3OYBPHq3cPKnE m3mU6jLcp0/0LMP+3gOn6fgVm9/Mk/e1yArr0clWPRqUyzTc2W0ZprtstbQyS4iGN30g /h+FcUdMQfNpAQXW2AsWeLqs8aUXw/zNFl4b8t6SypkWUShvYJdFfX7u3blvsRmo9gdH bg== Received: from apc01-tyz-obe.outbound.protection.outlook.com (mail-tyzapc01lp2040.outbound.protection.outlook.com [104.47.110.40]) by mx08-001d1705.pphosted.com (PPS) with ESMTPS id 3ntp11tucy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 21 Feb 2023 07:34:53 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VHqnycWIqkT7A6na7O8aN1GjE3Qlz7JFcmHlS7MVZKGn8b6Jary2juUKP5iUU4GHMowdIHCTBAaQ8rmIjBu9A2PwnCdLGip4egOgm882J15tLUda5Ca7irMnoYtrM+3UglQuj4Ai8qwzpKTvKNTjZx0wXOoGOR2XgKSFb7xzabJZrclT2J04V+x23HDYk5CQbgWKkdDyP3bZzR8b3C85ZjTI9tMm0d1NQOGdJ8NBOPwSbBBsVALL3zpQdHEHCY969kINXXgiajO5ESXekafD4VO+mdDAK81toYBoEfbqH9TkVvnEr3sjAPM06adsVTb6kxxbW4vGYGW8TtA0Z8zB5w== 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=7ohFektqA0LiNvF7AArgLumAu2Q7Yl5BbjRcnIgmNNQ=; b=gKppwqbNYyE+cu1Cdv0cOIPikeC5+lg63u+dqHklWcliai0isOVdXdIrdDHzuOLL9yLO235YbNG7UlMb5WeomnX28k1APtGUOtbsU8LKuFVGMSiU8suNPh8n6m2Uy/VNN4h9S7slTbc1jwqcE54DfalRsUB7y84KtDVDOVCjYpWvLlDxo20Cx5M4H0AXDSGoOQlx5FTNqiyFMrGIDusQMH9E9ZvtUFtnhAaAWaBufD3k43vxzQWRGFFf7iK217Ek8SmN4NyzPgRQFpJQwULbIzrzJkPj9E1roA8vUSWTl5qocSvKUVlYqweULLcqjL8HVI3NO9T8JqL6xo0MctZmuQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=sony.com; dmarc=pass action=none header.from=sony.com; dkim=pass header.d=sony.com; arc=none Received: from PUZPR04MB6316.apcprd04.prod.outlook.com (2603:1096:301:fc::7) by PSAPR04MB4165.apcprd04.prod.outlook.com (2603:1096:301:34::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6111.21; Tue, 21 Feb 2023 07:34:48 +0000 Received: from PUZPR04MB6316.apcprd04.prod.outlook.com ([fe80::779:3520:dde5:4941]) by PUZPR04MB6316.apcprd04.prod.outlook.com ([fe80::779:3520:dde5:4941%7]) with mapi id 15.20.6111.020; Tue, 21 Feb 2023 07:34:48 +0000 From: "Yuezhang.Mo@sony.com" To: "linkinjeon@kernel.org" , "sj1557.seo@samsung.com" CC: "linux-fsdevel@vger.kernel.org" , "Andy.Wu@sony.com" , "Wataru.Aoyama@sony.com" Subject: [PATCH 3/3] exfat: fix the newly allocated clusters are not freed in error handling Thread-Topic: [PATCH 3/3] exfat: fix the newly allocated clusters are not freed in error handling Thread-Index: AdlFxnPdDHWMMvx/Tn2pD0MXxIUl0g== Date: Tue, 21 Feb 2023 07:34:47 +0000 Message-ID: Accept-Language: zh-CN, en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: PUZPR04MB6316:EE_|PSAPR04MB4165:EE_ x-ms-office365-filtering-correlation-id: c7ee2cd2-bafb-40ca-ee69-08db13de1c20 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: gLU8i4PK0LUQXk1+Gg8LUVRs/wXn1rQDN6AtzI913YYMLUr5EjO2KU39Jkf1KgWjpY7qg+v/2L0fktISqRTd+4s8d+1DgtZ2Ok5DTUNlsy/BmMXhwPENpVi9sphXdwCnsD32EraktAM0177rnt+ezwShw2Z6axW/wknZ8qdTLL9mkbl7wwAuAhliC4ieVlRBV4P1NUbGhrbNArClQZ4EWbZdpntmXd9A+khQvYXHFWKX8TyT1aWFzN/9T3BxTC31T25SLv+iy+VeRIfVTrL1By48FULEUMTWY8XqRRxPFgw+id+GTY30Yx9nRp5a0XEVVfGa1ZgNw0QZkuUCZx7k793vrHjxkoWxPlWB9w6Mzt55r0lBNBMnKZ36ajaoYVYHDVmQUj0HVsNWdzBZSkXz2TbkAJEmzJPnIpEEq+QQp83qdKvYjyYyghD2i6RXxkImJxiuIaJGoURN+tg6WVTsRpyeJzSKAleDW9gk6bW6UEEaGx3p8UTrvL/ZtoYQI5ma8V4JlMCAvh7ubl/2i8P8TNgVgEBmkzv9Uve5yqetI0imP/1kIlJibMCVZxLwgObCWTqGkfCgGznN7Ty88t4PbTbxCdOpz/enRJyM8CiPdFGVzT+ZdbLRwBuHZogmnqiSd3TZXuWuEmGwBE91TLZ82QiBWNkUK8HYyoN/O1IEnDZ/L4JB36jQvOCau1HiHdZnuVN8BQ5I+S3RCXYh5RKa7A== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PUZPR04MB6316.apcprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(4636009)(136003)(376002)(366004)(39860400002)(396003)(346002)(451199018)(82960400001)(122000001)(38100700002)(83380400001)(86362001)(316002)(54906003)(8936002)(5660300002)(64756008)(66476007)(8676002)(4326008)(110136005)(55016003)(41300700001)(478600001)(38070700005)(107886003)(33656002)(7696005)(76116006)(66946007)(2906002)(71200400001)(66556008)(66446008)(52536014)(9686003)(186003)(6506007)(26005);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?q?/JSM0haeTX34KS5QyEF6mU7DtlMh?= =?utf-8?q?EcG9P24985JpW2VBg8XAnmqgzjehWt3vmJMewlgXXUuQBKk/c1XWtxswO6Pkk6o49?= =?utf-8?q?rt79aGBjRuLICq3+PoCdakNAft9sslnwnvana9YVWvwKe5ZcEoG+DNcizLtw5BJDm?= =?utf-8?q?tNoJwU55I5HyLmAdc/CjQzIv0uzw93KYEcka+klIdONaHL+T7BZg1s1DSowrj6ZaW?= =?utf-8?q?Lc0I8f0CGCXnARaO+eiNlqCjh2NxtzvufhjaDZIESUUzDPKaWNwErxEoYJI83WOwv?= =?utf-8?q?8BOLNfqWM4l0U3QiqM0PNfIknO54Nb0iQaAOieoauUR24/FjOqeR3G84gMz7u/CZH?= =?utf-8?q?8LHbgJAbBL8gQ5A1KhHDFgQpPAEWnV8Mt12bkv61xANlcXZur6fJKHxz3IHem/Ccv?= =?utf-8?q?Jb9DUv46W0kFLHrCMrxZP7LUf+56BVsgnd5kg2azXFhifVimO2YI9zUt76nZ91Lys?= =?utf-8?q?B/KQnE+e7W2QV2hnSvCPC99nAovw09SovfFtFfLAkIbWXjELJ09DwQygsviecO2Uk?= =?utf-8?q?lbbOSrTpkPdSkGQTF19LSjWEo16d73fFPxSJubtzjFRAU6k3bR3XXvgaPJ8nXtsmm?= =?utf-8?q?tAEI61jLXWVEu4ZXuhBoPnh1tCulBui8ExFfwAsQ2nd4L8xj0YRIJQbqjWrE0coWz?= =?utf-8?q?2+/s6Zfi9hMujssB3BsTfHvgkScS2qKQVC4DnqJZXZVbn0HUIGJ0Y7VljcorUbIz/?= =?utf-8?q?rtUzAHXaipaeilOediGeAdyfpLb3PvALWUX5f7vtv6kJXjDjXE2PxGfOInFCBwsG1?= =?utf-8?q?dTJxm+a/zJrrSf808K55gMUvhUYq6yS9pvHwXxQW/RUJfwnQ96txoqfXEEyhD5oGp?= =?utf-8?q?b57Z8qe/1H+3aNSA9W61y42Qg0D7vm9L+w6ak5smtkQl1ADrFgPc8jZxlFc3Kqco5?= =?utf-8?q?a6fiEqSKL0gxKtCVipDvmyuBXLMcUtXqB8Dd+ORBIVr/FrO03es8uvXJmfHhvNAgh?= =?utf-8?q?AXss6id0lydSKkm2PkASVHAX33qjtdP+O8yg65sb4OJM5T9L7iplGLsiAvXLiw1FE?= =?utf-8?q?bQu8c/ic6MDttY2l3xsngMHPyJjQK/vLojq9Yf6M9xikiNHNHBi8yv/thGpPZE1lV?= =?utf-8?q?xzKf2MJkY0PUploXG5lcAg5w54/dv6SK0zwb/dRFCnWFFAaRWueXribgdbmaZLxst?= =?utf-8?q?myfDGPu1GvwSqPzZcHFsPpqNKvUacSSqdqf4iN2k2bvrq5v1EF8BKXW1mhySyQ6iF?= =?utf-8?q?zuDFsixYKIXixy5EynOXzTT8w7PHpgpmUZ3srqqh4M4V6FGe11iUmKw6jgJLrmNJk?= =?utf-8?q?yGriCEZeZZOUWNdoW5YGIlxpUTfFL1KLNimaGhbrN9mrpIS+UPlPT1raxnjDnTDGi?= =?utf-8?q?Ixxpp+gj4YM23toHgm1GBMvSSK18C13Cy/clvgHMKRYABRPT1iFhTHh7YpkGR1lBv?= =?utf-8?q?3mAzIb/XSR+7Ltzkk1kz1acS7OxJ3ifJWVfvbihrHM507SauDCMeKKjC7J97qXGBQ?= =?utf-8?q?NhGNzn2v62M/YQ3u2F4MWXwj0iCmu+XWQ02/hJFF9JqrHsfIk9KlSMm2YmwDQtcBy?= =?utf-8?q?8K1ZopAqqNjE?= MIME-Version: 1.0 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: GD2o/3Jz2Zd7Lb6bbHVd9gvFzGDyIFPE8c8O8BtgNPAohao0acV0PIE+FRHNpCfLuGV4+Pcb4+8PTj8GSbR7f8k2unonuPW01mSDSFgGabjaz6omr0mSgK8TRQB9zDkMNu55KinRTB+r4b8X5daLwcQY0Z4wRxQVelof39P90+0c/bffC+0xnzi/7i7j/fPBMHrmtYaihIrWqXbXl8XtBRUbzESXq27u8Knw23GCEBNx/rMiqK8hgxh6zdSQGqcIY/AFWMo4t2rsstJ10+bJ8LVNM3L/MNtMb3j40cNmMk9gZS58mscPqX5/bUbU3rdnVFFw34q3dvYzg+yW+kUb/zXX9qPOis29lhiMbL0UxEWdQ1MovyRvCaQqYxBZl5M9B5ZWRzrxM6DSn03ywVeNfI4ma3AUcl7EdE4yP3xJSWwt5G5qG2EfDfiObWqYYaf8QOJbezDkK2gNJuh12dlU9H1ndfvQ2mZ/CpR3iY1v7MM3qtasMHLR31ZptUnK9p0yCgargMoCm+1tALKU5y3jrl6iXkWMCFPAr9EcDE7zjL+gidgr24sUABjeTbXlcw823AUNwc+AM1EcXg6OKEU228y5kZ51xoj46IxJfoiLblbGtTWqRNdX7i0qtANlr+GE4cWe9nvehcAri3EbzZ4Pa9CNDl4UoEM4e1d37fQloeD1DgMgognU5F/JahEMKxyJCjBbJV7v9NPhSpEPjciVSvwnqnwUKM6n7y1IfavLBHGbPgiOGdUO0UWASbjisiJmifb83EH2ooAS8Gsk4VI6UtFUk2z00dpaHMiFOun7oq8H7b3sL64gZfOzAiC9B/k6tzNIbPbk7sBudZN5TsZN0A== X-OriginatorOrg: sony.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PUZPR04MB6316.apcprd04.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: c7ee2cd2-bafb-40ca-ee69-08db13de1c20 X-MS-Exchange-CrossTenant-originalarrivaltime: 21 Feb 2023 07:34:47.8332 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 66c65d8a-9158-4521-a2d8-664963db48e4 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: ATPppy4bRa/2kzDd/FR7BO8akWsmogRICYloJh4lHzuVCjXACsZYsdoa90NXqPMLwPiZUJuS6MVjz1ZmsKjJlA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PSAPR04MB4165 X-Proofpoint-GUID: QpIgEdyqJ4yRFLvlb7Cg5VcvbNLUbdKH X-Proofpoint-ORIG-GUID: QpIgEdyqJ4yRFLvlb7Cg5VcvbNLUbdKH X-Sony-Outbound-GUID: QpIgEdyqJ4yRFLvlb7Cg5VcvbNLUbdKH X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.170.22 definitions=2023-02-21_04,2023-02-20_02,2023-02-09_01 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org In error handling 'free_cluster', before num_alloc clusters allocated, p_chain->size will not updated and always 0, thus the newly allocated clusters are not freed. Signed-off-by: Yuezhang Mo Reviewed-by: Andy Wu --- fs/exfat/fatent.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/fs/exfat/fatent.c b/fs/exfat/fatent.c index b4ca533acaa9..edbd0f251da1 100644 --- a/fs/exfat/fatent.c +++ b/fs/exfat/fatent.c @@ -307,7 +307,7 @@ int exfat_alloc_cluster(struct inode *inode, unsigned int num_alloc, struct exfat_chain *p_chain, bool sync_bmap) { int ret = -ENOSPC; - unsigned int num_clusters = 0, total_cnt; + unsigned int total_cnt; unsigned int hint_clu, new_clu, last_clu = EXFAT_EOF_CLUSTER; struct super_block *sb = inode->i_sb; struct exfat_sb_info *sbi = EXFAT_SB(sb); @@ -361,7 +361,7 @@ int exfat_alloc_cluster(struct inode *inode, unsigned int num_alloc, if (new_clu != hint_clu && p_chain->flags == ALLOC_NO_FAT_CHAIN) { if (exfat_chain_cont_cluster(sb, p_chain->dir, - num_clusters)) { + p_chain->size)) { ret = -EIO; goto free_cluster; } @@ -374,8 +374,6 @@ int exfat_alloc_cluster(struct inode *inode, unsigned int num_alloc, goto free_cluster; } - num_clusters++; - /* update FAT table */ if (p_chain->flags == ALLOC_FAT_CHAIN) { if (exfat_ent_set(sb, new_clu, EXFAT_EOF_CLUSTER)) { @@ -392,13 +390,14 @@ int exfat_alloc_cluster(struct inode *inode, unsigned int num_alloc, goto free_cluster; } } + p_chain->size++; + last_clu = new_clu; - if (--num_alloc == 0) { + if (p_chain->size == num_alloc) { sbi->clu_srch_ptr = hint_clu; - sbi->used_clusters += num_clusters; + sbi->used_clusters += num_alloc; - p_chain->size += num_clusters; mutex_unlock(&sbi->bitmap_lock); return 0; } @@ -409,7 +408,7 @@ int exfat_alloc_cluster(struct inode *inode, unsigned int num_alloc, if (p_chain->flags == ALLOC_NO_FAT_CHAIN) { if (exfat_chain_cont_cluster(sb, p_chain->dir, - num_clusters)) { + p_chain->size)) { ret = -EIO; goto free_cluster; } @@ -418,8 +417,7 @@ int exfat_alloc_cluster(struct inode *inode, unsigned int num_alloc, } } free_cluster: - if (num_clusters) - __exfat_free_cluster(inode, p_chain); + __exfat_free_cluster(inode, p_chain); unlock: mutex_unlock(&sbi->bitmap_lock); return ret;