From patchwork Mon Apr 29 17:47:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 13647482 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) (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 51A341292DE; Mon, 29 Apr 2024 17:50:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.177.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714413048; cv=fail; b=YZwYMyISpM0wciWtcuiVfz0m1kCrAgqRCEmC/7pfPK9CftkrYPMT3fwa5gb43EQNwtHHcZQHuHuWv1nTpAKK1NRiXXBfujNf3qFHGpsvBkA6Kk5WVSm1TmiSY9v4oPo4yyvl7n5xgj994vn5bk0XuP5zMhyiQUvre6wY5q9e1/M= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714413048; c=relaxed/simple; bh=Lfj7dnv4oK8/tZrWvQrNy4WYdN8nGaWeSFop3om3WsI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=fn/ZPOjTEVQIZpoXbzxkuumaUUsIN2QH2zsF8SIhr6oQR3oiWh6v48V1f7dUYGgxz++D9qFcgyvT00Shl6ZDNuTylY1C0q6a3nkYSGqSoUtguRw1Plkltrbpx/34bouyqu4R04m6fr7fg+42Gg61FwZaBEBiMIqgeHSLkBsBGlQ= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=likBJE/v; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=OBytg7q2; arc=fail smtp.client-ip=205.220.177.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="likBJE/v"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="OBytg7q2" Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 43TGwmR9002385; Mon, 29 Apr 2024 17:49:05 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-11-20; bh=R5W4dPRDujBA5kLMQBCt7AABRo3nuz6Ha5zCRBAM1Vc=; b=likBJE/voF84C/csKKuXZy6kZjap3Ll6yRkZzefpsu2usYWjSYTEN7Q3fsVSEkCTDMJr KAbA6Nk+ui6b+RZK3lnu0bu/GcWSYE6I7oQAWYBI3bcL35broeQxH4trNiPk4oR2x1Ul 2zad6vaERj9Cf0nQ/GTftPgMadWzjUBGqfQ9BB+ZSnQIWhFfvln5emeAbnVXVEaS6CbK i6ebIqEdXJH/piONoThO/5JHzHVkspuYROAfiBneGCOu7JQdzapB2QzXWc0BZaOSbEaW E5742evpZZEq2fbl9GU351qU8fF480R668iFeCU/BsE3NA5pXsJQ1kcjcxRcsnx7Vkjd 4w== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3xrqseu6qp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 29 Apr 2024 17:49:04 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 43TGRTcs016720; Mon, 29 Apr 2024 17:49:04 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2168.outbound.protection.outlook.com [104.47.57.168]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3xrqtcpxpb-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 29 Apr 2024 17:49:04 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fSlZTJnY0MpgoljU7NzMxhHlHQHNo+2nMeiqteuhws/LWZOurzcD3RgUIiqqNfIgwaV/WKkS50YVh6rbW/WoT7YESoJtSutibJoHQA01AsOK8UzWYJmEeh2wpVp5lkjGkjZzbNBrkqXNqUAsSJev/g3hUlQbb8aXaC6J81u/HTafPM+I7H2AaVMf34MX3HqxY+7FU/VI4tHT6xPCtCpG20rwXLNjew8JZyupS+xVvW7z5yGpw4aKcdLQBp+BPftZ14WNxeeMtNgFaXxfy/LpYFZ6FRgjDKywnr0zbX9uXh4ity1D0Mv2FHc48wrMiyeud5KKH5Fy9oS7nrJ8b9qp9w== 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=R5W4dPRDujBA5kLMQBCt7AABRo3nuz6Ha5zCRBAM1Vc=; b=CrPGMZ3DNdfbRxyS/8F+gR8liD+5PA+DuQk9qxHygRj7ptyBZIL29O4+w0313HIncS0uzLPDUWa5bR+wiAgq3ngw+u/IrO4HdDA5H98Fyt782mgsxTAx6jyHhGoPz1e+qT06ZV9Ct52ncJyICFVkenLEDd1DcxZVVYM+HGFfOqNwxsHSGfx7XXLxv/gPDIya7Ov/gGmtuMG/t/T6xA88M+EscNv3bYUDL3W5LWH/BMr1YVXbMiNSVPn9XO8f3tvXVVoDyXkME1gAaFszwXQQp4xuOKaG7iJHNKlfirncDnHkuyaiMgEP5T4mr9giFhDTUYgCQq2EqrhzNUgKLUMJvQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=R5W4dPRDujBA5kLMQBCt7AABRo3nuz6Ha5zCRBAM1Vc=; b=OBytg7q2rR8iluTyZjXe3KXyi4aRV1L8q2RSz90CwcKKgfYFAsuvYAD6/XIkqRBmGmDLPn/PGjLQn30xk6YN44w5Jyy9SflvDsMjA6bLUvn4PiHC0wJQGMJ/DaQL1Sfb4t1cjxd4ykJuHmicm2bm6MwjkNfdU2Fs6nZAfum6W28= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by SA1PR10MB6389.namprd10.prod.outlook.com (2603:10b6:806:255::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7519.34; Mon, 29 Apr 2024 17:48:31 +0000 Received: from DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088]) by DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088%4]) with mapi id 15.20.7519.031; Mon, 29 Apr 2024 17:48:31 +0000 From: John Garry To: david@fromorbit.com, djwong@kernel.org, hch@lst.de, viro@zeniv.linux.org.uk, brauner@kernel.org, jack@suse.cz, chandan.babu@oracle.com, willy@infradead.org Cc: axboe@kernel.dk, martin.petersen@oracle.com, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, tytso@mit.edu, jbongio@google.com, ojaswin@linux.ibm.com, ritesh.list@gmail.com, mcgrof@kernel.org, p.raghav@samsung.com, linux-xfs@vger.kernel.org, catherine.hoang@oracle.com, John Garry Subject: [PATCH RFC v3 12/21] xfs: Only free full extents for forcealign Date: Mon, 29 Apr 2024 17:47:37 +0000 Message-Id: <20240429174746.2132161-13-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20240429174746.2132161-1-john.g.garry@oracle.com> References: <20240429174746.2132161-1-john.g.garry@oracle.com> X-ClientProxiedBy: SJ0PR13CA0016.namprd13.prod.outlook.com (2603:10b6:a03:2c0::21) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) Precedence: bulk X-Mailing-List: linux-xfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|SA1PR10MB6389:EE_ X-MS-Office365-Filtering-Correlation-Id: 1a16b780-9eff-40c4-bd3a-08dc68749577 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|7416005|1800799015|376005|366007; X-Microsoft-Antispam-Message-Info: BgpTXzLStBBymoN2URJi//MLVrQaNewGIoUmWEOV6BOIbEE3KrT0DMTNnnO1ow7q9js6YXgEN6ZsbipKjBpmdQXXH+IRO3DxdAlRwKm9+qLTon+tpimwzAmhXizKEX7wYu8uycmMkPcD6DYN82L+P/WoGT1RLpxlp4LGFLR3iDepHClt28iTMvwNBjjB4G+h46Y38luyvprRs45nPFZfV87oGkJ0Uv57jq3nuAHhmYL2ZftWw8jpCGS+MBYVXobZXmr4fH3VVQfLvdsoSZILpUX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:NSPM;H:DM6PR10MB4313.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(7416005)(1800799015)(376005)(366007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: UP3KRZPJfLY9H8J3XhlSS/jBiZkb9xIznhOTDUQyzXdD6RtW1fYUN59cBlnkZ3aPJzw43L3Fu32SMBxVUZS+Kn0OPzOfbMz0ONR4Uvq0jiJ3ne6asz5OiuSmLJvdnHFE0kfZWLLplBahLHtSDjtP+Mw+YRbg5z5njP+i5BiIWJWrKcGFKk8KBOtR7OZfCmK90nH0mKkPEXek6Y6K8R2sm0qEACBZD5y83NY3+C3SPPvzCSHDgsucCRMw3Z4w2PrGMYWRoKvUVP5uiPDYshovorIKMyH2y3DkamxBVRetF/wcYrSNiXc8Xuzg7bKUTGUhFFB8KSTaK7NArn9YeQ11m+09L3auW5zNNeV10/G1bJZyuILVt/sILkTyCnUsn8PA73wCbzB6b+U0XBhpk/zDrKsRGYvnybGQ9zs2b4Z+Xr0Q28RFANdAAOHX5HkLIfCBZk3hzF1k5FWlfPITy+scLa6SRLFb1yt+gyOWl3KElnG2H96+xR/EIKbsCCcURBWXeoAoDrloxIag5oAb0GjVDz3sKm5LzstukkQQJd7aqhhpZLG37HJbvZWOT/2IeWl5LN1hEAb/NdsNQejoUEcrSigg4HnLzFJZsI1df46urI5dbSHdqpJBTwoJnvOG2qPgw1TnX2kkSsdmW2tpVUSKMy5LxSaxi5p0z54yBAhydY/wNw4Ike8I/RDDE0zJrhUb4R2NaIgQ+0ztjo8al4uVEsrRvJhVLYaThAkAZYfARwvimtZFuwPB6uLXaJDytuor6To8aGWQTrQ4FkdwYeEH6PDPdi7W2amb0JfrhumnU8Y8A6twB9RUnlmcAz5v7PI5gAxXGO+cLAhdxd0ptc3dDE254m5TY6tMyUyJ5mjRTwzOBWLXv5R99uevHFxHBvxVXR9edriGZf7Yn6v8kAx+bUenHL41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DF2BOveV7HUWZwPmxwuLe6FIkynx4mCxeqOVekBfyBxVKYOTC562fz/E1vGV49+7zeW+dRMrs8A7gpLcpRKwWga7kDNaCuaVq0NQR5duhYFXe6Rp0L+6eYb5Dvd28ZbyXhr1dzAf/3dVWB/hw+OZwDSbzai++UPYNi38mvKzupvMHPNWKmzQO9UNiuqRU68mkablfZ5iEXHlgzyKyMk2q98vQM7JuBbk8pp9kF7jNk1KQ3NQFQo6atlcICKW3fjpwzWVTUACCiP/jNWgnyzOQTuxtMg4fzxZ1QP4CwaLkjTGQ/CeRIsx0/vtxKG2ImcUXHyU= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1a16b780-9eff-40c4-bd3a-08dc68749577 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Apr 2024 17:48:31.4206 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: casGE9bpcE9Gp7Ptcs7713NE1YykhwxthcxUs3JbnvQeynd2nj96Ki4YgCYL0KX726dUVAM4G9N7ce2JXQ9kpw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR10MB6389 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1011,Hydra:6.0.650,FMLib:17.11.176.26 definitions=2024-04-29_15,2024-04-29_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 malwarescore=0 phishscore=0 spamscore=0 bulkscore=0 suspectscore=0 adultscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2404010000 definitions=main-2404290115 X-Proofpoint-ORIG-GUID: UADoqFf8zx7YVw6YBSeZQm5wU0rBvb4p X-Proofpoint-GUID: UADoqFf8zx7YVw6YBSeZQm5wU0rBvb4p Like we already do for rtvol, only free full extents for forcealign in xfs_free_file_space(). Signed-off-by: John Garry --- fs/xfs/xfs_bmap_util.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c index f26d1570b9bd..1dd45dfb2811 100644 --- a/fs/xfs/xfs_bmap_util.c +++ b/fs/xfs/xfs_bmap_util.c @@ -847,8 +847,11 @@ xfs_free_file_space( startoffset_fsb = XFS_B_TO_FSB(mp, offset); endoffset_fsb = XFS_B_TO_FSBT(mp, offset + len); - /* We can only free complete realtime extents. */ - if (XFS_IS_REALTIME_INODE(ip) && mp->m_sb.sb_rextsize > 1) { + /* Free only complete extents. */ + if (xfs_inode_has_forcealign(ip) && ip->i_extsize > 1) { + startoffset_fsb = roundup_64(startoffset_fsb, ip->i_extsize); + endoffset_fsb = rounddown_64(endoffset_fsb, ip->i_extsize); + } else if (XFS_IS_REALTIME_INODE(ip) && mp->m_sb.sb_rextsize > 1) { startoffset_fsb = xfs_rtb_roundup_rtx(mp, startoffset_fsb); endoffset_fsb = xfs_rtb_rounddown_rtx(mp, endoffset_fsb); }