From patchwork Wed Jul 6 02:34:42 2022 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: 12907249 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 27349C433EF for ; Wed, 6 Jul 2022 02:35:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229884AbiGFCfL (ORCPT ); Tue, 5 Jul 2022 22:35:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36166 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229485AbiGFCfK (ORCPT ); Tue, 5 Jul 2022 22:35:10 -0400 Received: from mx08-001d1705.pphosted.com (mx08-001d1705.pphosted.com [185.183.30.70]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B72B39B; Tue, 5 Jul 2022 19:35:09 -0700 (PDT) Received: from pps.filterd (m0209322.ppops.net [127.0.0.1]) by mx08-001d1705.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 265NH5FK023801; Wed, 6 Jul 2022 02:34:48 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=4fqQzOC891wMTApvX3qBjySIzFL9EL8CZhnlpyT76z8=; b=NkCa8UonwxxapgJlRpcbEI8SqzAyp1jtEsXG5/Qr4h06LL64WKeDj6euGRTZM30GxjrH UlV29MsM91F7gfMvnqMqD42+On60TGcd9bFu/dCa87jwlK6mTCU/kb55CdmqYLLQpNMf Pv3WDj1Qv+tW7dIv+jUmBLkCyUsEl6nqh1RCty6i1+BAXK3bBOX3+i7UH1qyJ/ohQMPn D/m3pfvb3ydb16JFhP7lopjs/k2/SDT6zqRCa4NGWw4xHcFtnP2dZ2a9fqAM3cQe6vDz YCqIoQAo1WDpMPOxRhdBLGGszsgWjK+K5EFGSN8TecGrMDN31xBKKgfl2iWCH6Pv8taQ 6Q== Received: from apc01-sg2-obe.outbound.protection.outlook.com (mail-sgaapc01lp2107.outbound.protection.outlook.com [104.47.26.107]) by mx08-001d1705.pphosted.com (PPS) with ESMTPS id 3h4ub48b2r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 06 Jul 2022 02:34:48 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=W1Ns3Zfcn3DDBye2KRR2ToxHucq5kK/NIJm57addmoJJ0oF4WmTXeLkh0WTJoQUMssqaKhBoSCOSOKOjaYMsOc3Wnr5eb+nYBlC7nVEvT0svOCyR5wKuFCpIeYmnbl5TPx/7TR4ySEn4V72dpEcoAQDrbuBoy6BQ795dCDsTq1CNMqOGLAtTthIyCHf20hGmtsIOkI5lM+mxKpu+rxyTBe/7axu2WEWiPrtAhWETSrqeUjZcBeht5cUUMo1EHqbopo98saKq/iPDXcTf9ItWwJqZ/tEGI/hTQrw3PL5KJmi9H6kEOUckRWpPWRcN/Sx9akZ30NczxjYJxeyg9eEVBQ== 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=4fqQzOC891wMTApvX3qBjySIzFL9EL8CZhnlpyT76z8=; b=JyDd8l7Fw1KyyFbS77lMCGYxBkxcFiOcbkQnK7/CM53+Nv+sFOiJJcZLZEl6pJMwzpFKpXWKPPUc3YINshnS4JnEg7uEVVu87mSYpo0fYvOBn4qHYo48R4XDTTbdCikIHR59Ii/ds5t976Lqr+lWqM8n+VNI4VqGRCah3cMXNMvPgut7bN+M8m6P18IAtnY1/9jcNFrxQLjE/v5v50BPBWKPY5g7m66csHeJi/FkmfjY1aYirizA3Qb7Yk4IwDBb/aZNQVhwWHTSYMAynCgyP9jqGW/Fam3oXdKVZTNLz8z23DGtmMJTaha7tFuv35B8yU75Zj9HP3RxnfLK0waW9Q== 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 SG2PR04MB3899.apcprd04.prod.outlook.com (2603:1096:4:94::11) by SEZPR04MB5972.apcprd04.prod.outlook.com (2603:1096:101:65::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5417.15; Wed, 6 Jul 2022 02:34:42 +0000 Received: from SG2PR04MB3899.apcprd04.prod.outlook.com ([fe80::9076:c0a7:6016:599a]) by SG2PR04MB3899.apcprd04.prod.outlook.com ([fe80::9076:c0a7:6016:599a%6]) with mapi id 15.20.5395.017; Wed, 6 Jul 2022 02:34:42 +0000 From: "Yuezhang.Mo@sony.com" To: Namjae Jeon , "sj1557.seo@samsung.com" CC: "linux-fsdevel@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "Andy.Wu@sony.com" , "Wataru.Aoyama@sony.com" Subject: [PATCH v1 0/3] exfat: remove duplicate write directory entries Thread-Topic: [PATCH v1 0/3] exfat: remove duplicate write directory entries Thread-Index: AdiQ3ki9D5AktJ6jTwq83Z5UKjVYtg== Date: Wed, 6 Jul 2022 02: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-office365-filtering-correlation-id: 877250e6-4d0c-45f8-01c1-08da5ef814fc x-ms-traffictypediagnostic: SEZPR04MB5972:EE_ x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: Bo7BcmxCyczwPvKttNa8glOpeMZ8n5beF62Kb2LT/a5SQdCorGVQgflWDsWIvvQgwq/zqzwSlo1gMEaAfGietzoAi7CxmJqOHhzLUbpciw1vvgl8PrvTrdkuEsh6NmsDAY15iJmt9LWh2L5HqHRzJ3sJ0JiLY1oVTLsWqXkLTHj//RR70/OHQrvL00xUN32Aqv07VdmrITUaNCaObmIDLFdjYi2tBe9GxibEOoJMC9aQOEvOC6TPn5Lsy1/jnfvojfasr7ONbCgas3mAJjyt2KyKQsz8fnb4NHLaCAMlQdFXwmA84DlxEGecwjmxXYnric9BH2oNtIdNTdtvSxkG5Srm53QSr53V/GTy04eGX8cme+RwXhC7M+NW1G9bUVH3zQKlg0GQvWXd67DNDwNAm+JvEtqmOX0oYLy4ars638CyCtwIh+16bmgadmtdhHPEeYejYJchz5T/x7ct9C2N++5ibOQnAH+n5btHt6VlaDwsM020JL5sOu8gLLfFQ/ueheETc5nVtAaV08WF+gu+rXk0035830J52+d6U7AU+Nx5IFngaSxuy/jsHhs1CqanMXtXJDfwZe9sgcU5WLepMI/I8VSv3M7pNS7GZ7HEeo5+WzRSLhTmYJvFiF7HtSDywXew7z8XlvMbBrwKVUZhHPJgQrT8z2Rmj13idmFKZmOIYLn6DR7udY1E5XS5X/ofEBPPq3cg1hYPDLkN55d4BHDWouV1/28JTvpWlzuuygfJSpFelgjYZVsisNc9aArFPHxdNtcN14p7CPiq5cYBVv0jmGt0KuoZoq4tenxURw16PAjJQSFbjrgFyZ8dN6NB x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SG2PR04MB3899.apcprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(4636009)(396003)(366004)(136003)(39860400002)(376002)(346002)(83380400001)(82960400001)(122000001)(38070700005)(38100700002)(54906003)(110136005)(316002)(71200400001)(52536014)(8936002)(5660300002)(4326008)(8676002)(76116006)(66946007)(66556008)(66476007)(66446008)(64756008)(107886003)(9686003)(186003)(26005)(2906002)(478600001)(6506007)(41300700001)(7696005)(55016003)(33656002)(86362001);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?q?DnhV582+21dyNJCXwssvuslgtUWu?= =?utf-8?q?Z+sCTJlLvtyp/QB0ScQCaeUcQeoSFQ6S9VW+av3GtStAquX5bITSvU3xgkNSR8pWy?= =?utf-8?q?QLaN851zZ5DrIVUXqBjkhIoadVa/jz4Sqjm0oBEmyiHFe8ep3rRngXxe6upDlGyaY?= =?utf-8?q?PuXWWcIBFz6DB+161G/6XkYl/PavmkiHdcEo62ElFpD3rfOGvfoepjSVnVbk0tsVX?= =?utf-8?q?lUaUZWfYvhrOWogDiG/KloL59UFDvM0K4xTkTF1MggB02nXl7hNmCNsyWQSb7yFqv?= =?utf-8?q?EE4KvN6HE8g30LSS6o+B4X5dLSNI79eSp/XEs0UBL3KpQFtor5fdH2k7A4+V31WWP?= =?utf-8?q?mzpu5AKDJ9z2g/vrVat3/gwkUdZdQrhGqH2cRgTJqtPUoLKQ3buBMjE+8fPGe4SK9?= =?utf-8?q?TxFPOLqur84IwtL4iP0u/YC6MSeEzmfKrhjf8i6lIgpmSFuCT6hXyu4KIe44d0+P3?= =?utf-8?q?fLO3q01kymOkPjEz1QBtLwbriQR5vY7Gnpoq+N+4fbibmAbNRSQNi+YzFEJe6BqRR?= =?utf-8?q?XdrJ0Go9C4BYquKKDw8+XJb0DisemjOnDPpaDaAeG587BH6kEU6p65I8D6spI9XEH?= =?utf-8?q?VKsv/Wfa3O/8C06fVr1TqSOrA4GEbJP3V2COhcH/JhP47U59aOIRAkw0GPOVPaC7C?= =?utf-8?q?2cqpzeq8/eQkVRCpsRHwIj6bcvk2MFW1hlMH7C14sNdK/cXn9ZJunWLbk723SQvHi?= =?utf-8?q?N3MCIXUUnowZC9QlTDwjeX3Mju8DjUF3gMV4B+etUEICIl5IC8bww7HFBL0MyiMsT?= =?utf-8?q?6XBCLDo9lmuWjP0x63ruTq6CEolmJ5A+x8LPB+jFwE2ZdENfv2i68F1vh85alyK28?= =?utf-8?q?fJbnFCX1aYVShTYl3RraBchPaAi8qvh9ROYRfRZKJ3FmatV+41AGFt+26ssTirUoB?= =?utf-8?q?SrBrgxJNLwV9SBpNPDII43XPK+qy7By4ZRJ7mEWoppZZZ1muRzJxPtU82X3hIvuD6?= =?utf-8?q?NNjE9aSjFHSQTeb4yObjf5pbWsv5SOX1DEd5++AqZTIRm6eKgveULbFHisYYXdoOL?= =?utf-8?q?fBbrshf16X3cK8k/hhldUInbnSVz2Xt+iFGXpBZvH86i2angZzAidRC/wUYOVnlV+?= =?utf-8?q?gHlR8y3C+p87fC/k4LpkSF8hsjfUTiUU81RhG2Qnt8glzpq3SMm3Nv2FVuyXOBjZR?= =?utf-8?q?Pz0scFQPu3utwQguMfkSqqlvYzVHSmquwe/P8qhccXqpLirBvwS+GuRv5ZIhksEjV?= =?utf-8?q?BP9mN1VYoCQB0WQiWCbB4tUZ3BUPLVE7F6EsWSZsCVIqysSDM1nQ5sewWnxTskFkk?= =?utf-8?q?lvVY1MZ2XumYpAqzO6ppCnBt4voB2ZRiEHE6odw2D8I8ejf/T0RfGXEBZrV/FbIo5?= =?utf-8?q?alIgSZcLQI9vDwAFJPdCiEbQ0df1ZrZkFk7RlvyqCjr5sDhqwK70eVWMKHhTXnNbI?= =?utf-8?q?BrIWfZ+WlaFKQaB+EBpCtRigG4KQaTgzx/P/aKVzRPYWIrXJ0Hs9nEEp6DA/+wDPX?= =?utf-8?q?qJd8vJivoKyJZ4WTpz1f/AkciKYy3ii7Nkd29qdzuwMPvdl3FstrJeHaxPNrVZUJ5?= =?utf-8?q?UvkxLgrIo95G?= MIME-Version: 1.0 X-OriginatorOrg: sony.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: SG2PR04MB3899.apcprd04.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 877250e6-4d0c-45f8-01c1-08da5ef814fc X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Jul 2022 02:34:42.2994 (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: BEezDb57aV6XOLmVRyii9s7MAleWyBDEXXW8bq6b5pkUqhTouBQV5P+eLrl4svmhSi2fmmWicIYgYjTveGI/iA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEZPR04MB5972 X-Proofpoint-GUID: EwFMqG60FGMfLxIZUVheuQhJv84d8qu9 X-Proofpoint-ORIG-GUID: EwFMqG60FGMfLxIZUVheuQhJv84d8qu9 X-Sony-Outbound-GUID: EwFMqG60FGMfLxIZUVheuQhJv84d8qu9 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.883,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-07-06_02,2022-06-28_01,2022-06-22_01 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org These patches simplifie the code, and removes unnecessary writes for the following operations. 1. Write data to an empty file * Preparation ``` mkdir /mnt/dir;touch /mnt/dir/file;sync ``` * Capture the blktrace log of the following command ``` dd if=/dev/zero of=/mnt/dir/file bs=${cluster_size} count=1 oflag=append conv=notrunc ``` * blktrace log * Before ``` 179,3 0 1 0.000000000 84 C WS 2623488 + 1 [0] BootArea 179,3 2 1 30.259435003 189 C W 2628864 + 256 [0] /dir/file 179,3 0 2 30.264066003 84 C W 2627584 + 1 [0] BitMap 179,3 2 2 30.261749337 189 C W 2628608 + 1 [0] /dir/ 179,3 0 3 60.479159007 84 C W 2628608 + 1 [0] /dir/ ``` * After ``` 179,3 0 1 0.000000000 84 C WS 2623488 + 1 [0] BootArea 179,3 3 1 30.185383337 87 C W 2629888 + 256 [0] /dir/file 179,3 0 2 30.246422004 84 C W 2627584 + 1 [0] BitMap 179,3 0 3 60.466497674 84 C W 2628352 + 1 [0] /dir/ ``` 2. Allocate a new cluster for a directory * Preparation ``` mkdir /mnt/dir for ((i=1; i /mnt/dir/file$i; done mkdir /mnt/dir/dir1; sync ``` * Capture the blktrace log of the following command ``` > /mnt/dir/file ``` * blktrace log - Before ``` 179,3 0 1 0.000000000 84 C WS 2623488 + 1 [0] BootArea 179,3 2 1 30.263762003 189 C W 2629504 + 128 [0] /dir/ 179,3 2 2 30.275596670 189 C W 2629376 + 128 [0] /dir/ 179,3 2 3 30.290174003 189 C W 2629119 + 1 [0] /dir/ 179,3 2 4 30.292362670 189 C W 2628096 + 1 [0] / 179,3 2 5 30.294547337 189 C W 2627584 + 1 [0] BitMap 179,3 0 2 30.296661337 84 C W 2625536 + 1 [0] FatArea 179,3 0 3 60.478775007 84 C W 2628096 + 1 [0] / ``` - After ``` 179,3 0 1 0.000000000 84 C WS 2623488 + 1 [0] BootArea 179,3 3 1 30.288114670 87 C W 2631552 + 128 [0] /dir/ 179,3 3 2 30.303518003 87 C W 2631424 + 128 [0] /dir/ 179,3 3 3 30.324212337 87 C W 2631167 + 1 [0] /dir/ 179,3 3 4 30.326579003 87 C W 2627584 + 1 [0] BitMap 179,3 0 2 30.328892670 84 C W 2625536 + 1 [0] FatArea 179,3 0 3 60.503128674 84 C W 2628096 + 1 [0] / ``` 3. Truncate and release cluster from the file * Preparation ``` mkdir /mnt/dir dd if=/dev/zero of=/mnt/dir/file bs=${cluster_size} count=2 sync ``` * Capture the blktrace log of the following command ``` truncate -s ${cluster_size} /mnt/dir/file ``` * blktrace log * Before ``` 179,3 0 1 0.000000000 84 C WS 2623488 + 1 [0] BootArea 179,3 1 1 5.048452334 49 C W 2629120 + 1 [0] /dir/ 179,3 0 2 5.062994334 84 C W 2627584 + 1 [0] BitMap 179,3 0 3 10.031253002 84 C W 2629120 + 1 [0] /dir/ ``` * After ``` 179,3 0 1 0.000000000 9143 C WS 2623488 + 1 [0] BootArea 179,3 0 2 14.839244001 9143 C W 2629888 + 1 [0] /dir/ 179,3 0 3 14.841562335 9143 C W 2627584 + 1 [0] BitMap ``` Yuezhang Mo (3): exfat: reuse __exfat_write_inode() to update directory entry exfat: remove duplicate write inode for truncating file exfat: remove duplicate write inode for extending dir/file fs/exfat/exfat_fs.h | 1 + fs/exfat/file.c | 82 ++++++++++++++------------------------------- fs/exfat/inode.c | 41 ++++++----------------- fs/exfat/namei.c | 20 ----------- 4 files changed, 37 insertions(+), 107 deletions(-)