From patchwork Thu Nov 2 09:58:38 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: 13443559 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 8345D1171A for ; Thu, 2 Nov 2023 09:59:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sony.com header.i=@sony.com header.b="oomE2O5S" Received: from mx07-001d1705.pphosted.com (mx07-001d1705.pphosted.com [185.132.183.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB1A9111 for ; Thu, 2 Nov 2023 02:58:57 -0700 (PDT) Received: from pps.filterd (m0209325.ppops.net [127.0.0.1]) by mx08-001d1705.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3A25riEA029642; Thu, 2 Nov 2023 09:58:45 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sony.com; h=from : to : cc : subject : date : message-id : mime-version : content-type : content-transfer-encoding; s=S1; bh=fEqXdgbx7Yvoeld/IrIsf1h1yRvI+f0hyJGwHseeea4=; b=oomE2O5SvJ/nG6V7GDy+lJ3t5EHdo13h6ZHnZ7xWRAIV26dBpo0yk7buSAFFvZJv4sYp UcbX2XULpYl6m9ombFU8TujieJ07eeDzaULXlJQkUXNVrZRGbcIdt/60YYmibr/abrp0 00RhYV66M1MVuqypmtHZZqkwGMvGlgrbgzd5aWdlxt03af929Lpdm2pV376znGw7ZIQw tdeEQ5Qp9k5qQv33VJld0epWvtkxtWv7YUfJGn5j7VSH//TjUbyG0Oo/Qmo1JXSue4HG wChiEi7cKqZqsFgFH0Oz4JeXDIrmuYhlDoN0h/xYvtfVIUoDobg3L6D14NKUFQfDVc1y ZA== Received: from apc01-sg2-obe.outbound.protection.outlook.com (mail-sgaapc01lp2110.outbound.protection.outlook.com [104.47.26.110]) by mx08-001d1705.pphosted.com (PPS) with ESMTPS id 3u0qhywk7x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 02 Nov 2023 09:58:44 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=I6UpAt9NCY68s/lMezYvQKdzrXYsUaUchF+EmXrzgqVJUJOd2kkHkohTTmal2ZQDfBXL2v0nvoC5V9QYrzR6yk/P7mv5hv7R76vA0h2iNzogBjXq0h7lz29ay9MBcJDdpGwuujINh1d8GUfOJkPBCVvqOLjsMc/p2qa65hBcntfg9SjEoVoOogw8KYHpVAZAYUd8lcbRzm+RuDyXzEZR7IHU4qzuYaSwQfJetWTHVOLv7lATfhzVd34sAjY46xBvv/ult3qEf5SHok6nKQtgyxyFhX9f+REfHYVb+MW9RvkmkCNzJwAWQlGrFx5qyHjREA3MARRFUFpbbRiKIgfs8A== 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=fEqXdgbx7Yvoeld/IrIsf1h1yRvI+f0hyJGwHseeea4=; b=Pw4sK0gmFDpIg1HC4WdQH/eGg6j0zk//Lg/2jg4KACOOL6vAAwA8h0ksG0OqmTadBD6PqkLUr48iDOiV3XloeX1Ujv8KQaMuO20p+gF1URGLHnVHr5JxCPiikZp0hRc0zXTCcELN9/yfdJbuU28B9xAvRBTe9Mb/vUspFqbO3XHjlz49WuFKQyw0aYe50n12mU8dIAq1lkqd/Wgp+QclcZJi1PaLeiCsGA9uqNVt6kFywTRyuMomRF85OMQArZyy2WXpEaJyuJxTrqrBDv65QDbmP+ZUS0l9tcovculYaly4qAD2f0ZDqXD1sKmeJs5RqYMERbf1wCbXpLY33LEypw== 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 TYZPR04MB4432.apcprd04.prod.outlook.com (2603:1096:400:28::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.20; Thu, 2 Nov 2023 09:58:38 +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.6907.025; Thu, 2 Nov 2023 09:58:38 +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 v4 0/2] exfat: get file size from DataLength Thread-Topic: [PATCH v4 0/2] exfat: get file size from DataLength Thread-Index: AdoNcnl3W2G+vxeLT6KlObW3hRdjBA== Date: Thu, 2 Nov 2023 09:58:38 +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_|TYZPR04MB4432:EE_ x-ms-office365-filtering-correlation-id: c5dfaa34-7ec7-4a1e-7276-08dbdb8a4983 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: n6Q+EJVhK6YGUhse/H4vgzLtbOwUXHq2pFW0UcLBRuQi9cYJbzQc1y8/sGp5hLXc0Jcj1lYLCX9Lm2OKY9ntvZqs4yfRVdT1mBeCsqB2F+DI1rFKcunVnZ8Yfa0KHyTlGNAorfH2gh/fyZUimNwkEcA1vHVQs4jX1IdIGBUmwOHkwsySdS9TqkNe+xuYTfjx+E+ChsfnhnnFDp6U4PI0xylWbj5GvMk67RMeGE8BzqJNYA8QV++bTQt6PKm5TxsrCsHRH/3Yl0JasDCg6r0VMitBKArMULrz1s9xP9D04J2rfwSk8MGzGWyfuBqRC73Am6caqtDDyCT3Q44WD2qX9EKBaseByDjgYL8P279kvSl5jFgNr8sGMms18vT9TpBOCFkfjy5EEkENZut0fN2VGnLmzKKFoqECORJGaQyuw/VFPEiNVE5yVi0k9QzxeaTWh1V0+l8x8i4rcQ0j2oldRWExdMtsxOCId5Z75gfxhyibGvXgVxUnuzdmOoN8LxBn/LVDh3VtSwBBltuku/CpHiuPoOIBPwDkxC97SyJyyDGoRNRXgKvWsMlthf51XnxJbGbICTg5TcUDRw7yhEOywSUKNeCABKRu1bk2PIx3T4l5/XcLdWhVJFBzlbMN5g+/ 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)(136003)(366004)(346002)(396003)(230922051799003)(1800799009)(451199024)(64100799003)(186009)(107886003)(71200400001)(6506007)(7696005)(83380400001)(9686003)(8936002)(4326008)(5660300002)(52536014)(41300700001)(8676002)(2906002)(478600001)(26005)(76116006)(316002)(110136005)(66476007)(66556008)(66446008)(54906003)(64756008)(66946007)(33656002)(122000001)(82960400001)(86362001)(38100700002)(38070700009)(55016003);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?q?y6LYg3sbnjWp7hZAFny6CaScRmkd?= =?utf-8?q?MiCgBnsF0CR2uHpyCmsWFhAgs35m1+mLz13rzyMQJq7VTm6MCCFDYwXTYfRTHpo2O?= =?utf-8?q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?rbAVg/NGjv0U0RNRPH1ypr1GhUeE880yGC050oKaqOSbkFTNSHW5cP+q+T/+17fJh?= =?utf-8?q?yLLBEd7NRmUjwH1YX+7Cz5Xyu/kCNQ60Fvq0KQKQtzf0+p5pMLZ4k9QDRaL9vJ2HW?= =?utf-8?q?1AKaY8kckNuHV+YQZR1sOpIxhRbijVxkGbZ5Nkb5VVkA/kahIgkHJ5oaiaN2XKloM?= =?utf-8?q?O5tJdkUytqTvxHqIRJXFaJlrkHb8ImgI0CfDIwiXT4H5+WrDQ8lqAinNjkGBK8MLU?= =?utf-8?q?FHlF78wS6lEtZtbH9fe0Qr9cZBHnaZ6w8HM5dlK5HXIGzEUDVyDsj9u0ynWeCqRhd?= =?utf-8?q?OXaF7VHLnoFenirGl2dDV6H3ROMuALUJswwf/IG7lQRoOrucloDfDTdo6QiZkY5fr?= =?utf-8?q?uX/lYTYI3zzCJ23Ndaq3XWC0FyNNvnvRmGGFofwpeavOQB//B/shIBYY3VV5LSTtk?= =?utf-8?q?UsRJiaoy0Ol0n5oe7McIieKpcHNJa/cSJYyviaTW72euZum17NED38IkFxk6wlEXF?= =?utf-8?q?l6je6qjOF0GsNklv+JggPcUAwoYqKIAcea+Mrv+MwhwcJAJzebIyEq16nFlW+hoWK?= =?utf-8?q?aj13nISctFht?= 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: dV/M+tMHG8KETlWkLbHgeVv4AbrN0HyFNPUQ925ilQ4J9ugMdLiJ95WfNi4NMT5HApgIOLKLmgDq83oCqjDAfeDrBz9T+nKTnvHpKn3oU+C4Ux2DBx1c1kRfIpKbBxhvWFO16o8X0UBRI/YfYNDa/GQzEKiTXG+5PRR5p9n3zVs+kbpPwgFjiGfSzzC67rIfacZG9uhw6yp54+ZlKf2jeiCRFjYhsDvqbEr/SkI/Aw9ZMsedKcO5ceUDm4dSKRgMtJwPtpn/bmPyog0dh3xJOCSEpceGC7IlnrBykC+Py7em1/iUWatBV+2ByB05x5p8yockR3lIuJNZ/Gp/pvbnv5IpB8xSYMyLvZmqr2u8o+gRCCAPVEduUwhIgEquGnFf7x74tCWCmT2V4clQk+ldcI1XpdnIWl8MN29Bq3PZ2sPZ7r+fa9Iw8F5dLA2tZoMA0L6kKIq/HELVQNtzXNmHtQRjdSbGHo5wp7ddVftWJkmgaBzcOFP2vx8F6DeVDgWQJZAh/4I+xOLRO1YguVcR8l1QD+1s/sImMLrw2HCbBihlS5JHnNOrxvKk8KAj5uIQkwi8FaAcCUgKrM7QC0WI+ALrkCWgB4u4wm9QU0LQ0QATr5/E1m28ZwLYOdTchwGPOrEnTCWvVD/NrjAsYwHjxs7um5VErwkJeVUfKzzPl6SFbBcRJ6nG/oL80szhUDcS/O1zPTyX/vrHO7nf7ZVuTPHOayL1BtxYOSP0ZyM0oUw4zFVZBFXlNJV6T17RG8Bu+6tRXsXc0OhIJMnUnY2dXDFC31Tv4TSjmgpF/9dSe5gs8PNud6sPL/ZE9Yk/5zwnY8qgR1CGbXUtJoZKQ0sK9g== 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: c5dfaa34-7ec7-4a1e-7276-08dbdb8a4983 X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Nov 2023 09:58:38.8204 (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: CsSaBQPcQDaH+sf9yaFEnzNW6SLrJeC+KYnmyE20WgWbqGK9o6CEsh8eBM/ZiOiTpVKtAWcavpZxeS4esnPBRQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR04MB4432 X-Proofpoint-GUID: 4r9yJMo9iQXsjkqgMv7zrTsv02_TN4ph X-Proofpoint-ORIG-GUID: 4r9yJMo9iQXsjkqgMv7zrTsv02_TN4ph X-Sony-Outbound-GUID: 4r9yJMo9iQXsjkqgMv7zrTsv02_TN4ph X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-01_23,2023-11-01_02,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 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 zeroed the extended part fs/exfat/exfat_fs.h | 2 + fs/exfat/file.c | 197 +++++++++++++++++++++++++++++++++++++++----- fs/exfat/inode.c | 110 +++++++++++++++++++++---- fs/exfat/namei.c | 6 ++ 4 files changed, 277 insertions(+), 38 deletions(-)