From patchwork Thu Nov 30 03:09:45 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: 13474033 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sony.com header.i=@sony.com header.b="BNmGpxWX" Received: from mx07-001d1705.pphosted.com (mx07-001d1705.pphosted.com [185.132.183.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8541910DB for ; Wed, 29 Nov 2023 19:10:02 -0800 (PST) Received: from pps.filterd (m0209324.ppops.net [127.0.0.1]) by mx08-001d1705.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3ATL0FQl021090; Thu, 30 Nov 2023 03:09:51 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sony.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : mime-version : content-type : content-transfer-encoding; s=S1; bh=W/BIjbbpi3z/oqM3SdmSZ9rxxfUbrPh9RigfuOcr59Q=; b=BNmGpxWXUxSXKLOChXVyyr5QXc45+ozfkj+/US/fkPZWOgsGqXL0ErdLD7LZvlvTbZDE Jdpp9NWqUDDCPR64ASwcaLFY3uA2S2PBYSFMe7rYgYrVQmLbvAzgd38bVn29jtLyQzSV ubR2TSD62EAeLtftPlTPrjvz02aqwFDFcw8Kk/7VFkVpk5/2MGJXJkSEadMLQqvw8KCV LTDXSQZWqEPM1vz9cIcQxRMGGnBH2+XTO7s1psTSkRK+MjTytI4PnQZkwGy4+ZyaeABH Wajflj6MFL5e/SmNwwiQqdk/PmHAEpew/6CnnG3u8UxhE1CtOk6E/vZbzXUh3YtzqKAY /g== Received: from apc01-sg2-obe.outbound.protection.outlook.com (mail-sgaapc01lp2109.outbound.protection.outlook.com [104.47.26.109]) by mx08-001d1705.pphosted.com (PPS) with ESMTPS id 3uk636535t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 30 Nov 2023 03:09:51 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eHmUTcSpBEuFHVc/CWjFtLLiHz1/oUpzypI+3OTMOtpo2a6CW8hWQAzL728hAG3t6kSOaCNRFnQYOlkba0ZdYPNsLPda3C8ocCPN1nzowxauI7YtOdoORy2MigMRSdKg1SXLyFUw9Vb1tqT+6PCpDMpBdmpwigFkc+RBYsPXNW1tEmt+BMG66s6wNMQdaYg2hVI/ZjrkMWCdYGtF+xa3Zk/XTaizgwb0to7QGGY+J/LrPBPFQBGN8fzGYMTa1TIhG8JIUC5EZYdfo4E7BGGlxY+YvPzX2IF1oP1MXtQdHPzPaMPKo/wJ+9pZHhr+jVnreJdVd8WKTDpF3whkUvYUig== 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=W/BIjbbpi3z/oqM3SdmSZ9rxxfUbrPh9RigfuOcr59Q=; b=dHjmZ1wS7EoftTChPKnqU0B4/1OBpKwpfcFh/ui3EPlYXtIU3kHSYBVSb/eIf3Be+kGh0aFmpXkWPG7GOVr3nZ39J93+xMHwuNAYZHYYQU6TOeC2BStKhwWiXKhT3BGc3/gbtzpymiF6tCNB8vIPchw+dMmpDbAab4XhMyZImcNaOsj3sX+sBrOySxrSpBS54BjPXTdF8OKfEfbwMFs5kqOpajIpfbbWknYXY2U95tORW50N2IzjWCqEnsg6Iloq8X26nnSlD0iL8ZeYuObQlcjMZcwPQfNH8Tz4952bF5m1Qk7DnbTwEeySqKvqyXgLC0t/GN5Ohoxlwi2fiyNaXA== 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 SI6PR04MB7955.apcprd04.prod.outlook.com (2603:1096:4:249::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.24; Thu, 30 Nov 2023 03:09:45 +0000 Received: from PUZPR04MB6316.apcprd04.prod.outlook.com ([fe80::2fd0:f20f:14a9:a95a]) by PUZPR04MB6316.apcprd04.prod.outlook.com ([fe80::2fd0:f20f:14a9:a95a%4]) with mapi id 15.20.7025.022; Thu, 30 Nov 2023 03:09:45 +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" , "cpgs@samsung.com" Subject: [PATCH v5 0/2] exfat: get file size from DataLength Thread-Topic: [PATCH v5 0/2] exfat: get file size from DataLength Thread-Index: AQHaIzqrwWxZXkD3Nk6Vsq7UNH5y9w== Date: Thu, 30 Nov 2023 03:09:45 +0000 Message-ID: References: In-Reply-To: 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_|SI6PR04MB7955:EE_ x-ms-office365-filtering-correlation-id: 717b459c-a3ee-4dae-e1fc-08dbf151ce29 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: UA2VGqBc2oeBDCMXpUB6RIP4LfE23ip65uEH/LFaTW1bfCz9S2IX4EHlv2ZIKqJanh+cdN5APLoOBWe2qiMVFihhqPBf5wry+nNXd1gN2XXe8d9kh+zFVaLCQvvOUrTHxZaJW9hLkJZ5O+0lUrTzsnuNv7HBbK+tavjDwO4MgXQfLG1lmXyLCGWgeRqiZam4mngsXr10rGc4XZWvVRY4hxz0I+q5JpOrEiX68VOH6YdoE74wvFbPJTouKIsVrfB02RVVEKx/5Ad6vZ4xH6jtMQN19sMZWg8K+YS2Hw7Jo4Fkx4ZiO/a/VCAB6ySzkqV/o/YEeoXuUkQyK0uwQEKR2+1R2QsEYIAH+SiLY78cMciVFl7CAO7Nuu6KhiYQuYr96Floh4xEixmaNbeAWl+wMd1dIHTBxEZPpUWhxWtz1fKadU9oRJyF5dYJROkNUZ2iDBowG4Z5mJpbyt+0yWl2qhirw8TTRgT5xiKTD2VZ5g9VPdAc0Bu3olR6O6t+GJOW9tltmqjzCfG1mvzvDaMkqA/V9O7FVuQCmWSZQkGVWMpWjmOJYloP61HBu/jlyQeny298gyxteV3hZipOlShi7N/cC/46+3mTe9UAOVISuuIZHz9h7oUt/wQ/IuQSad81j3vUfaDfv2IL2MlfhcUkTpJqZDMCrh1rw81IjYylIUI= 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:(13230031)(39860400002)(376002)(366004)(346002)(396003)(136003)(230922051799003)(451199024)(1800799012)(186009)(64100799003)(5660300002)(478600001)(26005)(9686003)(33656002)(7696005)(6506007)(41300700001)(38070700009)(38100700002)(122000001)(83380400001)(86362001)(71200400001)(82960400001)(2906002)(202311291699003)(66946007)(52536014)(110136005)(76116006)(55016003)(66446008)(316002)(64756008)(66476007)(54906003)(66556008)(4326008)(8676002)(8936002);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?q?YcqfLzZ0bJUr8ZW6zS/REQt5zGpC?= =?utf-8?q?2viSWPsqeMR1U6eeP1RmslFTl3YtS5BvYWhgzQ0Kt2MpZwLh8UJoOZSmb7NBKbYpL?= =?utf-8?q?ukWc3/WeqswgRMb//8HI7I+4rK9kqjdvmH1AhPutmBdJdJVnVMjd3gHFCX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YqbRQ+dR0jE/isUf3POvbBJ1glbjHwA2nBWfxG/RPMoOa1RgL3rQ6GOc/?= =?utf-8?q?bQ2Hw2X0fu0g93pA97VxgXLBo/epBHSszICkVQQPFTVaVo81NOZ63b5hspOEJ1xb7?= =?utf-8?q?5DVGGYfL5X3i9x1mbxsHa0GxHJVvNT04shk36xe2+IE4pak+hWkmFvEabJpj+NFkQ?= =?utf-8?q?qnxY2ZczD0hGEY43pAWqXt3gLaMPPQ0TBVw5EGbdVNQMQvGimbCD9uLf6dQ7C0sH/?= =?utf-8?q?lHBE2xT3EmP899KHlZjwzhfrECFWL+obD7LsonDhmxfkZU6ye28BAq3XJd1h1rQJB?= =?utf-8?q?8Y9JW/GRb+UIZ4vkJbiCT7ca3f1rW2N/OTfFJhB3F6GvnK8QJCue30qPTLhf8lIZl?= =?utf-8?q?+SV4/3gTWZ7uYDuyDrhUK0/fdd1nphtLNRdZy1Du2UuVQRHcbEtrMR3qgx2F0LxqY?= =?utf-8?q?VAvbobPzQfqcvpUCGysmZEeXy6PMx/HYJOJ6nrD1NCBkmlz354qRe2j2XsWtWH9ac?= =?utf-8?q?3YSbz2XAllP2?= Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: nOENyJJH3dwbBkPn0okAYGwRvvK2c4m1me5pI2Qk7FoJPDVHL3u0zgx98KD9CeenlQKud4WZB0zGSASsFaLn/EWIkPEg1Kx9meyvV+46o/5Tqty7ijn2ksQZS1nMyPL/teB+a1Lz0yeACUpI6sWdQQk1QPG462Lq+7liyYQoMprUdFj406rrqvvoryc8Kq8+/XEMq4Oh2+25/WYyieQnLMEgOzJIRyFovqSyO9QOSYH83e9VF0wpVqGMMe60lT9HBwIK3m+ksVQ7r6+mfhSFFKDXdsHYICupGSsm6wtZxbDqB0TTpIFN6RzmhCYBCPJdRNGZRB4/rtomLwDXrIDK4XYtkT0MkQuiRqNqfMadLUDks84ApCyD4ZkEZaEKj1i8tickHLNjTC1W9jFzgNlDqAmha+C89jjzAXSoqdfbnp/83hdNNAYb34C2Hy8uqn77OA5wbztk5+vRaQ77suuZBGi8zqUs/4GprpXPTgj//fuBWtvrWMtoEOARGwgvXzQ5eengrCPT28bIUacfuzsNe12+xWspc8l3oosVUnhNtoQ74lkt/ChqkbgFowjXhVLdKG89mw9hsnCbJ4rcvCCRMxguzPc58ezwUvVFQ/chxY6/iiFbPnCBtTExphVy5nFQqASJ5lT0r93DvkWplY25LV6+fFbAq/RFOhyUPxpFcOW/isKWMAG/86YxSC4z+0Khl2DaRlJxDxPKIZsZf7SeW+1RlZqX5UjtsQl/C8UTnJ+QwlmpJol/CtyTfDLdZyX1AIO2v2XKet8O9IBaEGtV2uzUnTPCSs5bKoGZ4eduEqGGfK3nVFDQWCpHvinLgHfd4BW2mJ0FRQptTeGF9jviuw== 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: 717b459c-a3ee-4dae-e1fc-08dbf151ce29 X-MS-Exchange-CrossTenant-originalarrivaltime: 30 Nov 2023 03:09:45.6341 (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: +Ll2pQzA7D0A2UQ3lc2dF+D7yDBxIfLvmlW2aVxwXwIguQYZSNU0fRT0DvvMsBJkyWoW8G+C+kh5hIW+vu1Wmg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SI6PR04MB7955 X-Proofpoint-GUID: pq_BvTnVgb1nDdTZOs_AI6UYNAOsHOOF X-Proofpoint-ORIG-GUID: pq_BvTnVgb1nDdTZOs_AI6UYNAOsHOOF X-Sony-Outbound-GUID: pq_BvTnVgb1nDdTZOs_AI6UYNAOsHOOF X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-29_21,2023-11-29_01,2023-05-22_02 From the exFAT specification, the file size should get from 'DataLength' of Stream Extension Directory Entry, not 'ValidDataLength'. Without this patch set, 'DataLength' is always same with 'ValidDataLength' and get file size from 'ValidDataLength'. If the file is created by other exFAT implementation and 'DataLength' is different from 'ValidDataLength', this exFAT implementation will not be compatible. Changes for v5: - do not call exfat_map_new_buffer() if iblock + max_blocks < valid_blks. - Reorganized the logic of exfat_get_block(), both writing and reading use block index judgment. - Remove unnecessary code moves. - Reduce sync in exfat_file_write_iter() Changes for v4: - Rebase for linux-6.7-rc1 - Use block_write_begin() instead of cont_write_begin() in exfat_write_begin() - In exfat_cont_expand(), use ei->i_size_ondisk instead of i_size_read() to get the number of clusters of the file. Changes for v3: - Rebase to linux-6.6 - Move update ->valid_size from exfat_file_write_iter() to exfat_write_end() - Use block_write_begin() instead of exfat_write_begin() in exfat_file_zeroed_range() - Remove exfat_expand_and_zero() Changes for v2: - Fix race when checking i_size on direct i/o read Yuezhang Mo (2): exfat: change to get file size from DataLength exfat: do not zero the extended part fs/exfat/exfat_fs.h | 2 + fs/exfat/file.c | 197 +++++++++++++++++++++++++++++++++++++++----- fs/exfat/inode.c | 136 ++++++++++++++++++++++++++---- fs/exfat/namei.c | 6 ++ 4 files changed, 303 insertions(+), 38 deletions(-)