From patchwork Fri Jul 5 16:24:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 13725369 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 B2BAA16F0EA; Fri, 5 Jul 2024 16:25:29 +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=1720196731; cv=fail; b=INWTi0oz51rIv95pcC10jNKImr1Sd8Pqv77wYV3VqSWGa9TczhSbXXVyCLAcu+rq8OBFy3Yr3kMrZxsEONMmLWLkBiu7i7O1WU4aI4XtjzEhAhxwzANI+IIqot7JTOezIF4xvYAJ97PT7JAdJuB40oJGajZb7tGIqyjdLqBtmSY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720196731; c=relaxed/simple; bh=rZVCo9aLhqp1blOlClj0pjFQK9NTtNJrDY8y9Frur4A=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=SXwjvBYaTN9DyS3iOvythGKy+ia86NBW1FaTF2oKnr8Kzkv/DWhlzD17uxegCYhjLu1+VFDoy8X8LV3Gs3hoF9n5BcZOEaMZARGt9ujWCNaYrsY01SfzoSBFd9iWHbb9/n1RPVLXDWHoCwApuFF4FKiritqTjKWHQ0XX5qHSgQQ= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject 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=NCOb8bEg; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=J3/pJnbR; arc=fail smtp.client-ip=205.220.177.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject 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="NCOb8bEg"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="J3/pJnbR" Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 465GMXvs007941; Fri, 5 Jul 2024 16:25:22 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=fH+NjeJoJ8kTTBBuZuuq71TIHENCLkxgvQrCzd+oBag=; b= NCOb8bEgv6DWUFl9sfXaKlyPGH680E/4qY5cvv+QWaYHH2njIqKM+Ib8GFhbqFMf ZXE8EWw06SF1ed/qK5CGSbSmqJHZatqQVhStBGqWyIKyGmbjHs+RVXnbu+FmXy/Y H5Rehju/7ppV5gOFHLPBzRLeS7OgLtijBPxiHejYqsvveDmz2fcB7LSGAxbqcIe8 6KybG1VP0iOUZWOxnl5Q2FYVNHswrdcisty/jbx9pJnmJ4lq2UH8to+jYzHWe+xZ HbzcRmUtAhc21q0IYqetn7MYGYvZknNLegs4jrktM/36tgARCczFJ7R13/7aaH+z qnjKbVK6JDlfr0PAM2kGtA== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 404nxgns5f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 Jul 2024 16:25:22 +0000 (GMT) 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 465Fs18t021462; Fri, 5 Jul 2024 16:25:21 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2046.outbound.protection.outlook.com [104.47.70.46]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 4028qhm3mc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 Jul 2024 16:25:21 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LcZcQ97tXYMyQ6GOhDWKPtiAs87jJdH9uox/2BACy6xqYOSyAc2fuoMsjisKoDTN/Qextd8ULzDTnx9voSkPRdsEW2ims7ZSIPN7k4GfHVxQl7ecZx5+tiCh5Jv8hTtTWjymv2omPdvEP9lVJpqF2QSajU66KdObQohM4CrhqZ9+VRggKSAeHEyNh5crXj12QhevgpGfEZF0ftvHte90NiuYh0pkorxw92btqqdJqdmFR5fz0YfT1ZK20u7fHC7bXQx4OyZWSLohbSjNpqsQZMR6OYj4XiaxOu7mKJyoSWNd6rIgnGhULuDtUH+X11KY7WNn8aUjM/dW5r88IYO/cg== 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=fH+NjeJoJ8kTTBBuZuuq71TIHENCLkxgvQrCzd+oBag=; b=TmtnwkVLls8VPCOJ36KqtEBdsOOarirBbntTKQhR0AYVNl/LvcaV/OEWS4U0yYrjg9xRdQEZILns+EFRkUwVN+pFBwgGNbhkoSlsgbxtXTT8aHBxxl8LH1Nso/BYd4YKoDoR9yP8KAZXXULHX3NLb7ScJaf6pxCdmSnaaZ8V9/bm9RQGSx5bSjxWdN4U2B+mBSISk1GiRhvZ7ZKK8G9X+AWzt9f9l6uWlpKfAC/oveDrL7sLeZ6Oh8L9FEALBr10kqsti8Zrup+SzjmE5e+ISSsLm/wEtf5DW03hqYPS4ENF82j3LLMa/Pm35R2UoDvt86pN2b4qj3mgCkwW3EaP3g== 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=fH+NjeJoJ8kTTBBuZuuq71TIHENCLkxgvQrCzd+oBag=; b=J3/pJnbRbkCZgpJpJtfL4xg4qu0dT0pB5moupO8gvWdkZA7mVl2FLDiLELxtd6mWpcFnZN6FH+Ta/KuOQ2qcONdLtxKuFzmTCCEWrTsBI8Qq2+Nicr64xCuAVKIMoDoXPG4PRlF2V62bvBKi2sH7GHCEBnrhLfdjc+HzuhJLcJ0= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by LV3PR10MB8201.namprd10.prod.outlook.com (2603:10b6:408:281::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.25; Fri, 5 Jul 2024 16:25:20 +0000 Received: from DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088]) by DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088%6]) with mapi id 15.20.7741.025; Fri, 5 Jul 2024 16:25:19 +0000 From: John Garry To: chandan.babu@oracle.com, djwong@kernel.org, dchinner@redhat.com, hch@lst.de Cc: viro@zeniv.linux.org.uk, brauner@kernel.org, jack@suse.cz, linux-xfs@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, catherine.hoang@oracle.com, martin.petersen@oracle.com, John Garry Subject: [PATCH v2 08/13] xfs: Do not free EOF blocks for forcealign Date: Fri, 5 Jul 2024 16:24:45 +0000 Message-Id: <20240705162450.3481169-9-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20240705162450.3481169-1-john.g.garry@oracle.com> References: <20240705162450.3481169-1-john.g.garry@oracle.com> X-ClientProxiedBy: BLAP220CA0004.NAMP220.PROD.OUTLOOK.COM (2603:10b6:208:32c::9) 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_|LV3PR10MB8201:EE_ X-MS-Office365-Filtering-Correlation-Id: 62a1b470-d82e-4cae-598e-08dc9d0f0fba X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|376014; X-Microsoft-Antispam-Message-Info: JQVkUC77sMffXaQ73Ge3WU/XhFeYCzlHZshdjUxb+CTk2blzPjkzVwQafVzeaoJxelsnng24DenPr10tJAQK2eKyJns78JW2Jz/sschfLwPX76oSOV/U+4Wzrb5eUQuP2ZFH17VSpyNuz8n1VwqumF3Eqa+NyE6Fn96/PERgO+gyeUBRX0wV0GquDoM99ycXMH/JjODNxNtpwxpCgk2MmlOB50+6q3eiu7KxWiIOxfOUjgaZP+Z3kQgnW8rdwHp73TEJJoRoGm540hfI6qwlSg6Z2QTMkEzJjAUWnhvyP32YIx2YoNKkMzB2yIa1ovcRPYTePPlPDCgXMaOsEZLy+bPuFf8qjX9EInqq09QgmbnMac/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:NSPM;H:DM6PR10MB4313.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(1800799024)(376014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: E+CMRZ9wlNQ1v5RZcBr20aYoU5Rz89cPCp9SD4uroTPhYg3SUd4O1b6GUa7lN4zhN3tG/zTjhr4dNzmEHGlTucb9D4N9EEbaIG5ZBJp+u21gRVMGXmf07gnzVL0LxZEfe8LGHNnmVze+QvPovmVnDxJAHuWPMr4sfYnBRhRioNBF+p3neLcCuQUANiC4RyyjhBmp2nF53JZczJoFrcP+n6Qzy+5jsgg6xnYSl4vdw9BpmjxKQHn0gyFOjd0w9nPumNGnUiC5fgJ1GxrwgC2KmljgGTZY+tv8xLuk1PsFyZA9zivVYMF5Iwoqskc44iN2Wt0mKO43i6yoff3cV/e5yEeWAaslhsLvF53Oaww85xJ1E/zpHEULw+isFOKxb8meAfMstxNAuXNqXaVZfEBXmkU+mY7Qnwp+6rshvgXwxpYsEEoqburm/+YUDVII4y+hHPMOWTkgjOSTNY2o21S/0jSRm7WuZ4g0N+kJry4ydRF0uBR+cEBMhfqAnxOHg9J/jzFrSjREwqZi12C4iv8pEiBkkw5bFV8Hn/3UjE8+mLLRu1Fqi+oFgC4sJ2toz8ye8Z+PTgoH+ZAePmef3xWCGvGpLRe3NlY0+A4HPUERudXQn/2/BfkyoSRLGqZL/sarrrqLkhTGxU2nrQscJglLfQQNDoMdSyV+zZjcO7MNSetzMkSj/4BtLui/hVfNnR9Ik9UrDdUEr3DH3jxwWDaYlZ8XWQHGlawhIlNBGXpZLd6XJGAVwWSxUZDlJTGegDNoEf4SJP6qekhlMgSlAjjoMIEQos6M/M2OZQEHUYN4maCQ6qInpX7+WV5JSUqLNHxOTmnllAWRPQddnPYxODYqM8LzwNNyQc/crKybcfsx7ZH1kaoOo4HokYBXEfsB7cYl0reyLBHZ/YGa0PGw1/oVK8iczS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uyXzrC3V9wpPrstBmraP/TzAeea99kKEtIeWJJJ9lmxBeQPnrLMoCXLwhYnj+eq46Hukt3GVuqfdSxFCczWDuQ61upNzfkr6i52SOmP7vRQ9A1Ek0q7ho1R0vjR7J9Kdt5w+LJPWx5MjbL4FDT17IFI2l/RPwhKBIJ7/pn1gGI7FzGeVegQsOZVL5KNP9ACA1Bldq31po8S1R4jZM9WHxaTv7BgxNWNjX1WDSmZRXYHtwlBqrZFkCAlExbh1AHoRswOLPyjH28vOQbZm/7gtNmI7svio+21j5+vFQFjnZ0id7ALrFnHlPkqdDVTypVzV3vU= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 62a1b470-d82e-4cae-598e-08dc9d0f0fba X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jul 2024 16:25:19.5709 (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: QdJnPWtH3xXI/L6JkBc/iRvcCHFVmVR/X3edn6kpKIln0AunbrLq6q/MhRqls5C9P55hMkibBnJ2h3iq/X952Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV3PR10MB8201 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-07-05_12,2024-07-05_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 spamscore=0 mlxscore=0 phishscore=0 malwarescore=0 suspectscore=0 mlxlogscore=999 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2406180000 definitions=main-2407050119 X-Proofpoint-GUID: mHqv-M374h7GUqfwctf-LD2ElSFI2ZrO X-Proofpoint-ORIG-GUID: mHqv-M374h7GUqfwctf-LD2ElSFI2ZrO For when forcealign is enabled, we want the EOF to be aligned as well, so do not free EOF blocks. Reviewed-by: "Darrick J. Wong" Signed-off-by: John Garry --- fs/xfs/xfs_bmap_util.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c index fe2e2c930975..b9f8093ae78c 100644 --- a/fs/xfs/xfs_bmap_util.c +++ b/fs/xfs/xfs_bmap_util.c @@ -537,8 +537,13 @@ xfs_can_free_eofblocks( * forever. */ end_fsb = XFS_B_TO_FSB(mp, (xfs_ufsize_t)XFS_ISIZE(ip)); - if (xfs_inode_has_bigrtalloc(ip)) + + /* Only try to free beyond the allocation unit that crosses EOF */ + if (xfs_inode_has_forcealign(ip)) + end_fsb = roundup_64(end_fsb, ip->i_extsize); + else if (xfs_inode_has_bigrtalloc(ip)) end_fsb = xfs_rtb_roundup_rtx(mp, end_fsb); + last_fsb = XFS_B_TO_FSB(mp, mp->m_super->s_maxbytes); if (last_fsb <= end_fsb) return false;