From patchwork Fri Jun 21 10:05: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: 13707199 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 AC2DB171E6E; Fri, 21 Jun 2024 10:07:26 +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=1718964448; cv=fail; b=OJFGY84ZUBqZkPpP26WZMXdH9lxCrKE2TpdgGiEvi8AFD8VJB9hE0R8/tMsKLT3OHlhROwF9FjC5YkWpFvWMh+aXLoOI8aTH3fzmyHlCibZ+93LJQJnaT5XiT71p0JLiNSqrYlrgcpeIrW3J64fDh4Ha0T3KRIyoDjkvZqsq56M= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718964448; c=relaxed/simple; bh=GcbmBL1lV0+kZksOzg8pr+3iWYKQmTm9HLCWKD5ujT4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=WziNepIF/3BVIEieEjNRkKWCz4YD4GPE9m5XSjLDGjyKpWsv6D1wtuyVIehii2QaFY2OjL1QPbBKSS4mYD4vJtzbu1utMGgFhUqoYzL56gsFRKxfooa2Ko97E246ahn8XvVj3GxoX6jGzx0iGV+J7h8SGKmIUH7SBV/nr1igBFA= 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=fjrKxTgI; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=VFPAER7c; 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="fjrKxTgI"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="VFPAER7c" Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45L7fQc7018895; Fri, 21 Jun 2024 10:06:19 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=0I86EzYD0KpfXXo4D40BE0qaPH/b5Hb3h9qAs5b2Ubo=; b= fjrKxTgIbTQu/4Wxucs40CxGDEAkFFlTxQM6PjFsqCGkTxqcmjut0hAVpDWsXwmc h/ZHJvrsk9EX9xYvGHu2RcdJK8uozEnv9SMnsDpVF7zZA05ZScj7q4HO4cySkq86 ua46HZo2dUvCRI4r61FRRcKdqI69oraLySv4YMqu9XjjZlrojOmtoZCWDpHlEDyY jfpT8Ry7miM1GUXSdA8+velcWj+br3q+dR+v1yvqVd1LQ/4zLnY1033Z9DppSrHT l78bjH7d8bXAAEEyse3KNUipuUqP4KX3NvZfKZqaNJ1hpsQC+gXeKBT9v3axRTbs x9YfjKd+qiMacWnHDP3LJQ== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3yvrkfseer-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jun 2024 10:06:19 +0000 (GMT) Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 45L8VaeB019711; Fri, 21 Jun 2024 10:06:18 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2101.outbound.protection.outlook.com [104.47.58.101]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3yvrn3my06-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jun 2024 10:06:18 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jkJlwBr0m+wm5jF24c2hMF66B2R5RfUUItSqUD5PY2X+js8DvIreLklHabPQe0dewtPgiAzpOi1nA8ZnVbggaYwNW6/ugVbktUFsYcq+auH0CRWTtKVEtx6Hbi9ZU3mYlO6mVttbAvzq42IsrHSbzpNqSV3yO8FF9PiwyvztFSinVZa1sc3aJuEyJj13uzxgqFk/pawC1WmrMYE4i0zPQT2+ZAbMxPtdRK8s8AOxR4iFe9Ah3EZ8eIUbqArKdwzoEFEvIoDnjl8WRKvFSkT3VSxLFfl/ukeSu9ghX5MKksH+GPCZDGD1OlT1+h0Io6AYRcCSJg0u4Iel5P/UZ48hZg== 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=0I86EzYD0KpfXXo4D40BE0qaPH/b5Hb3h9qAs5b2Ubo=; b=Y6UenTqvitANk7uf6ithdpT+/8TEgEpvMJDo3F/Xqd5dJ2bd53eOUxsBA4YNRmf4rNVm2vyB3Ej6ogMgYImy8ALVa7bKCLwjYKJ97PZfxjn1+oKQ7SVgHTUDeV8tvLvMlDGwpPC6rgFf6IFsIswNpIoMSmHJmEdFnlf8TyXViykpzFumS8eWqd02+SqY+JNDsX9DexqjufAxbMZORpNmlSDiuRXhdbosOw7BNzuOeY+1EGXS6e2+0owDT/bRbonzGTV6wCgDd6Gi9I4VTpiwo86rB/Dr+ZdFYHdqF+n70Pcx+unnnAl2IEHy9ee0UclqhMpOo0rDyh2IRuOnjbFugg== 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=0I86EzYD0KpfXXo4D40BE0qaPH/b5Hb3h9qAs5b2Ubo=; b=VFPAER7c8vKsYNmQ9y7tyOpOrOAaXw6FtIPhPgr/hP6sscNqajj9Kj3YtustzrU/XQDZ1HFy62VSWf/6OX4QN2Kp8RIqsfVArj8YyA28krQf3hn8nAL8kBTnIfSqdowBkr+mMK/Lu3wIQthAmG5MXqrU4agg73iyxJFJpXKl/S4= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by CH3PR10MB6884.namprd10.prod.outlook.com (2603:10b6:610:145::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7698.21; Fri, 21 Jun 2024 10:06:16 +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.7698.020; Fri, 21 Jun 2024 10:06:16 +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 10/13] xfs: Unmap blocks according to forcealign Date: Fri, 21 Jun 2024 10:05:37 +0000 Message-Id: <20240621100540.2976618-11-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20240621100540.2976618-1-john.g.garry@oracle.com> References: <20240621100540.2976618-1-john.g.garry@oracle.com> X-ClientProxiedBy: MN2PR13CA0003.namprd13.prod.outlook.com (2603:10b6:208:160::16) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|CH3PR10MB6884:EE_ X-MS-Office365-Filtering-Correlation-Id: 43a3a573-5a24-4036-b56a-08dc91d9ca0b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|1800799021|376011|366013; X-Microsoft-Antispam-Message-Info: new4WCIoR3mDH8bam8RpvX+ANSQHLs5tnnjx8WVPOr4WdLe7bEkOy3ir5BtY5l+3n1clzV4QtnZad/2jvJt+MPZjj8dOOnv341Q6rCZQJvz2Ar6+dR3myBR/zO8R8B8nJo5cgVKQnqwFDJ7TKABxBmv9xN8BCAHUv1l8JxQU1Im44BEY0TLUqgNCnFQG7Vjk4JGg+MWWbOE3Av8U340/qbG8aKbPI6UwS55lRBuOCr0pS8toyVSEOGqBlqx4jlxaUMuOmwOmtlK6+1uCCOC99ZgKxHHFoKHZtnuhIW3sYmFSquXRRuz2EmHqBufHyxC7CyoE3RYI8LbQ8C7YjUr8ekJfzNpWTScqtfF5Di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HkdbHgW7tywW/3wj9OONmx1aNFk7/XmzRjyzjJiAIazW/8qECliR13HZIxfmcvdFLSQpqzEdifzdKlDw8SD24cCbpZ8grSMBL2C/VBn5jAbAnkWUKa06sVsRtU++q5qNC8H3kKjpVl2MwoIsuVVkITwWayFV4khxreuim8UJBEMG+0fy9QG0r2sKV6+XtYFxv67QS7OqcwkSUkgUc6up7YNhXqdoObJlGK5+y5vvEwbEYR8PqZ/1ilsF+k5Wqs= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 43a3a573-5a24-4036-b56a-08dc91d9ca0b X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jun 2024 10:06:16.4591 (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: 7yfMH0P7cwwHC83V94KFciS8xI2muDo4zHFooycBKeyg5cMi0fEY4zkApcPT5vG/yuM5CoogwEIoI6LpPqavzA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR10MB6884 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-06-21_04,2024-06-20_04,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 bulkscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 spamscore=0 phishscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2406180000 definitions=main-2406210074 X-Proofpoint-GUID: E6t1syJbuWpt71Aq8r1a2GRsjS6iKx9k X-Proofpoint-ORIG-GUID: E6t1syJbuWpt71Aq8r1a2GRsjS6iKx9k For when forcealign is enabled, blocks in an inode need to be unmapped according to extent alignment, like what is already done for rtvol. Signed-off-by: John Garry --- fs/xfs/libxfs/xfs_bmap.c | 38 +++++++++++++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 5 deletions(-) diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c index c9cf138e13c4..ebeb2969b289 100644 --- a/fs/xfs/libxfs/xfs_bmap.c +++ b/fs/xfs/libxfs/xfs_bmap.c @@ -5380,6 +5380,25 @@ xfs_bmap_del_extent_real( return 0; } +static xfs_extlen_t +xfs_bunmapi_align( + struct xfs_inode *ip, + xfs_fsblock_t bno) +{ + struct xfs_mount *mp = ip->i_mount; + xfs_agblock_t agbno; + + if (xfs_inode_has_forcealign(ip)) { + if (is_power_of_2(ip->i_extsize)) + return bno & (ip->i_extsize - 1); + + agbno = XFS_FSB_TO_AGBNO(mp, bno); + return do_div(agbno, ip->i_extsize); + } + ASSERT(XFS_IS_REALTIME_INODE(ip)); + return xfs_rtb_to_rtxoff(ip->i_mount, bno); +} + /* * Unmap (remove) blocks from a file. * If nexts is nonzero then the number of extents to remove is limited to @@ -5402,6 +5421,7 @@ __xfs_bunmapi( struct xfs_bmbt_irec got; /* current extent record */ struct xfs_ifork *ifp; /* inode fork pointer */ int isrt; /* freeing in rt area */ + int isforcealign; /* freeing for inode with forcealign */ int logflags; /* transaction logging flags */ xfs_extlen_t mod; /* rt extent offset */ struct xfs_mount *mp = ip->i_mount; @@ -5439,6 +5459,8 @@ __xfs_bunmapi( } XFS_STATS_INC(mp, xs_blk_unmap); isrt = xfs_ifork_is_realtime(ip, whichfork); + isforcealign = (whichfork != XFS_ATTR_FORK) && + xfs_inode_has_forcealign(ip); end = start + len; if (!xfs_iext_lookup_extent_before(ip, ifp, &end, &icur, &got)) { @@ -5490,11 +5512,10 @@ __xfs_bunmapi( if (del.br_startoff + del.br_blockcount > end + 1) del.br_blockcount = end + 1 - del.br_startoff; - if (!isrt || (flags & XFS_BMAPI_REMAP)) + if ((!isrt && !isforcealign) || (flags & XFS_BMAPI_REMAP)) goto delete; - mod = xfs_rtb_to_rtxoff(mp, - del.br_startblock + del.br_blockcount); + mod = xfs_bunmapi_align(ip, del.br_startblock + del.br_blockcount); if (mod) { /* * Realtime extent not lined up at the end. @@ -5542,9 +5563,16 @@ __xfs_bunmapi( goto nodelete; } - mod = xfs_rtb_to_rtxoff(mp, del.br_startblock); + mod = xfs_bunmapi_align(ip, del.br_startblock); if (mod) { - xfs_extlen_t off = mp->m_sb.sb_rextsize - mod; + xfs_extlen_t off; + + if (isforcealign) { + off = ip->i_extsize - mod; + } else { + ASSERT(isrt); + off = mp->m_sb.sb_rextsize - mod; + } /* * Realtime extent is lined up at the end but not