From patchwork Wed Aug 7 05:45:28 2024 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: 13755658 Received: from mx08-001d1705.pphosted.com (mx08-001d1705.pphosted.com [185.183.30.70]) (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 6BF53558A5 for ; Wed, 7 Aug 2024 05:45:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=185.183.30.70 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723009560; cv=fail; b=jGPpJkteellJWX1HQmOiUmyhMmQJrBJWkbagz2nmuwGlec3NZ1WLdPzXQOpVamTNYAHtgJniwK+jT4Hl2llbrKgRf6lvO1gCEsXetUugJt40FkWxiZZF8Y/F2qIL0/UWcNdaHxG4XN2bifl3fCRhonQgHM4uAmk6+d0iEXsZQEE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723009560; c=relaxed/simple; bh=qAMXniJVUCkAK0/TCmnntJiv1SD2wdShosY+9z7t1G8=; h=From:To:CC:Subject:Date:Message-ID:Content-Type:MIME-Version; b=mNi8DO6oZKQLxf+mlLc8ZIxZkDipYvvAs6J/yBM5gBy+XHtTHjmHXQ8+jEWFo5dzXJAbWuL8jwKAamnTWM3syGS4d7sRwpUtMzHNpBZoEr/QTIUGaYm9gthRLsBBTajBWkhi/myLRY5iM3hVP6a0k0eVRTvKEBBFlaK3AkKOO0I= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sony.com; spf=pass smtp.mailfrom=sony.com; dkim=pass (2048-bit key) header.d=sony.com header.i=@sony.com header.b=QMr6QKCQ; arc=fail smtp.client-ip=185.183.30.70 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sony.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sony.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sony.com header.i=@sony.com header.b="QMr6QKCQ" Received: from pps.filterd (m0209320.ppops.net [127.0.0.1]) by mx08-001d1705.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4775doFu030177; Wed, 7 Aug 2024 05:45:33 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sony.com; h=cc :content-transfer-encoding:content-type:date:from:message-id :mime-version:subject:to; s=S1; bh=vCGKLuDPnVKmQeql1alxh3bVYSgZ/ bDKLfACQExNED0=; b=QMr6QKCQJfZHzGIv4In1sufoCbMK4FKNHwZM8n6aYuNyO KCxr+GdtZrvoLTjkEXqOndippzzZdwERTe6PKgyLMrw9a4Qk0IxDzRHr+FTWRqlJ WUzH80qXxW4WiRBFKXl9TwKANX1mb+4GcEffK9FxbATk5CL0Co3YaAIF6LvtHu8X ddUmM791b1gT6QCFA4Rovwc3WgE337WRwxhsO6q3YOo5TWWWXonj+zw0DOXONyAH +U1rty68vQeK6YhdG+xYl48BY0En+fmrHBNm+KQ60bi8izzUY/d7rfdPSMMSZrRH BunDoBizk5JDUTWXsQl/Ts9+YId8AKFOAeGa+e9ww== Received: from apc01-tyz-obe.outbound.protection.outlook.com (mail-tyzapc01lp2041.outbound.protection.outlook.com [104.47.110.41]) by mx08-001d1705.pphosted.com (PPS) with ESMTPS id 40saep383b-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 07 Aug 2024 05:45:33 +0000 (GMT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=HQDxoqTQkd0ViNrVKGITgiy1vf84urth3lhFxH0MsioZ+Xo5szespg729GPp5Gyh4dq8rWI3XIVAEO7bjQmqzb7sRkDFaK1jZKYF8vYnXF6ud8eY8z/Y84QHHzsNvEP1OZIcgMbpPwRdnSs2H3Ki+2sfj/HEyy5crmuCulYn2RdZs6Mgo90osTSlCFNAmiPIxhlgBV6zcX+2WnbOuTefjpT7K1wqzrGLqN9PPaRdTCwqfUWSpKN+tbr9lBjKRr6ChL2Myrf7kvFUleENOzdEawqWmrZUtS6mmkDDSPVz8MXHyk+7j5haiw9qiZ50OPhH93nIjfgI3rZevk2qaYt0tw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=vCGKLuDPnVKmQeql1alxh3bVYSgZ/bDKLfACQExNED0=; b=XSE6bn4NHGcWHQfQEsaJ8k7lOWSwnZ1h+UGD2N64PMuRolt5C3i6TDEL13pYDQ3NzJxmEW9zq50FaWCU72uQkn0rN8vg+s1iAB2Ot8BeSOPIUejX9/80a0+G5pcKbr8Hrfa6gC+kJPnRpKyQGsY9xZdkqjHnQSAegdfG7qB8adUtVMV/xX/h2p+U1zozJymcJYJGVEi8KCcO5Py7QzkzXBqhdgrUyrTVMQGKcYbkSVO48PSxdc+rFsU7w8dTW/sc7mpsB8LHIMaSSrcaimK+eEcoM4omuoWpFV4K5NUgNAV4T4hrodr+8Gy2wL5ntYgRwBis3bzjFkbNNYWvpAqNYw== 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 PUZPR04MB6886.apcprd04.prod.outlook.com (2603:1096:301:118::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7849.13; Wed, 7 Aug 2024 05:45:28 +0000 Received: from PUZPR04MB6316.apcprd04.prod.outlook.com ([fe80::409e:64d3:cee0:7b06]) by PUZPR04MB6316.apcprd04.prod.outlook.com ([fe80::409e:64d3:cee0:7b06%5]) with mapi id 15.20.7849.008; Wed, 7 Aug 2024 05:45:28 +0000 From: "Yuezhang.Mo@sony.com" To: "linkinjeon@kernel.org" , "sj1557.seo@samsung.com" CC: "linux-fsdevel@vger.kernel.org" , "Wataru.Aoyama@sony.com" Subject: [PATCH v1 1/2] exfat: drop ->i_size_ondisk Thread-Topic: [PATCH v1 1/2] exfat: drop ->i_size_ondisk Thread-Index: AQHa6Iwi3WQKJ9UsFUe2ryZR7fiZWg== Date: Wed, 7 Aug 2024 05:45:28 +0000 Message-ID: Accept-Language: en-US, zh-CN Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: PUZPR04MB6316:EE_|PUZPR04MB6886:EE_ x-ms-office365-filtering-correlation-id: fb3b9bfa-426d-432d-7ae9-08dcb6a424ab x-proofpoint-id: d8690225-876f-412f-87c6-a7cb45557a4c x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0;ARA:13230040|1800799024|366016|376014|38070700018; x-microsoft-antispam-message-info: =?iso-8859-1?q?YfCNNvbkWbwG/6bn2ObtwAGTiz?= =?iso-8859-1?q?W9k/mT6q8hbVJ/9T6Qwe86dAnKHO6THx6RU82Aw54RazGjHotO+AZdiCtKeE?= =?iso-8859-1?q?n4rRed5Lgo23OGlEcZDY3TysY7MslLce0ZGsf9mQyeiOi2aCHuh/YZhn0puA?= =?iso-8859-1?q?raagJcLsiK1ANjmeowa8vryxCbarnjSLB/6yQq0AJC5Y+QkEMstQS4ZERFL0?= =?iso-8859-1?q?XFSLktEYrmEmDufRgyHYvx7EWlLO+xFWXG/KYiWywQza43ZG6D35GYXcr6eC?= =?iso-8859-1?q?1u/EK97lfl06Fz1+x6CU++2WCaDyoGnQD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?iso-8859-1?q?6CRyBZ4I9o/dAy3tIMcLwKPV56WkPKuqlzK/apht4j3Mb7DVh3WjLbAXjbVO?= =?iso-8859-1?q?amyt+cbw8xdtY9L/BMXmfhmRE61Spc7cNDNo4y+Ipwoe/oVamVYDUOqW3nYc?= =?iso-8859-1?q?DZAPp2v8Dq1ruo1XJFamGuMFPDg5i/BZZMAwYStjZvSpDUSD8oqudEgKw3Dv?= =?iso-8859-1?q?MJ1v4LzZALFyMyq/vdkIVPQmHXAC++GBgVUfPHr0KJNHBnt64PD6iFrWw/2B?= =?iso-8859-1?q?HVSd51JEHHzUSdmIvjlP3RKA=3D=3D?= 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:(13230040)(1800799024)(366016)(376014)(38070700018);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?3/dv4NFi7M7nkMIx+r17slR?= =?iso-8859-1?q?nIPgQ5HVw+dSsZ37cc8cEO+RK2KB85BAqD/55ZEEHsics1SYc/MLpxvbCiRh?= =?iso-8859-1?q?HqhMlYvymwvxrIwYm1CLzzQ+6tK4l8khZm4lr6Fi0GQcRnRr/DE0wuXzptw2?= =?iso-8859-1?q?H0t5apCA8+w4WUblzdCxRtZRteQT3Ri7s/WJ5snjeQ2lNqTWJaqgRNcrshBY?= =?iso-8859-1?q?dl3Ei5Tx7N+k8Mi7RMRSaUGKNKNO/ptmegwANktexvFwFhkM40KsmATITMUV?= =?iso-8859-1?q?vCORtrpmmtmzv8Is1DJfmYkM0wAyp2r0BJTrUdobqyZyCG+2dgzd8i/SpdUl?= =?iso-8859-1?q?ddcjJPaIr5NnJiq7o3xCMeb0FrAdEXCUwlLVE2EKT7P+Ar8N5y+pLhDQdqo0?= =?iso-8859-1?q?BoKs1mFRj69M3fUs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Oy8Y/5m5XQu77y2?= =?iso-8859-1?q?BTdfksvF9QHa/fC9LhhPJcDyL0IboK8K+3s9k7bLSKbiy6EDE0UfyfOnjeBu?= =?iso-8859-1?q?1Dh1HY8p86LguhCjgnb7XVYE4eXQy0LhtZ1Ng24PL+O31zL2JewwSo7vYCQ6?= =?iso-8859-1?q?YGlC8dGeOVoz8i74QQTdaO8jNlEcZe1m057I/ClyLAhVhInuj9o4qIFTe1Xn?= =?iso-8859-1?q?Waw+wqp9Up/CWBpUfUKEYqFStfrl9MJI38+12F+b4yBySFv9pKHGNW6tTLDj?= =?iso-8859-1?q?M8x5dXsJk0Oni6uXlmWe0gAykRbXw6zoxFgOh1k4kBNHOOdhSZuGatvcJ5Fo?= =?iso-8859-1?q?MAHN355712tSsjsW3VSkgCJb7CJMOsh8IgmW+OpzGT0BrqeMSBG33Iwg3DtA?= =?iso-8859-1?q?=3D?= 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: utJhCaa2TC9Y0ODqP5QGSa8O/IP42QKxMLoqIRxoRjrZRAb2aolkcgCU2rcB0ZErQvEPCUW4k3cPToWX/tsmKAWZZ30fZyDuyWGjhVBCQlRJeHiZUPysgsiLIPdJwWG8MJuhKbe3mT3WTFlHRmbTte08z2NTE7fI9NAmqJV2zyJMlPDo0px36f4wTqV6nvPfk+YNKhEyET7DfsixFcR2ocU/rd5fGPVVpcE8F7Al0xXoiR8REHBkFVRnjxTHcBcFSOf5sBTgZPoH7NEGwNPQ66PlJm0ZOv0ezs6hT8jhTlU30a9c1m55KAXEMkYd3s08lRYYg4mhko3K3a2I64wCgoCATD7oQpFj/NsKqJMR9rnhgOnPVkJGL45O0RnLyM+Esz8sdK3vL8D3VBKBeiDjkrtug+zmeAqt20jvwhGfXkPOmoBA5MRv8UFYuEb0+vj52rAFOladXwYd+4rikGcWJvPJZrZ5qREd6ZQMkr0G/fAjPuFH3561mn/ru6oTJ9K1sRpc3ec5TwPlJSe00ZqkIXhWZsQqeBHdtpLs41Wk1vgAQqPpDOeZcpA66N/xXKJM0U/o5NyJ9Gu01+V4AHBxqd5iQBcJKsMtyrri3olzQqrZk2Rvc8UzhiKDSqSJzDq2 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: fb3b9bfa-426d-432d-7ae9-08dcb6a424ab X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Aug 2024 05:45:28.5718 (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: YLvHQLOTenImR825YEnlGsoZdqAq9g9OAwDbOeTrIOKZEZqLgPPGbo60wqfqOKYm6vld5LsgIw5SBVMERGR8KQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PUZPR04MB6886 X-Proofpoint-ORIG-GUID: HolwNgN_xEeHw-tZNPfAWuorUrdDVaDu X-Proofpoint-GUID: HolwNgN_xEeHw-tZNPfAWuorUrdDVaDu X-Sony-Outbound-GUID: HolwNgN_xEeHw-tZNPfAWuorUrdDVaDu X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-08-07_02,2024-08-06_01,2024-05-17_01 ->i_size_ondisk is no longer used by exfat_write_begin() after commit(11a347fb6cef exfat: change to get file size from DataLength), drop it. Signed-off-by: Yuezhang Mo --- fs/exfat/exfat_fs.h | 10 +++++----- fs/exfat/file.c | 8 ++------ fs/exfat/inode.c | 17 +++++------------ fs/exfat/namei.c | 1 - fs/exfat/super.c | 1 - 5 files changed, 12 insertions(+), 25 deletions(-) diff --git a/fs/exfat/exfat_fs.h b/fs/exfat/exfat_fs.h index 1d207eee3197..40dec7c0e0a0 100644 --- a/fs/exfat/exfat_fs.h +++ b/fs/exfat/exfat_fs.h @@ -309,11 +309,6 @@ struct exfat_inode_info { /* for avoiding the race between alloc and free */ unsigned int cache_valid_id; - /* - * NOTE: i_size_ondisk is 64bits, so must hold ->inode_lock to access. - * physically allocated size. - */ - loff_t i_size_ondisk; /* block-aligned i_size (used in cont_write_begin) */ loff_t i_size_aligned; /* on-disk position of directory entry or 0 */ @@ -417,6 +412,11 @@ static inline bool is_valid_cluster(struct exfat_sb_info *sbi, return clus >= EXFAT_FIRST_CLUSTER && clus < sbi->num_clusters; } +static inline loff_t exfat_ondisk_size(const struct inode *inode) +{ + return ((loff_t)inode->i_blocks) << 9; +} + /* super.c */ int exfat_set_volume_dirty(struct super_block *sb); int exfat_clear_volume_dirty(struct super_block *sb); diff --git a/fs/exfat/file.c b/fs/exfat/file.c index 781b4d4dbda1..8041bbe84745 100644 --- a/fs/exfat/file.c +++ b/fs/exfat/file.c @@ -29,7 +29,7 @@ static int exfat_cont_expand(struct inode *inode, loff_t size) if (ret) return ret; - num_clusters = EXFAT_B_TO_CLU_ROUND_UP(ei->i_size_ondisk, sbi); + num_clusters = EXFAT_B_TO_CLU(exfat_ondisk_size(inode), sbi); new_num_clusters = EXFAT_B_TO_CLU_ROUND_UP(size, sbi); if (new_num_clusters == num_clusters) @@ -75,7 +75,6 @@ static int exfat_cont_expand(struct inode *inode, loff_t size) i_size_write(inode, size); ei->i_size_aligned = round_up(size, sb->s_blocksize); - ei->i_size_ondisk = ei->i_size_aligned; inode->i_blocks = round_up(size, sbi->cluster_size) >> 9; mark_inode_dirty(inode); @@ -159,7 +158,7 @@ int __exfat_truncate(struct inode *inode) exfat_set_volume_dirty(sb); num_clusters_new = EXFAT_B_TO_CLU_ROUND_UP(i_size_read(inode), sbi); - num_clusters_phys = EXFAT_B_TO_CLU_ROUND_UP(ei->i_size_ondisk, sbi); + num_clusters_phys = EXFAT_B_TO_CLU(exfat_ondisk_size(inode), sbi); exfat_chain_set(&clu, ei->start_clu, num_clusters_phys, ei->flags); @@ -270,9 +269,6 @@ void exfat_truncate(struct inode *inode) aligned_size++; } - if (ei->i_size_ondisk > i_size_read(inode)) - ei->i_size_ondisk = aligned_size; - if (ei->i_size_aligned > i_size_read(inode)) ei->i_size_aligned = aligned_size; mutex_unlock(&sbi->s_lock); diff --git a/fs/exfat/inode.c b/fs/exfat/inode.c index 804de7496a7f..82a23b1beaf7 100644 --- a/fs/exfat/inode.c +++ b/fs/exfat/inode.c @@ -130,11 +130,9 @@ static int exfat_map_cluster(struct inode *inode, unsigned int clu_offset, struct exfat_sb_info *sbi = EXFAT_SB(sb); struct exfat_inode_info *ei = EXFAT_I(inode); unsigned int local_clu_offset = clu_offset; - unsigned int num_to_be_allocated = 0, num_clusters = 0; + unsigned int num_to_be_allocated = 0, num_clusters; - if (ei->i_size_ondisk > 0) - num_clusters = - EXFAT_B_TO_CLU_ROUND_UP(ei->i_size_ondisk, sbi); + num_clusters = EXFAT_B_TO_CLU(exfat_ondisk_size(inode), sbi); if (clu_offset >= num_clusters) num_to_be_allocated = clu_offset - num_clusters + 1; @@ -268,10 +266,10 @@ static int exfat_map_new_buffer(struct exfat_inode_info *ei, set_buffer_new(bh); /* - * Adjust i_size_aligned if i_size_ondisk is bigger than it. + * Adjust i_size_aligned if ondisk_size is bigger than it. */ - if (ei->i_size_ondisk > ei->i_size_aligned) - ei->i_size_aligned = ei->i_size_ondisk; + if (exfat_ondisk_size(&ei->vfs_inode) > ei->i_size_aligned) + ei->i_size_aligned = exfat_ondisk_size(&ei->vfs_inode); return 0; } @@ -317,10 +315,6 @@ static int exfat_get_block(struct inode *inode, sector_t iblock, max_blocks = min(mapped_blocks, max_blocks); pos = EXFAT_BLK_TO_B((iblock + 1), sb); - if ((create && iblock >= last_block) || buffer_delay(bh_result)) { - if (ei->i_size_ondisk < pos) - ei->i_size_ondisk = pos; - } map_bh(bh_result, sb, phys); if (buffer_delay(bh_result)) @@ -680,7 +674,6 @@ static int exfat_fill_inode(struct inode *inode, struct exfat_dir_entry *info) } ei->i_size_aligned = size; - ei->i_size_ondisk = size; exfat_save_attr(inode, info->attr); diff --git a/fs/exfat/namei.c b/fs/exfat/namei.c index 631ad9e8e32a..6313dee5c9bb 100644 --- a/fs/exfat/namei.c +++ b/fs/exfat/namei.c @@ -372,7 +372,6 @@ static int exfat_find_empty_entry(struct inode *inode, /* directory inode should be updated in here */ i_size_write(inode, size); - ei->i_size_ondisk += sbi->cluster_size; ei->i_size_aligned += sbi->cluster_size; ei->valid_size += sbi->cluster_size; ei->flags = p_dir->flags; diff --git a/fs/exfat/super.c b/fs/exfat/super.c index 1f2b3b0c4923..61d8377201f6 100644 --- a/fs/exfat/super.c +++ b/fs/exfat/super.c @@ -371,7 +371,6 @@ static int exfat_read_root(struct inode *inode) inode->i_blocks = round_up(i_size_read(inode), sbi->cluster_size) >> 9; ei->i_pos = ((loff_t)sbi->root_dir << 32) | 0xffffffff; ei->i_size_aligned = i_size_read(inode); - ei->i_size_ondisk = i_size_read(inode); exfat_save_attr(inode, EXFAT_ATTR_SUBDIR); ei->i_crtime = simple_inode_init_ts(inode);