From patchwork Tue May 28 17:15:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 13677048 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.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 104FC17085F for ; Tue, 28 May 2024 17:15:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.165.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716916548; cv=fail; b=E2Me2exnKne+DUmjYJp1v/Epy6M+db+a7vr3PUuTYHc29Ac851shz1Dd5+Q5K2SvVWEqZgtc6Nl+N/Elkks/ZpX+KxWJX5HZqhedbMxmnMm40vk9kscAP3vTHxKvcRGaKZMDWBNKIL0xi5GHVi8Fpu8e2lqYKQbnge4h2jt7QcE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716916548; c=relaxed/simple; bh=i7WzV804eUb9/zVKaPBaolc+t0XDggaRxZIXTB6NnX4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=hSBAfMfKNRT3CTKBXLWR1+SbzxPXFO0k1A3P27z2P01wY08TSsuuKNqp784qy8GYU/iiLhSXh8+GkfIkpJOsw3I9b34SJHrBC+C1fJ2B8DRI0foWgZoXf7iJpWxlYk+z6+V4vA4/x4ZzF9LIe/Hcd1U1rYe3fhLYy5UNIig65FY= 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; arc=fail smtp.client-ip=205.220.165.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 Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 44SBpL7r002895; Tue, 28 May 2024 17:15:36 GMT DKIM-Signature: =?utf-8?q?v=3D1=3B_a=3Drsa-sha256=3B_c=3Drelaxed/relaxed=3B_?= =?utf-8?q?d=3Doracle=2Ecom=3B_h=3Dcc=3Acontent-transfer-encoding=3Acontent-?= =?utf-8?q?type=3Adate=3Afrom=3Ain-reply-to=3Amessage-id=3Amime-version=3Are?= =?utf-8?q?ferences=3Asubject=3Ato=3B_s=3Dcorp-2023-11-20=3B_bh=3D4nix+1ihE+?= =?utf-8?q?kJxK0Ilee9IdZ+/K9IGCSKUme5R3KcTw0=3D=3B_b=3DZ08XUaDuXupeQFzRSd35j?= =?utf-8?q?w4L9WxD/zWCQTpqB/F1ceZ25NLAHDzZS2V+5Zik25Z90k5h_ezj/FCPEMmZ232GDJ?= =?utf-8?q?YzIRm+Ql583mW4jXr+bDdYeunNj6CnTIgFAaVevVkexQNqj9YmA_keBBXfvWjLvKP?= =?utf-8?q?lvembJbJZTR9oMblxydrIY6qwGJLbPkIEfRlE54yY5SUgaPliGFevnt_isT+Mtt4h?= =?utf-8?q?QWgAmw+MVmnlwIdexk8Q7WP3Sen2qsfWxir5SyaBKWADhFA+T3vVQwCSPvf_CXiuw?= =?utf-8?q?98VYoqQ0vLX0ndNjNwFBPkR007CfVzDf1l0c+/qAHVahbyyAXtyFdhzmItazKoi_T?= =?utf-8?q?A=3D=3D_?= Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3yb8g44y53-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 28 May 2024 17:15:35 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 44SGPcsv037637; Tue, 28 May 2024 17:15:35 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2101.outbound.protection.outlook.com [104.47.55.101]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3yc5065t00-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 28 May 2024 17:15:34 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZGpBtJtZTJYnATJI5DGtpDcpo6S7FmEuAZuG8SJnPj6cyS8rq0bVjQGjlmhXOLn/KVQM8KkfOWZHiDCAzlPBrKUWrJ6BS8qjkdroDfB026kExwizsctr1SioowGPcwTTTk+Hi8FTG4mZnRiumkgXnejlVDBJd/3X8G3H8hDCf0WZVL34qPQBaFTzpmj1QREKHs5vK3zaBFC6GEuOV8Gh2mHAjm+F1oF7sJZpL2i5PKOM1J+DppXvTIMvur0S2rwAF7zvczbd0EsvH91HaX3VXGe7gEoupl5k0Up2N5v49L69YrFZB4eEqPk4ES0nQ1QkUnaSTEJ1nogqcp5ByLQKrA== 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=4nix+1ihE+kJxK0Ilee9IdZ+/K9IGCSKUme5R3KcTw0=; b=Mzt4I6ZLiM8Su8E/4ilS66tloy9EQiUuAm/hgO8klW3/GUALUk3VmW2eDAg+FTPC+r/NblZ0xCHbfLhU1WFBp5DUEMUfFF6DvEfywhZy+8qrGDydSHwv7airXGxihZI1p/GTsxcMeptR0PNLWU0CWu0rR5Tf0Fww7zNpjAz82vpr/f6m6kkFC8EiW0O+4BtVgi/hxLqWy3MeMtJsqwNGMyuKer7UNIgaCSXHzYgbawMihdcvDawsuMejdypB3xHhPt8mJiT57asHqMvciNhVM9HLAZYNGcOlyY9kh+5cBe3z+C4qIQfVu/XnBphoC4iBZ2Go3Wq7o2A0yCktgWM1Sg== 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=4nix+1ihE+kJxK0Ilee9IdZ+/K9IGCSKUme5R3KcTw0=; b=Eh1gqknUijTlKfJEsY4y0M6ULQE1ZVmSai9CgUCJ1lw9sSGJMrKplr5oJrLmpgpXBIHgKVqb3YtaXsqFhxQpXvWbQ6pL1oTJQrMJZRV3SKZW7q1xcVjXUQFYbbHjHVnR9uLolzeCTE5fv3UcqAfSeacFs+IAFq4mLrNOcCdkXMQ= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by MN6PR10MB7999.namprd10.prod.outlook.com (2603:10b6:208:4f4::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7611.31; Tue, 28 May 2024 17:15: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%5]) with mapi id 15.20.7611.030; Tue, 28 May 2024 17:15:31 +0000 From: John Garry To: chandan.babu@oracle.com, dchinner@redhat.com, djwong@kernel.org, hch@lst.de Cc: linux-xfs@vger.kernel.org, John Garry Subject: [PATCH v2 1/2] xfs: Fix xfs_flush_unmap_range() range for RT Date: Tue, 28 May 2024 17:15:09 +0000 Message-Id: <20240528171510.3562654-2-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20240528171510.3562654-1-john.g.garry@oracle.com> References: <20240528171510.3562654-1-john.g.garry@oracle.com> X-ClientProxiedBy: BYAPR02CA0048.namprd02.prod.outlook.com (2603:10b6:a03:54::25) 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_|MN6PR10MB7999:EE_ X-MS-Office365-Filtering-Correlation-Id: 80b191ce-fdeb-450d-61db-08dc7f39c728 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|366007|1800799015|376005; X-Microsoft-Antispam-Message-Info: 2VnrPziZU4qL6EfWgsLcHnhpZaGiWslf18e3KTVRdq+caAtkGhskTbHzCcUISMHy7iH1Y0GBjd7sfz7EXctSq4pSIXaurZ+w5QlLqwTtl9fye7A2sOhVoWqHrbHIbLvwLcFhsywK/X6IOi6ljsmK/uUqeF00+ZsgKJmNav6vMA0bFk5ZSsQkt8hEJx7/F4qqRz87oy4Wpzz4UILPxyPG8gzzGHZ2tR//2fSlhFgBPhm1JxfDSmof5fHbcM+SDge79CQsVfYPY4rz/oWfIn3CHexDp8wXthYNaM6oRZ62kXzIi8uAwWio/jZ2+yPCzPfEzauHlAD9Rj4fotxlZPUK0PPiFsz7OU4jrRwuX3jbiy0gkDgX0/WHC4qbjvY0pB5wWlyRgXsJpha2aPbgj+b2SQPgoYWRnd+uAUbb3Pq0TSTMnr7YPilqnAjwfkOcaM33yGUWTsqe29Lkjtgze2ilTQFxIT+qHAupcJmMU/g/lvfr3i2OOVvNjMXU4coN/1CeQoNxWLTmv7urIQswjcK3RsbT4HwNAZFpv0Rovr666IJpQjoBCRwDnWcUbAOXUcKiBy7MqB6DGB7yezqjdMyOAHwP4VOoh09EYm5JblH/KnWQQMYe6S5N+tOmJRtYg+UIT3LMtoQZ9IMt4Idy0X2+BbJHJVFfmXOHW+q3vzRg1jb2AAkc5hElXy7puxzgQts1TiAfD5f0mImOVtWy+jkomDr0/GNxE4QxRRxWzfKW2PLHZuTNXqHBTuD9Bs6GIYi+n2h08KtXFuJNM+TZius6y7JggMuWAwAQiuMgHmfWmUpPtPNlRVjTuD9BEPLvaP3ZENLpsCpBvdS0wmeAPdm8GWBo0/C9r4CP1j3y3j1KfmEPRJRLsHJAkMRlgCP8HRouBDAlopKA30udixtgHm3nmqVFGhyznzYY/x1pzTJetKwvrLdK2oOM9LOpTtH5UEr8ZMJQlyJ7aGMiOrklbqkewTXhsP3PI0QA+p6RF6qGKcR9aSPvVnw8LsGe5A2wRaa7sasfi4pMEu8z7Wi9toRWh7vsmQ8yYUn2Mfd8MB7wV6agWpiiuGMzng6o0Z2+J8os8bgEDjiVVfltkjhzbw7OuI5okF38kb80YvAzByMovC9SKLCkVQS6n+s4RSATBJTIJRWqvG3RW4ZPPLD4Jw9xQ1A0Yf4FXz/0jdYBmAM7IkhLK/wqrI195MJHqPuTD4htL76Yd9YVsLidtNUf7dHA2v7M5dA4U21bRL1eSrZubgx/XWkmTk4+5d8nlp1z9PuNKGOJUV0oO6JLIfgJKwq/rA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR10MB4313.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366007)(1800799015)(376005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: /UIa6dJ5QgBtBXW+Un1R+1f2VAZUV1Yz9ApXeUYwRIrMpkdjg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Wc2mDQDRug/+uusNtJcrgGJKmimcK/RQNY3lHR2em39Cr0GyLtaOcMKX6O9Dt2LfGAS6rgZpFAJruuIg8jWW4Q= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 80b191ce-fdeb-450d-61db-08dc7f39c728 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 May 2024 17:15:31.2138 (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: fWBwcu0EQqgjjeSF1gwTG27aqmAJv7ve/PJeABHIFfyZCO1Fdlb+Lmj0arfafrt1vvRxsaGt4u26D7Siy4KsuA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN6PR10MB7999 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.650,FMLib:17.12.28.16 definitions=2024-05-28_12,2024-05-28_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 mlxscore=0 adultscore=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2405010000 definitions=main-2405280128 X-Proofpoint-GUID: 3hJjJd_vO89L1tJBkLifyLHsuc53NuC4 X-Proofpoint-ORIG-GUID: 3hJjJd_vO89L1tJBkLifyLHsuc53NuC4 Currently xfs_flush_unmap_range() does unmap for a full RT extent range, which we also want to ensure is clean and idle. This code change is originally from Dave Chinner. Reviewed-by: Christoph Hellwig 4 Reviewed-by: Darrick J. Wong Signed-off-by: John Garry --- fs/xfs/xfs_bmap_util.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c index ac2e77ebb54c..8a8a2102c6ac 100644 --- a/fs/xfs/xfs_bmap_util.c +++ b/fs/xfs/xfs_bmap_util.c @@ -794,14 +794,18 @@ xfs_flush_unmap_range( xfs_off_t offset, xfs_off_t len) { - struct xfs_mount *mp = ip->i_mount; struct inode *inode = VFS_I(ip); xfs_off_t rounding, start, end; int error; - rounding = max_t(xfs_off_t, mp->m_sb.sb_blocksize, PAGE_SIZE); - start = round_down(offset, rounding); - end = round_up(offset + len, rounding) - 1; + /* + * Make sure we extend the flush out to extent alignment + * boundaries so any extent range overlapping the start/end + * of the modification we are about to do is clean and idle. + */ + rounding = max_t(xfs_off_t, xfs_inode_alloc_unitsize(ip), PAGE_SIZE); + start = rounddown_64(offset, rounding); + end = roundup_64(offset + len, rounding) - 1; error = filemap_write_and_wait_range(inode->i_mapping, start, end); if (error) From patchwork Tue May 28 17:15:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 13677047 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.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 9997A17082D for ; Tue, 28 May 2024 17:15:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.165.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716916545; cv=fail; b=nEJKdr7mmoxIg3Id/Vs5UitnD48blBpmH7S1JlZQpUsmTR4JRgrdkL7cZV4yiOwWug5k98iKkPEY4CgYXLcrxBP72GX2KcAkJxQt5lvgUv4v30c+Nvm0MgF+sI2imeyB0Li29i8R4DWu++NhTypaLlqG5mN63PTz66mP5R/d9fA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716916545; c=relaxed/simple; bh=77wGsMxhHFiDNGcwZwLh8F9eY12B1kD8wYlY0EJhfFU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=VbWGJcJu64xsTfX7TAr7Y7ikrJsfSFY5BeCuFikW7HKQEWoUr05Eh7MpDZPVrIn0z+/QxebDjn8FoZP5w4Mctf204tOUIxcbicYcw/6FRcudOyWWh7g6dCmCzC5wWHRgsbC6yd2ArhouA09jamxB+x+EWEWjmcgUdY5Y99BAvuc= 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; arc=fail smtp.client-ip=205.220.165.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 Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 44SBovMt028895; Tue, 28 May 2024 17:15:36 GMT DKIM-Signature: =?utf-8?q?v=3D1=3B_a=3Drsa-sha256=3B_c=3Drelaxed/relaxed=3B_?= =?utf-8?q?d=3Doracle=2Ecom=3B_h=3Dcc=3Acontent-transfer-encoding=3Acontent-?= =?utf-8?q?type=3Adate=3Afrom=3Ain-reply-to=3Amessage-id=3Amime-version=3Are?= =?utf-8?q?ferences=3Asubject=3Ato=3B_s=3Dcorp-2023-11-20=3B_bh=3DKJ/yR7Iw2t?= =?utf-8?q?p4FEOAEPUV7h0g9xg7/AlPLwZ1zEuEUtw=3D=3B_b=3DoMefJRo428GzKg+aZk4dZ?= =?utf-8?q?EZed1Y2qgGDBh1DA0M3Ig9ZhYmX/K8JAb+AipTwFTln30Pq_mAk6HGjS86Grxs82/?= =?utf-8?q?woG9esF0ttwjaNnMCQSb/+swiBeVxliHCAALlnXgfTXJ0ZEbj5T_ZqYgIHyvSCoWx?= =?utf-8?q?mYv9oAhSB0HJbkaDV2LkKW9X8Y8cMSfZkpEFDlYCXjlO9R1DNUUhSDz_BOym7KXqh?= =?utf-8?q?MM4ZixpiCMz0M7/au8lNFEP0UqQRDY6HIrX4DuujC7THcqWUlXCb0EzfKog_f8/Ey?= =?utf-8?q?Z3JFJLRb5Qz6W4rIelQJQ3X0W+dNRk97+GMNIZhQtShAIhUjkZLOsrRx/RNkL00_W?= =?utf-8?q?Q=3D=3D_?= Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3yb8hg4xhm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 28 May 2024 17:15:36 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 44SGPcsw037637; Tue, 28 May 2024 17:15:35 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2101.outbound.protection.outlook.com [104.47.55.101]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3yc5065t00-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 28 May 2024 17:15:35 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kND/q8JbMDhQU//1HrWTAs27mhTe1AOJs73+QoR2bd1sRLheYsVtknrk2uSh+4pqVXzB0NXR0y5UYl4QjT8qyOaDSg61kZPyDm1yPsiLy6k5brrHVcLCxZAP1SQUPpuNSLt176/5VXuwDwR53XJGGM/qeoOFxa2T+s8jl6nwkEF+hXV5PQbRuqgqNu/A7ni0w9MLDOjdoJ6tKGfHrbkP8JVgaFGTiXfT8LemIsOg+ug3Vl5gKg2bEuX0FFXLEWZxtBOXus/x+l+4VRwZ7Te6wz+qYRcRHv4sxNQeyLxDRoVwuR3c7pSbetRHqQBE5P4xYfgf1ftV2bcDv4HeEddoCw== 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=KJ/yR7Iw2tp4FEOAEPUV7h0g9xg7/AlPLwZ1zEuEUtw=; b=QM54XFS/cGJ/tFQPEZv2jKuNl4cz6DEa0bif6intfyeNQjWlu6XowusMBR+7oZHomUtDjZNJmy2dclvzBaunPlfzKEsaYjQChlEz0N7D5nFpeJkig27mHdBReCyfw+Fzg3pJpX40CwIpGworsuTFMFLyWztbgLBB8lY24FNz/H2F2eEPZDJ//8SRIeoAQG31Dq66IL4PjHsE/fkP4a3pyYW/Eu63LmiZnogwWd9DPSJLIakKYA+udM341cKfRxGlK6+JiZq4zL6Cf8yQm4eTehm7HPk4WgIGgK/qlCza+Gpydssy29wKZ848n+buslPXbBZ41+0dveL49XNnDum6gw== 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=KJ/yR7Iw2tp4FEOAEPUV7h0g9xg7/AlPLwZ1zEuEUtw=; b=vedTkW+udJ4l1NX+1rVBY/pB6n+jRdwl2atdH1CXNNKF8BIgMpEkaWzoNin36yjyUjtMvRb/sZqo7sebBPJwzbXyH0+rIcJxVZ91UbaLTxD7TXaN3ljDfStwXsAxmly5Gr0fB9+3QHvuuv9hjN9lGzIw2MkENI1QBHLFsPuO5Hc= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by MN6PR10MB7999.namprd10.prod.outlook.com (2603:10b6:208:4f4::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7611.31; Tue, 28 May 2024 17:15:33 +0000 Received: from DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088]) by DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088%5]) with mapi id 15.20.7611.030; Tue, 28 May 2024 17:15:33 +0000 From: John Garry To: chandan.babu@oracle.com, dchinner@redhat.com, djwong@kernel.org, hch@lst.de Cc: linux-xfs@vger.kernel.org, John Garry Subject: [PATCH v2 2/2] xfs: Fix xfs_prepare_shift() range for RT Date: Tue, 28 May 2024 17:15:10 +0000 Message-Id: <20240528171510.3562654-3-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20240528171510.3562654-1-john.g.garry@oracle.com> References: <20240528171510.3562654-1-john.g.garry@oracle.com> X-ClientProxiedBy: SJ0PR13CA0239.namprd13.prod.outlook.com (2603:10b6:a03:2c1::34) 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_|MN6PR10MB7999:EE_ X-MS-Office365-Filtering-Correlation-Id: 8406fc88-3b76-462a-4603-08dc7f39c870 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|366007|1800799015|376005; X-Microsoft-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+0tgAwD64gk5CLiYVrqvwIS6+rY/XysY3Mk//795LUMUA4jM7LhDUUDDGv5Y/LLK+o3G0lILTbVGLHfTcwzoeIZTjG8OKgqbov2kRJ1xZz1wB1JvrvCMaqYZ11SfxCeQm9kJVTw4TnJxgRy+og9FNAwGKQZKFaCE3POJkoxX+I+5tabwZ8f/rwnuyhguMCwy/HP5ZrDf0f22TPv/v39FVK+HdWZDIrCCClWjxozqYB9MuwdDcsQDHg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR10MB4313.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366007)(1800799015)(376005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: BwFGcbVGyKMUklulL5CM1dpl4OVlGbeqXAm2Of/XMMFWOwm1LiK4ozgq7sE52EDmiG37kfnmmxEn8QTjgQWueO06jHm5yN8zdRXlySfU0mgBm0a5Ho51Jp/kONLHKPUI5RmtG7qX5iy+6XfHtU+X90BAySpbYGX4Kh6I2ERjLF3qzS97oIoXaxDdfDR6fDrzKZnTpYvnxWzxF+5s6D83nYzblokyXfthFfBJ8MT4j5vnYZxLB8ZxRFyZma6Lt/GSIlU1GXgvBuFgYvcrwQzrVP4S2j0rITdP15UyvyrYLlSq8XmZDusbo9C88156CNR20ZlARR8yhaHvunvrE00indDngRMMApT5dDPw6BgUttsnrG6biyyI0za/x4Z4QPGPulz72UrscJW+p6ZWEiJt9MnOQOzn9tZs7YnFcpDBzwXmeKViV2SUyNt/i7P1ckXYIiX3r5N6CArHqMGw0ZgO2diGcmbd3NoGzEqJinwt/yX39Lbo835o3Yf1hbpNdke8dWV2w//Vgk+Z56/TbWyBX9dYCKZC7ub4+XtX7B9Aaoiwi/arPwRM6vgo8toVDlCYy/7LE9blN8D0h5QWj0mVhln45jeAKR6uEIUQWgvrPF1rs06v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nWzBxQSZePA8TWyW87LkuC7hm8cfKQXNofThXSQnqR1BZfre0djxYMs5+kJKKFIkleON/rcK+f1Ko63N+q4YnuqxpLVT6a/imwfQDesqsADkBSfe1DHPFt2cJWBZUg3CF8u0uqNS4aGY1TORnV6BNrGkkpJjgL8uISzG5tdnu67N+egReszEO2DcG0+xkK2SjdFY/u2e18i7joureX6pYpYwfADUNGArbF2z1xlEyBWEmq44syPYKIDNJUg1ap6CkPYHvNSdL6jI9EwoyRxt0jK/Gt+UD7K+nLLlICubhc4c6KN/RypFOs/VfU5BJWLxG3w+Lf05OrG/xeKFhkx6TQEmvT57WyPh4pNnjyaBNTIUZFubhAKmVHPxYkovQqpN+Xy2qe/TVyGMqD74MsgvIryW8mp7oqFXpNwzDCpbHtgc/wB1J09yGUiohCmHSpBjIssjxa3QnXpcRXYoo58CgipLOo4RnNiIdoYKUsn7x3/o7gdvMFmFNyFMHlEI+XHbPL2fqE6q6x1USOEXwTdSr5+cTeDAtEqi18qRZbyzk9odlNSRUekpkE45F9rj0tGzr7OePJG+6uEbBBMCjvo9dmR+9TDj1fk= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8406fc88-3b76-462a-4603-08dc7f39c870 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 May 2024 17:15:33.3673 (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: SG3FPu6ysWgzi9ZzjJLfqkEjKBikn1JhV03TVTixQq9mnkO8NK+TEx7Cv8n4JuD5dXXSmNXAak7H49030KTUPw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN6PR10MB7999 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.650,FMLib:17.12.28.16 definitions=2024-05-28_12,2024-05-28_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 mlxscore=0 adultscore=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2405010000 definitions=main-2405280128 X-Proofpoint-GUID: 9vyKOZhUFEWKH0oMtGT22lcsbw4AZwcm X-Proofpoint-ORIG-GUID: 9vyKOZhUFEWKH0oMtGT22lcsbw4AZwcm The RT extent range must be considered in the xfs_flush_unmap_range() call to stabilize the boundary. This code change is originally from Dave Chinner. Reviewed-by: Christoph Hellwig Reviewed-by: Darrick J. Wong Signed-off-by: John Garry --- fs/xfs/xfs_bmap_util.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c index 8a8a2102c6ac..e5d893f93522 100644 --- a/fs/xfs/xfs_bmap_util.c +++ b/fs/xfs/xfs_bmap_util.c @@ -888,7 +888,7 @@ xfs_prepare_shift( struct xfs_inode *ip, loff_t offset) { - struct xfs_mount *mp = ip->i_mount; + unsigned int rounding; int error; /* @@ -906,11 +906,13 @@ xfs_prepare_shift( * with the full range of the operation. If we don't, a COW writeback * completion could race with an insert, front merge with the start * extent (after split) during the shift and corrupt the file. Start - * with the block just prior to the start to stabilize the boundary. + * with the allocation unit just prior to the start to stabilize the + * boundary. */ - offset = round_down(offset, mp->m_sb.sb_blocksize); + rounding = xfs_inode_alloc_unitsize(ip); + offset = rounddown_64(offset, rounding); if (offset) - offset -= mp->m_sb.sb_blocksize; + offset -= rounding; /* * Writeback and invalidate cache for the remainder of the file as we're