From patchwork Fri Jun 21 10:05:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 13707187 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 DA487171064; Fri, 21 Jun 2024 10:06:19 +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=1718964381; cv=fail; b=tSo3KrP6Ng4iDgdtJzEayKu7Gqn090eQp6XAKnEFnER2tXOhxjkx5TiSBHnkUGi887eohhDZUuSj/K7nHhRiTxnFXg2CvWIYMdYqYV8tWi0bqGNmqwFuZ0wHVNCxSeV3vCJciMmNKMkQxnrcVxuwXewmrxm/Pl2KEPGP0qPiWIo= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718964381; c=relaxed/simple; bh=RnMh0YZeJy8q7JdsF9hIiJNZlgaibfSM5m+V68y1h1k=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=Awc9gTMgYvF/+OraR4xEUoSIc2ywVilodgW2+hXrf02uRIDgydJcmjw/+1isIrc5yyrgyvjvXGhtAGIoLeHkeYOv1I+kwTRryEB9ctYywnyEYYMFEYksZmZfJtcMGRORPr4YJcPBBHU81RO/HVwwLCgxw7RNvHLvG0X91B0ayaQ= 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=V9nCG3QA; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=nvXkQOxP; 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="V9nCG3QA"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="nvXkQOxP" 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 45L7fQ4B018898; Fri, 21 Jun 2024 10:06:04 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=wFv5CA8hwZ6yyogfoaBEcrpClZLQUBdq4YjBgutZRj4=; b= V9nCG3QAUsSnLKKhWYcVeiCAxS49TtbBvWzMX9pJTYd2cpKcKcnTMmqhwJjClVLr ky5yCH97IOyoCnOcNS0v00MFxSfYcS/Lv5P6C7PRwxg8lnWYzZXayZITB3UFbBp8 5kVPTXPmWXf5oLc/x1l/QdsDQwBK5c66hgHeSs9U13FGrGQbDP43rk3j0kdfMLTp tMCVPNRgQ5PeBspxYqTsDHBQtFyh9Y+OPAD5DUNajx2GcMy0Mrt6Ku9MWk8srN5G txQ5yUpMsL14lftepKWegB+8xHs4QTPP7Yp2sXF6EMXNNZIjsLAsUhNrhwlEAbeq IAgBuIfDUlG7PXuQLE4iFA== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3yvrkfsee8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jun 2024 10:06:04 +0000 (GMT) Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 45L8nh5l025177; Fri, 21 Jun 2024 10:06:03 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2100.outbound.protection.outlook.com [104.47.58.100]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3yvrn5wc8p-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jun 2024 10:06:03 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ME4sHj4zt2UTuqCoTxuYNSomn2IKuB+YYl0CwW4feXdFqaH71fzwpsRsYZbdP/7jV2PE6FA1CiDlgo00Us3RQ/oo0WTV6ra8dOlmAyKrGMvGI5+My+QMnMfKrW67lKypevEtyTEdlqzLM+HIabptbMSg8OreQL09gcJDXYUsIP5cW/e/mospj0OboCkETqGPkFzZd2Bnsdz0M/nozydbku76KGxdJsFD9oD/9ckIv4yZovlKIlGlNRFbE/WsQhtgIvzIbP6fEFNp77nMNVSGGdbyRscSWTUK/H+LAduSSSVSBo3RV8x8x26p8sV1Ve7W4VqJEUOBSHCHUt6Cnns7ZQ== 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=wFv5CA8hwZ6yyogfoaBEcrpClZLQUBdq4YjBgutZRj4=; b=BuleZE6cryYtkUuzxg6RX8CTw2MIz0Jz0kXbHgVsZbHLCyXqF12icyApS88v5vZDSTRAYX454HUBhOkW6P2xM/ZrbjMlikxGG7PCp6fMJeqra1mjaErPiyKLFofuFjpoLbVfNgK0HZgOJ3DpQJDrKyJkojmkqet7GgSVLUyLfGhlSQsNqKaEkaNMc7ON5xVoDqnOqNL1v4+FR3/vgQ9h54GXZENh/Gm6zPe386pXC3v1P1DjVHYaRcFk7kofNelFzpdqnBdYBTuW7dpeD24mCXyLiDvvXegiHyNnB12sivq1sUacKegjM0BgoRNPUqiGF8FZgylz46K1uMT+cxABAw== 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=wFv5CA8hwZ6yyogfoaBEcrpClZLQUBdq4YjBgutZRj4=; b=nvXkQOxPQOLcoaW6w1Tx7T2ZMJpzqwIJX6Q0uVtGFgswRGMuYXxeMrd5d2E7Dwkiirzd9g1CyCuHBvChslM16XIU0J4VqZSI1MD4rIMLq3q4NZCwj1nH4oN7jS1wFTmcK5mLsYMohwDUvra//AjIeEnl6IQ5iYsP6AZOPsDSPaE= 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:02 +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:02 +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 01/13] xfs: only allow minlen allocations when near ENOSPC Date: Fri, 21 Jun 2024 10:05:28 +0000 Message-Id: <20240621100540.2976618-2-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: BL1PR13CA0240.namprd13.prod.outlook.com (2603:10b6:208:2bf::35) 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_|CH3PR10MB6884:EE_ X-MS-Office365-Filtering-Correlation-Id: 72ae95e1-32f0-4a2b-d806-08dc91d9c17b 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: 5cgFsS+7vBXMnLK0rYsMeTguwXhdCBAWpYV1IfzqqQAJ3pecUN/DuG6OYuztMU0UQtdC6RQuhUNbAoBoJ9OR3UcqUlQZbyHmNokyvten853lbVqTV2eb/KjxCE2H/2VOf8XpOJytNsjc04elC0vwAHdXENeIgbP83WKOSYn87UP9JKqzjYO2cQb3c0Tnw3hf9O8o8jk2aOehWAnli0qI4sJ4lPstQjPoPdUVqSinzSdEApGSa73bR2+hvZZYRmKv4rd4TDmen16PDInFCGD9b4oTMkbLd2q55m5UtIyLwN8gu5Mp3obZz+AXxCU77sGuu0yusgD95D4cwhZd0XBG47GCkzNXPwBzTgvWz/HR9l06vNpwOhc6Ucv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PTR:;CAT:NONE;SFS:(13230037)(1800799021)(376011)(366013);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: KI3ZRy8LASHmEzalmZwpaW/1cycqXMccKywcVtqo6FJldEfIWqdFbs1lrRg8jVYW3XYyNyL76RYwbPZPTCNA8X6o645Nxjt9dTDQgtVx3oQQWGI4qzz0MwYzF7JAi3Z6OBMe71p2Am9GTy9YGe/eAWJtc5urjAn9imBDoXRevnhmqaLnf469/GWZCwwbmUyoaBrOTb3KxboR+1XU5SeYrIrAHCNz5EB+JbkjKrR1zZJj5chCBr8kgut9/n6cwRNkayezh1g36/njhqt5/YmpyUAsbCzjxlsuVlZal/Z+Lwtu6B30T+PZ6n8vjxQBPQ8YtgOA6RZoFRKE0Rn8VEKmMNgZD6boZy47gQA+uE7h6D69N9J23sfFgGyvOXrU5sHJxMrwvGILgVf4piZgpADYFlgvjv7xWXenvItrxD8cLglHG75rc+Trg5KeWLbjXObmSMCa0Y05NvJk+HSpBYsYDlrO43QAJLmaRMGbGdQVOOHoJJMX0T8KXIKi417DkN74Vq5brUGBEk7jMdYHnw6+WYKOeA1PE8lOfCyVShzeApHyN0omLMchMQ0cMBjY3bi4G2DU64sclAkB8F6+dksExvYmOCplILyPOohOIO0gIdB83jQ20+EaLLPYRzVSNrxDDOnUfnB9VuW1zb3RXjSTFlDbwoGOBG+bY+y7gFuteXgh9tzd7Lm/P8cKDbGy2Lz4k3l0YNTlmIWLOvGbcSgyzTtSTi/809POna7MNxSJyIutc1u8bhZrMsCNFnfFoEGV/4SMJrdECMprJHtTLFCmLd6kKw/SWi0rOvGeTZWyYk17789CnHaB5AdSwbkhE7lShqpYuak4Vc6wezzeDvrfL4mTxdUY/4kdCHsdgouuy9TZ9t5EPDCYoUokuCC49hEU+LCldKL9M59cvCf/rN+vax2N6+Cw2TBlVLn1R5k1gTXidDuQKksbE2VGde2Psi/YIONDAyV9e3YDIE8Y+OHvtrlPKzd+Jw7Nonp+3h1iGxwje2n2a2yhJ5iLi6G0GwdVyNV+TP1vxaB5IJzpwgx0U7/Wof3jvfzo2U5ciHP+mZmlFE62QryurWKne9CAG5EUUCNflhLEGtcs7JNcSE1co6LfHZiRn3oc+GVTzco1reH9IWdhKusVnCqhOkk6l2E+HjH9Sk7o2UcFJTN2r7Y9+sQVMMj1ad8YC3doo+FRqKSNLilRJxUsX9H//t7OafQU293sCuhezORpsJHakwXxONS1ytONMjaTsCmSfSk9B5ftesH5Qwkl0ukQHrioJV4LCjGpdWZPGLKTyT013nTaeHNFy3buSz82rhiELYZq7nqxCBjWCAGAOHvUXFSS/3xbaVYxCr+s8dOwR8+T6EKiy+bDWqFoCowEDeJ0yJzTV7gjVZ2ptB2NGL1wFNt2+4mg97I01leWKMC1/6oVF/ZI003dw6IytxQKIMCDkMHGm3V86ySaQLQ2hV1EFWScvciE4z6YCrQF2fHtItVsiEp3OMdO5h9YCLjF2MvzzL52WzGjLgvoCNiWbypVicCBKIhYdminu+iLtTqYp/e6hc1sYBd2GWGt8KT/Qw1jvjr9FtmtJT925IJS0L299HlDpGfgIgiCHvL9QBoK9yu7HVbT0Q== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: FR7PhR75WcJ7sJ2k8RaT3f9lXDSpriyb4OevD8BFpc0+J2Sc4QU+hVMITda6tsMJdT13PdjmZD612EfnVCeDJt1vMzFCrn+h6U4gDFw8gbeRsJwmUMUvfaYoi3rXspiw7tLwbWnHBR+y15gbToFQe4uOTF5TKVDO9FEmSdHgVY34KGc/ENzv0KoZn+4ki9JEs11m1zjplSrat8EAiwmjavOsAnnkJkhAFWnbzkHQnUcRbQSAyFVv9dd29uNBOr1f2cc3aMATqZKVv9j3GZs5sYu/EVo44uQXVcmCeymWJn+luLFxLhoAdUlQph9zudKCNilqbAoLEGDEvVRxUSW8t0iR0cDkvINYUUtaLaBEjETkfNAhtJmnHv9fchy1OqNbTYZc8PgnpernzvxeEe5muBmV8JdDeMNwhEGTf8T2bhrouXSeD6uMnEk6dJjnhUK2AVYss7AxEB+28iBmcCajQooaDCFDwgvPjG6NnAxdTGoMt98OpvzvdIpjBFykCH3CDTvximDa9uT6TxCjy7yXUlGvMzkFMRq7A8AiXbuhM1v/HKe68lTAmSG/+g33kOzcQ88QCAecIvoI0dcMIZ7CeMV+chBb7olwGZL3aZ1ojV8= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 72ae95e1-32f0-4a2b-d806-08dc91d9c17b 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:02.0705 (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: 6EoeKNikR8Ce3ZOKuRWng3nKvEnlphP2zTMxxGPMusoQiTgw/W4OTLZgjwFj5K1XeVoS4cyLsihC5SBGdynRAQ== 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 spamscore=0 mlxlogscore=999 phishscore=0 adultscore=0 malwarescore=0 mlxscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2406180000 definitions=main-2406210074 X-Proofpoint-GUID: ATZhaPLLBz5TaklbzujKg87BTNCX4pHI X-Proofpoint-ORIG-GUID: ATZhaPLLBz5TaklbzujKg87BTNCX4pHI From: Dave Chinner When we are near ENOSPC and don't have enough free space for an args->maxlen allocation, xfs_alloc_space_available() will trim args->maxlen to equal the available space. However, this function has only checked that there is enough contiguous free space for an aligned args->minlen allocation to succeed. Hence there is no guarantee that an args->maxlen allocation will succeed, nor that the available space will allow for correct alignment of an args->maxlen allocation. Further, by trimming args->maxlen arbitrarily, it breaks an assumption made in xfs_alloc_fix_len() that if the caller wants aligned allocation, then args->maxlen will be set to an aligned value. It then skips the tail alignment and so we end up with extents that aren't aligned to extent size hint boundaries as we approach ENOSPC. To avoid this problem, don't reduce args->maxlen by some random, arbitrary amount. If args->maxlen is too large for the available space, reduce the allocation to a minlen allocation as we know we have contiguous free space available for this to succeed and always be correctly aligned. Signed-off-by: Dave Chinner Signed-off-by: John Garry --- fs/xfs/libxfs/xfs_alloc.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/fs/xfs/libxfs/xfs_alloc.c b/fs/xfs/libxfs/xfs_alloc.c index 6c55a6e88eba..5855a21d4864 100644 --- a/fs/xfs/libxfs/xfs_alloc.c +++ b/fs/xfs/libxfs/xfs_alloc.c @@ -2409,14 +2409,23 @@ xfs_alloc_space_available( if (available < (int)max(args->total, alloc_len)) return false; + if (flags & XFS_ALLOC_FLAG_CHECK) + return true; + /* - * Clamp maxlen to the amount of free space available for the actual - * extent allocation. + * If we can't do a maxlen allocation, then we must reduce the size of + * the allocation to match the available free space. We know how big + * the largest contiguous free space we can allocate is, so that's our + * upper bound. However, we don't exaclty know what alignment/size + * constraints have been placed on the allocation, so we can't + * arbitrarily select some new max size. Hence make this a minlen + * allocation as we know that will definitely succeed and match the + * callers alignment constraints. */ - if (available < (int)args->maxlen && !(flags & XFS_ALLOC_FLAG_CHECK)) { - args->maxlen = available; + alloc_len = args->maxlen + (args->alignment - 1) + args->minalignslop; + if (longest < alloc_len) { + args->maxlen = args->minlen; ASSERT(args->maxlen > 0); - ASSERT(args->maxlen >= args->minlen); } return true; From patchwork Fri Jun 21 10:05:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 13707186 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 E5E9D84D04; Fri, 21 Jun 2024 10:06:18 +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=1718964380; cv=fail; b=lDBLOVS7uKT2WY95K4vB0ol0KdA9Oxbk4IrgO7TE7Boie8i71+yhwsVkwK5MWBrxsyiiAhdPeI0iQSeixHmNtl21jGvFcIGk9AE5Coc4VJGtWVP80oXuxf+8ez3vpgpuS18kDIYGNPe6aGSXPYVkg87DoDyIR1LDSEBZZi2ztm0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718964380; c=relaxed/simple; bh=R5IY8Ul7LJaRUZEYmRTbd8wBnFo8TiDpaRa/agaexN0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=bs9QMxp5fJ34qiSUvrPQ1bHQAQnXbFfzXqHeMev15rReDjjRuYZovv3uzYQYbfTc3cy0uhYFoI9omvr/BY/ax6J1rSq+vjSKnFpt39pY3l7gncFlZXa890AMI4vTXjBzz5dhoHzjLPH+pgQoEUQVLIbw5Sb2vClUKRNi2qIbgo0= 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=MTHpOcgM; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=z/kMHyTw; 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="MTHpOcgM"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="z/kMHyTw" Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45L7gCnf013265; Fri, 21 Jun 2024 10:06:06 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=MjUuXW56GSzvXIpVrRAGoX61qTZTfovOQxGNmcfXok0=; b= MTHpOcgMx7zcbMqhz4CNbZ+Nji7SDKyBNsyEGvtIOD5uAn1TUgqqH9bSM2/I+0PB Lw5SQ67aE68/Oz2KV/5i94Iho/fQnfafn9vAWJudvgDv/PGB4POuHPoAd/s7dnOi +8ZtVU7ERBQ3LAe3Xe7X3gv+oVsOB16cPY5isd5eV9/AdPKwyN37acG0D4hYy03B gH03LI/g4ZKCWX34InW5OceJRTjBGcVk6YvKQak8tIixp9ETgUbPmv0HikkArmap 3iaHGhzZmmUCpmgrIvP0uOOTwbWXsM5tmQcvyRX0XpKok8u02m4tt77V8Yofusoz 0Ruvt93ni9ExEUV60r4SxA== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3yvrka1e83-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jun 2024 10:06:06 +0000 (GMT) Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 45L8ZH1N012861; Fri, 21 Jun 2024 10:06:05 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2101.outbound.protection.outlook.com [104.47.58.101]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3yvrn4er1q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jun 2024 10:06:05 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Rsl20+uAEJlYjt/9/h80DV8j5PYfi7gMxCRadBKnOPK4+7p77Vkb6JLzWagyEorMxZ6y/foF3db79HSTmME3BteclGaU42VT96emKWFx7HH5RFMqmEDwdiudEkVB6QcxZxg7m6WQVfMlTr+IpuxZL6UiWoT+L+PGE/CIk+6F+HI8VW6osBptQWllVJY4bTK8pqnHXHcSzDBRcGwqV7YXJ7hanIleP+sn2WzQDVs1JmcvZZECvAZoGNXtf5MTPh+1cD8kbH4BXubJn4K7es+hhnAE3I1q0RRBL7ZAf70+0Zt3TCzk59l/jQHjiIh0dBOc+68/rk0faI3R1mN8toXl8Q== 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=MjUuXW56GSzvXIpVrRAGoX61qTZTfovOQxGNmcfXok0=; b=ardIlGdCTgFBHrBeRoM1bXIlhywttHnqPySIXSTNKoi5yOhj2FdGk8i5hidV0C08qdqniTLGMAtQ9d5iyvKOYK5EcW5/Wnsokq5ZFsm7+95yPSkU/+wiWQI7AM/L7uuVWxSNTbTI5xr2m6LBxHGZ4NPLwqprzAQxbTRX8K0mZsTUvC91iQi3sy/n4zHaEXmQ9Ju2taByXLd66XJv04NZWS3yaZhEFBTavgpGALX/D37qwQYNydBs132FxSV3VexAu/Q7rBA5/ydp8Sv5RDO5un07hbWwdF8hw/rCHqukr0QkejaNBb4PynplfP9Ro1OYz7dbZyaSI3/GgOpi1545dA== 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=MjUuXW56GSzvXIpVrRAGoX61qTZTfovOQxGNmcfXok0=; b=z/kMHyTwcFAYG/ieKbjcgkPdQn05vB5lqU+BmMtNYDK3NMRhpOUkChr6N6Tlwq4loxL+BsA3BjsGfcxd1znY5KKtmuD/FX0xDvW8RBVbZGAchjYMtZm78trUT/VphPQuG4/YGudk8PT1DPu4asVpmiB7/m+dZgilJgCCQUy5fwE= 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:03 +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:03 +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 02/13] xfs: always tail align maxlen allocations Date: Fri, 21 Jun 2024 10:05:29 +0000 Message-Id: <20240621100540.2976618-3-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: BL1PR13CA0137.namprd13.prod.outlook.com (2603:10b6:208:2bb::22) 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_|CH3PR10MB6884:EE_ X-MS-Office365-Filtering-Correlation-Id: dcff29f7-0cf8-4fa6-e230-08dc91d9c239 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: SmXw1KS2FX71wcdWwDMx0GbWIp3/hG8NJ5WVDOdHpeO0u/u2ALbUoYSM9W/dMFdppuw6kvXxNZelGxFAAE58AbQbEsH5yKQBfxYKmkimYpdmg3zetnloJZ3lekS/u8FovTURdBD3b98cZRwdI1f0XCGM9HH9jNj7RDjvuENbQtzKRQZdegpSgNoWBJ5GbhlTFGt2SQ4jdgSZ/0JNQtxKgSB+dgqHy4l+cx6ZEmxgeIdy3m8kVcCkKu3e5/1OgOsQCHkjphLejjAd7GVnU0gxIPJchgf9AuIDw4R8EgfRQy7xULE8Bcpwx97SsiphPCC6u0csdxiyniKjvbGLjkonnt8jZP3SWheiqCLLiBBMKMkEOJ7g6zvXRSXS7t3mg9Deh2e7lAosTfMpAaoTGT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8c8L+CY7xsFZXeUxOJTfExH5RGM+jVXPlZscQvWliAKDsk3UNcYElwlljhCi4cOIrB/N6Wkc0tsY7iBTqjjfaSxSHDfOtQXjIFFLsPUbTyHIB2U8yQ6eu/SCy6jHNbcw9Y+Wrq5kpho7jiLB4b2nAfkGud/o6ff4b3Itv/XGHDA06yWPyi0jm5SziROqzKcvdZF3VhPxEYu+1plwop53HNExoe0yfM7IdsRw1uto= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: dcff29f7-0cf8-4fa6-e230-08dc91d9c239 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:03.3286 (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: b1U77I3I/0/QJ+ypwhb/ELeke9qHCU8XIPYrdgTox8unTM4yPy0eIeoGC4WnfP8qlnZC2tjgy8AEmetfOERBmA== 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 bulkscore=0 mlxlogscore=999 suspectscore=0 spamscore=0 phishscore=0 adultscore=0 mlxscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2406180000 definitions=main-2406210074 X-Proofpoint-GUID: eqztgK3MUltZmWeYGwZ1k6G3Du6SEl__ X-Proofpoint-ORIG-GUID: eqztgK3MUltZmWeYGwZ1k6G3Du6SEl__ From: Dave Chinner When we do a large allocation, the core free space allocation code assumes that args->maxlen is aligned to args->prod/args->mod. hence if we get a maximum sized extent allocated, it does not do tail alignment of the extent. However, this assumes that nothing modifies args->maxlen between the original allocation context setup and trimming the selected free space extent to size. This assumption has recently been found to be invalid - xfs_alloc_space_available() modifies args->maxlen in low space situations - and there may be more situations we haven't yet found like this. Force aligned allocation introduces the requirement that extents are correctly tail aligned, resulting in this occasional latent alignment failure to e reclassified from an unimportant curiousity to a must-fix bug. Removing the assumption about args->maxlen allocations always being tail aligned is trivial, and should not impact anything because args->maxlen for inodes with extent size hints configured are already aligned. Hence all this change does it avoid weird corner cases that would have resulted in unaligned extent sizes by always trimming the extent down to an aligned size. Signed-off-by: Dave Chinner Signed-off-by: John Garry Reviewed-by: Darrick J. Wong --- fs/xfs/libxfs/xfs_alloc.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/fs/xfs/libxfs/xfs_alloc.c b/fs/xfs/libxfs/xfs_alloc.c index 5855a21d4864..32f72217c126 100644 --- a/fs/xfs/libxfs/xfs_alloc.c +++ b/fs/xfs/libxfs/xfs_alloc.c @@ -432,20 +432,18 @@ xfs_alloc_compute_diff( * Fix up the length, based on mod and prod. * len should be k * prod + mod for some k. * If len is too small it is returned unchanged. - * If len hits maxlen it is left alone. */ -STATIC void +static void xfs_alloc_fix_len( - xfs_alloc_arg_t *args) /* allocation argument structure */ + struct xfs_alloc_arg *args) { - xfs_extlen_t k; - xfs_extlen_t rlen; + xfs_extlen_t k; + xfs_extlen_t rlen = args->len; ASSERT(args->mod < args->prod); - rlen = args->len; ASSERT(rlen >= args->minlen); ASSERT(rlen <= args->maxlen); - if (args->prod <= 1 || rlen < args->mod || rlen == args->maxlen || + if (args->prod <= 1 || rlen < args->mod || (args->mod == 0 && rlen < args->prod)) return; k = rlen % args->prod; From patchwork Fri Jun 21 10:05:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 13707207 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 D36C4171E76; 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=1718964449; cv=fail; b=KdLOUPDv1KURjK9JVl3qMomd6OVyWtzJLYwC7G6Gxjvt5WsWAahjED8cI4Z1qP3SFuUAQYO1LHoyQjtKwiGQYWP7fwUhiO+Auwkl0Gtn1q2xtcbWnZpH6Lhnn6aIio/KWGLR8gVHhpK7OdBWVzRrV6q/23KErJshZQjwfUb6xK4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718964449; c=relaxed/simple; bh=BORAzsPZWFCDexr/SCcO6Uv8k9eKAHXqtZ0/1ltyM2I=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=Ocdvj4dC0tKY2bM4idnYGZfiVM8Mqiv3T2WQevMeyzsYkErWt62HGSs2J+c0dlhWouSXqHTt4wNZhtvXnABLvvnAt4gAJP0xPWjm4fRCjKMMYUJLdWtYlbwvC+Jr+Hq2H52/Lw+xXbIpdSAbcmbPta/GghWaeyf4WcGGmNIMMig= 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=NBjVLDYf; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=myzT0TWE; 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="NBjVLDYf"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="myzT0TWE" Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45L7fQ66028586; Fri, 21 Jun 2024 10:06:09 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=OcOCKVnoSPM3ibMtHGFm66gkvo1DZj3ubr/TCYKncI4=; b= NBjVLDYfFHwgosep7KDOk1lj3N9SqT8ou9Rh8kpWA87FZn2fF3wygGUvrQhWAXgO fnNn011L9P/+TnKfnZGWOnsutmJ1l3S8k2CKa2y2GfG+VNup+PDh64/y/N3tz5mi 6u3DQzdcBo90Wr8IVl8jrMRxt7Fp34E7ThJt/357Ecg/UtUh2ElQHlH/OuhR2pdG AQTDxizy9VFEjOqrFUwKmJMEjLGJ2A2xg75jComk6Sm6nBrIzXJcWEu7wj4jJq0d TCwsyBOHIThob8lPcP04zATT29CTxCGAazdZIS84HMz3B0xiHz61Ga19BjGOZDVn UZEKnWVC8nwP09Q1lzpBug== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3yvrkd1duc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jun 2024 10:06:08 +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 45L91PTY019521; Fri, 21 Jun 2024 10:06:07 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 3yvrn3mxst-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jun 2024 10:06:07 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RvyzjsfV3xhjIsCXW6QcE2Uc4/+QHG54/x0Px0cU0OUzKv7GSuNR1ru081Yiw7EGc5clENDZd0TGDEKY1NaFp0H5rLPRnm1SYAwcFmzqKNJWCL5wGtKUqZe2mR0vQt2Dkoc2zVeIIqzdYJjQoLIzhYFgeqROFiJE8AnLX69VGOVOLgcx0HZjl61yfOzZetiTVBGZ2rWAmnlVtuiwTDvkO3O7eBBqcY186RLIviFFfK5z+PzRhRgGD2EUYOu0CZKjT/7ZdQFhmlcQq6tSU6/xHAOBm6jh1DZ8sMOm1ugcp+MoRNaexi+jQ870PfRus/GuCYAm+hTM2enmJYZdvkjc9Q== 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=OcOCKVnoSPM3ibMtHGFm66gkvo1DZj3ubr/TCYKncI4=; b=Odvznged+fTpu1Skq1+34svSN5Ezy6YVph/FuWVkoE++l6OAHrGBA0wiRbqvQdWr5eqaWdp6slUWmbjpBrzfIlzekTFmdyb/9XyAc2g7EUAt5N0PTTmQFWhADuzSIMQkSuPYgX+lEp6QGkVxNg0jl+TRStwU/CfSf/1hw3E6EpIbnsYBp2DYQUFd0qaTCUDp/1u0Zekyeg0jILq4xjXU+BRtb52Lna42FIr0RGBQOixucCCeOHf11rYUKlkSHudAtmmU5Wxt9pUowGMtFL5ZoxbKFtSDSwy3tEkZb+gUi/DVCMOUCU3KvN9SyVpUUKYY0vFl1UPXzXl//twk5pgWHQ== 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=OcOCKVnoSPM3ibMtHGFm66gkvo1DZj3ubr/TCYKncI4=; b=myzT0TWE5J78CIE/4vWLw2HGqdLcMMIL4kxqnOPxSoNG8c94/Ep0UsWz91hiFUhNovj2Fkx86Q/jYwN4ThbnZyoCA7t3IzVnc93oMEmbpu2snM1sA8VDEvC9QdA7cqO7AD4D8hhA6hPYXfptgD+h1o60Bay1q1qGky+aa7xZQ0I= 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:05 +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:05 +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 03/13] xfs: simplify extent allocation alignment Date: Fri, 21 Jun 2024 10:05:30 +0000 Message-Id: <20240621100540.2976618-4-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: MN2PR17CA0011.namprd17.prod.outlook.com (2603:10b6:208:15e::24) 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_|CH3PR10MB6884:EE_ X-MS-Office365-Filtering-Correlation-Id: e21a5837-9cf7-445f-c240-08dc91d9c385 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: ppLC+elCrb6T+5zOS5r67/GTBg0bW/AOLCinR9gOl9mkDOAZgqjB9Xz+ixWMb1lg08Iei8mVVjEfkF2P2HzCJEI1hmUT1qz/1IQ+Zx9HlbFxBXvJj4He8V8ghMhSSAUT/g+wMPcZoFl6dNlJKrBQLR0Y+OW59jLdt9ZTSLz9uYAL1RvWv9YUcCCawwpFtLyq6y3bwhrdPrAOr2j+a2E3qxMv6c9IG7ZD7zp7ZFUYNVI0RdEna8c6GR1mtbbLjXWaJyDp2oN4ufyljspWLGGNSswSHJlY+LxlI4FNlZpdixHg+AFR3bdEUFu/WoK71MFgmxD8Q2qZm4PCjRP+p4LlJBAFki1In9lIpsjaS04XmfpsL5O4HD5AHy32IlsAzLYHVmeO3caw4/rJ1ks6O7987MxLgnJ30KXa0ac8LUZqM3VWPPZ9TxEVMHu09CLlw2Lfp+M+JKbWVCGMgwf+YMpmOHGbIpbQxNrpqJIOB/aFQP64SxHaICpwQ8D+lCEziZPMMXPVAq5JRcdLIGsOhl2qcOi/cMGFcTz0UJlP1oy/ZehOI8H0KosyXPVvCj4stBBUBF9ieLStbOgsYnDwgG4SI8Aoo98//yQBXgzw3NvxjT6DH75r+u5jPoVByHXFKvoQXixk+WcMstKsIpBUJas1mr+C0h6HV0eZej6VfdOrgdsP62iewvYn/KXJIVcMlzHbCuRsH33YIOuK3xB90MBU6tQ10V2ZlZKBrSYgzxvbkL99T9JTLd6IhXetncLO7ojT0kUXSVJi0qUH93Au808Qcamw6GwDNwGLFX/hIhI+GdJdz9yB8fGumUF8wV8KnP5MFLx7Ax4Omg4NyQkdmLCXcEH9ihaqR1DtNQvjdvpVHkkPFkzV4RUhqmVnsJXuy4QZgQFEk8ocYJNwYs2UnOvHvDx/cC0WulBc+7AizZCs/n8GVA5YLsUTWuAKNqzPnkYPgzaOndkulUzlDEkfC/voqsjeVuUXdT6n/ebipkVjCj9rFWdjluTLXgOzC/ISLxqLUISIdh7h+2Z/c/Q+wPdTch12uTrtmL5AXa+6Dm1v8z9aVRxp4qmknR0ixbX/IPglV/9MJC9aJ14ulgyUNafIhBH/MzxRClxOOLPFforjf5BYkkU3aSkT/nntXZ4KyfyCHE5zttSbGNTPW+TiCnzUOcKFgOkp7bTfovHzo3/TIpO0QeYmV1dc2mXUGExIgfX7UTo0igvi0JbdHh8x7Q7kAwqt4DkUwso9WKGs9NfVs34NgYtfCp0z/WHvRcRBmAc6qs/LTtoJM5aF9+Rndj96Wg44+wsowVbxBbrIWsA2iW0wL4u05bsrgrT8Wa0PBylo 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:(13230037)(1800799021)(376011)(366013);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-Chun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Pqj1USRp5GtSxKkTDBrTxR9erUT2iPU+lLAwLE4wpnZy6JdDlm2cdvtzPpRppN5WrMnN2ffV9hwLwaEcj3yKZYhGNDTVXNspLx2fIrNU0/7xaKg18IgUTmtCMVxs5nPTkSnAGdQdtvoTTiAuEhG8bauMs/be9CNjUn6lu2j2h4GaVpDs= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: e21a5837-9cf7-445f-c240-08dc91d9c385 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:05.5040 (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: Aw4f/IIsRFaeW7oXE/apXeSfEaT6UEM4ZgU0QB0Rgsfn3ezInmcnTsuGmsDu0kseJf9x6jm2ngE+yLw90XHVyA== 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: Y7qy_cZFXOKaJshye27Z_J_nudRr8kLV X-Proofpoint-ORIG-GUID: Y7qy_cZFXOKaJshye27Z_J_nudRr8kLV From: Dave Chinner We currently align extent allocation to stripe unit or stripe width. That is specified by an external parameter to the allocation code, which then manipulates the xfs_alloc_args alignment configuration in interesting ways. The args->alignment field specifies extent start alignment, but because we may be attempting non-aligned allocation first there are also slop variables that allow for those allocation attempts to account for aligned allocation if they fail. This gets much more complex as we introduce forced allocation alignment, where extent size hints are used to generate the extent start alignment. extent size hints currently only affect extent lengths (via args->prod and args->mod) and so with this change we will have two different start alignment conditions. Avoid this complexity by always using args->alignment to indicate extent start alignment, and always using args->prod/mod to indicate extent length adjustment. Signed-off-by: Dave Chinner [jpg: fixup alignslop references in xfs_trace.h and xfs_ialloc.c] Signed-off-by: John Garry --- fs/xfs/libxfs/xfs_alloc.c | 4 +- fs/xfs/libxfs/xfs_alloc.h | 2 +- fs/xfs/libxfs/xfs_bmap.c | 96 +++++++++++++++++--------------------- fs/xfs/libxfs/xfs_ialloc.c | 10 ++-- fs/xfs/xfs_trace.h | 8 ++-- 5 files changed, 54 insertions(+), 66 deletions(-) diff --git a/fs/xfs/libxfs/xfs_alloc.c b/fs/xfs/libxfs/xfs_alloc.c index 32f72217c126..35fbd6b19682 100644 --- a/fs/xfs/libxfs/xfs_alloc.c +++ b/fs/xfs/libxfs/xfs_alloc.c @@ -2391,7 +2391,7 @@ xfs_alloc_space_available( reservation = xfs_ag_resv_needed(pag, args->resv); /* do we have enough contiguous free space for the allocation? */ - alloc_len = args->minlen + (args->alignment - 1) + args->minalignslop; + alloc_len = args->minlen + (args->alignment - 1) + args->alignslop; longest = xfs_alloc_longest_free_extent(pag, min_free, reservation); if (longest < alloc_len) return false; @@ -2420,7 +2420,7 @@ xfs_alloc_space_available( * allocation as we know that will definitely succeed and match the * callers alignment constraints. */ - alloc_len = args->maxlen + (args->alignment - 1) + args->minalignslop; + alloc_len = args->maxlen + (args->alignment - 1) + args->alignslop; if (longest < alloc_len) { args->maxlen = args->minlen; ASSERT(args->maxlen > 0); diff --git a/fs/xfs/libxfs/xfs_alloc.h b/fs/xfs/libxfs/xfs_alloc.h index 0b956f8b9d5a..aa2c103d98f0 100644 --- a/fs/xfs/libxfs/xfs_alloc.h +++ b/fs/xfs/libxfs/xfs_alloc.h @@ -46,7 +46,7 @@ typedef struct xfs_alloc_arg { xfs_extlen_t minleft; /* min blocks must be left after us */ xfs_extlen_t total; /* total blocks needed in xaction */ xfs_extlen_t alignment; /* align answer to multiple of this */ - xfs_extlen_t minalignslop; /* slop for minlen+alignment calcs */ + xfs_extlen_t alignslop; /* slop for alignment calcs */ xfs_agblock_t min_agbno; /* set an agbno range for NEAR allocs */ xfs_agblock_t max_agbno; /* ... */ xfs_extlen_t len; /* output: actual size of extent */ diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c index c101cf266bc4..7f8c8e4dd244 100644 --- a/fs/xfs/libxfs/xfs_bmap.c +++ b/fs/xfs/libxfs/xfs_bmap.c @@ -3285,6 +3285,10 @@ xfs_bmap_select_minlen( xfs_extlen_t blen) { + /* Adjust best length for extent start alignment. */ + if (blen > args->alignment) + blen -= args->alignment; + /* * Since we used XFS_ALLOC_FLAG_TRYLOCK in _longest_free_extent(), it is * possible that there is enough contiguous free space for this request. @@ -3300,6 +3304,7 @@ xfs_bmap_select_minlen( if (blen < args->maxlen) return blen; return args->maxlen; + } static int @@ -3393,35 +3398,43 @@ xfs_bmap_alloc_account( xfs_trans_mod_dquot_byino(ap->tp, ap->ip, fld, ap->length); } -static int +/* + * Calculate the extent start alignment and the extent length adjustments that + * constrain this allocation. + * + * Extent start alignment is currently determined by stripe configuration and is + * carried in args->alignment, whilst extent length adjustment is determined by + * extent size hints and is carried by args->prod and args->mod. + * + * Low level allocation code is free to either ignore or override these values + * as required. + */ +static void xfs_bmap_compute_alignments( struct xfs_bmalloca *ap, struct xfs_alloc_arg *args) { struct xfs_mount *mp = args->mp; xfs_extlen_t align = 0; /* minimum allocation alignment */ - int stripe_align = 0; /* stripe alignment for allocation is determined by mount parameters */ if (mp->m_swidth && xfs_has_swalloc(mp)) - stripe_align = mp->m_swidth; + args->alignment = mp->m_swidth; else if (mp->m_dalign) - stripe_align = mp->m_dalign; + args->alignment = mp->m_dalign; if (ap->flags & XFS_BMAPI_COWFORK) align = xfs_get_cowextsz_hint(ap->ip); else if (ap->datatype & XFS_ALLOC_USERDATA) align = xfs_get_extsz_hint(ap->ip); + if (align) { if (xfs_bmap_extsize_align(mp, &ap->got, &ap->prev, align, 0, ap->eof, 0, ap->conv, &ap->offset, &ap->length)) ASSERT(0); ASSERT(ap->length); - } - /* apply extent size hints if obtained earlier */ - if (align) { args->prod = align; div_u64_rem(ap->offset, args->prod, &args->mod); if (args->mod) @@ -3436,7 +3449,6 @@ xfs_bmap_compute_alignments( args->mod = args->prod - args->mod; } - return stripe_align; } static void @@ -3508,7 +3520,7 @@ xfs_bmap_exact_minlen_extent_alloc( args.total = ap->total; args.alignment = 1; - args.minalignslop = 0; + args.alignslop = 0; args.minleft = ap->minleft; args.wasdel = ap->wasdel; @@ -3548,7 +3560,6 @@ xfs_bmap_btalloc_at_eof( struct xfs_bmalloca *ap, struct xfs_alloc_arg *args, xfs_extlen_t blen, - int stripe_align, bool ag_only) { struct xfs_mount *mp = args->mp; @@ -3562,23 +3573,15 @@ xfs_bmap_btalloc_at_eof( * allocation. */ if (ap->offset) { - xfs_extlen_t nextminlen = 0; + xfs_extlen_t alignment = args->alignment; /* - * Compute the minlen+alignment for the next case. Set slop so - * that the value of minlen+alignment+slop doesn't go up between - * the calls. + * Compute the alignment slop for the fallback path so we ensure + * we account for the potential alignemnt space required by the + * fallback paths before we modify the AGF and AGFL here. */ args->alignment = 1; - if (blen > stripe_align && blen <= args->maxlen) - nextminlen = blen - stripe_align; - else - nextminlen = args->minlen; - if (nextminlen + stripe_align > args->minlen + 1) - args->minalignslop = nextminlen + stripe_align - - args->minlen - 1; - else - args->minalignslop = 0; + args->alignslop = alignment - args->alignment; if (!caller_pag) args->pag = xfs_perag_get(mp, XFS_FSB_TO_AGNO(mp, ap->blkno)); @@ -3596,19 +3599,8 @@ xfs_bmap_btalloc_at_eof( * Exact allocation failed. Reset to try an aligned allocation * according to the original allocation specification. */ - args->alignment = stripe_align; - args->minlen = nextminlen; - args->minalignslop = 0; - } else { - /* - * Adjust minlen to try and preserve alignment if we - * can't guarantee an aligned maxlen extent. - */ - args->alignment = stripe_align; - if (blen > args->alignment && - blen <= args->maxlen + args->alignment) - args->minlen = blen - args->alignment; - args->minalignslop = 0; + args->alignment = alignment; + args->alignslop = 0; } if (ag_only) { @@ -3626,9 +3618,8 @@ xfs_bmap_btalloc_at_eof( return 0; /* - * Allocation failed, so turn return the allocation args to their - * original non-aligned state so the caller can proceed on allocation - * failure as if this function was never called. + * Aligned allocation failed, so all fallback paths from here drop the + * start alignment requirement as we know it will not succeed. */ args->alignment = 1; return 0; @@ -3636,7 +3627,9 @@ xfs_bmap_btalloc_at_eof( /* * We have failed multiple allocation attempts so now are in a low space - * allocation situation. Try a locality first full filesystem minimum length + * allocation situation. We give up on any attempt at aligned allocation here. + * + * Try a locality first full filesystem minimum length * allocation whilst still maintaining necessary total block reservation * requirements. * @@ -3653,6 +3646,7 @@ xfs_bmap_btalloc_low_space( { int error; + args->alignment = 1; if (args->minlen > ap->minlen) { args->minlen = ap->minlen; error = xfs_alloc_vextent_start_ag(args, ap->blkno); @@ -3672,13 +3666,11 @@ xfs_bmap_btalloc_low_space( static int xfs_bmap_btalloc_filestreams( struct xfs_bmalloca *ap, - struct xfs_alloc_arg *args, - int stripe_align) + struct xfs_alloc_arg *args) { xfs_extlen_t blen = 0; int error = 0; - error = xfs_filestream_select_ag(ap, args, &blen); if (error) return error; @@ -3697,8 +3689,7 @@ xfs_bmap_btalloc_filestreams( args->minlen = xfs_bmap_select_minlen(ap, args, blen); if (ap->aeof) - error = xfs_bmap_btalloc_at_eof(ap, args, blen, stripe_align, - true); + error = xfs_bmap_btalloc_at_eof(ap, args, blen, true); if (!error && args->fsbno == NULLFSBLOCK) error = xfs_alloc_vextent_near_bno(args, ap->blkno); @@ -3722,8 +3713,7 @@ xfs_bmap_btalloc_filestreams( static int xfs_bmap_btalloc_best_length( struct xfs_bmalloca *ap, - struct xfs_alloc_arg *args, - int stripe_align) + struct xfs_alloc_arg *args) { xfs_extlen_t blen = 0; int error; @@ -3747,8 +3737,7 @@ xfs_bmap_btalloc_best_length( * trying. */ if (ap->aeof && !(ap->tp->t_flags & XFS_TRANS_LOWMODE)) { - error = xfs_bmap_btalloc_at_eof(ap, args, blen, stripe_align, - false); + error = xfs_bmap_btalloc_at_eof(ap, args, blen, false); if (error || args->fsbno != NULLFSBLOCK) return error; } @@ -3775,27 +3764,26 @@ xfs_bmap_btalloc( .resv = XFS_AG_RESV_NONE, .datatype = ap->datatype, .alignment = 1, - .minalignslop = 0, + .alignslop = 0, }; xfs_fileoff_t orig_offset; xfs_extlen_t orig_length; int error; - int stripe_align; ASSERT(ap->length); orig_offset = ap->offset; orig_length = ap->length; - stripe_align = xfs_bmap_compute_alignments(ap, &args); + xfs_bmap_compute_alignments(ap, &args); /* Trim the allocation back to the maximum an AG can fit. */ args.maxlen = min(ap->length, mp->m_ag_max_usable); if ((ap->datatype & XFS_ALLOC_USERDATA) && xfs_inode_is_filestream(ap->ip)) - error = xfs_bmap_btalloc_filestreams(ap, &args, stripe_align); + error = xfs_bmap_btalloc_filestreams(ap, &args); else - error = xfs_bmap_btalloc_best_length(ap, &args, stripe_align); + error = xfs_bmap_btalloc_best_length(ap, &args); if (error) return error; diff --git a/fs/xfs/libxfs/xfs_ialloc.c b/fs/xfs/libxfs/xfs_ialloc.c index 14c81f227c5b..9f71a9a3a65e 100644 --- a/fs/xfs/libxfs/xfs_ialloc.c +++ b/fs/xfs/libxfs/xfs_ialloc.c @@ -758,12 +758,12 @@ xfs_ialloc_ag_alloc( * * For an exact allocation, alignment must be 1, * however we need to take cluster alignment into account when - * fixing up the freelist. Use the minalignslop field to - * indicate that extra blocks might be required for alignment, - * but not to use them in the actual exact allocation. + * fixing up the freelist. Use the alignslop field to indicate + * that extra blocks might be required for alignment, but not + * to use them in the actual exact allocation. */ args.alignment = 1; - args.minalignslop = igeo->cluster_align - 1; + args.alignslop = igeo->cluster_align - 1; /* Allow space for the inode btree to split. */ args.minleft = igeo->inobt_maxlevels; @@ -783,7 +783,7 @@ xfs_ialloc_ag_alloc( * on, so reset minalignslop to ensure it is not included in * subsequent requests. */ - args.minalignslop = 0; + args.alignslop = 0; } if (unlikely(args.fsbno == NULLFSBLOCK)) { diff --git a/fs/xfs/xfs_trace.h b/fs/xfs/xfs_trace.h index 25ff6fe1eb6c..0b2a2a1379bd 100644 --- a/fs/xfs/xfs_trace.h +++ b/fs/xfs/xfs_trace.h @@ -1808,7 +1808,7 @@ DECLARE_EVENT_CLASS(xfs_alloc_class, __field(xfs_extlen_t, minleft) __field(xfs_extlen_t, total) __field(xfs_extlen_t, alignment) - __field(xfs_extlen_t, minalignslop) + __field(xfs_extlen_t, alignslop) __field(xfs_extlen_t, len) __field(char, wasdel) __field(char, wasfromfl) @@ -1827,7 +1827,7 @@ DECLARE_EVENT_CLASS(xfs_alloc_class, __entry->minleft = args->minleft; __entry->total = args->total; __entry->alignment = args->alignment; - __entry->minalignslop = args->minalignslop; + __entry->alignslop = args->alignslop; __entry->len = args->len; __entry->wasdel = args->wasdel; __entry->wasfromfl = args->wasfromfl; @@ -1836,7 +1836,7 @@ DECLARE_EVENT_CLASS(xfs_alloc_class, __entry->highest_agno = args->tp->t_highest_agno; ), TP_printk("dev %d:%d agno 0x%x agbno 0x%x minlen %u maxlen %u mod %u " - "prod %u minleft %u total %u alignment %u minalignslop %u " + "prod %u minleft %u total %u alignment %u alignslop %u " "len %u wasdel %d wasfromfl %d resv %d " "datatype 0x%x highest_agno 0x%x", MAJOR(__entry->dev), MINOR(__entry->dev), @@ -1849,7 +1849,7 @@ DECLARE_EVENT_CLASS(xfs_alloc_class, __entry->minleft, __entry->total, __entry->alignment, - __entry->minalignslop, + __entry->alignslop, __entry->len, __entry->wasdel, __entry->wasfromfl, From patchwork Fri Jun 21 10:05:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 13707190 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 128BD17167F; Fri, 21 Jun 2024 10:06:22 +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=1718964384; cv=fail; b=WMw1mN/g0JFFFrxXEbQz4XWdC0bsKtsz2p11Bc86t2vqXaq/n/n/rXITN4IvnZRAcUTnJDH+7J1OtD27E9tj+xXv3hHCjYKJOoTESn/TZFEGRDRvD5onLx+zmMmZjTBFYs2TN1ET+mpfq8KTosCslyH7zfzBRBxNI3fMcMv1Y88= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718964384; c=relaxed/simple; bh=FC2RJgLz9yeOUXUezzKudOP9tD9llHw5rmERx7B1Lyo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=N7tvbYMHkt8rhuL4/aRqDOZNio233YHX0Xpf0E8f+LNtvOC2jWtSDMpKHW8dNb+0laPSFSRwr2q6LsWYer55PRfFXdtExMX5/693K5/AdUw/IH4gYxsSRI4OVUZr2KEtDgdS0y0d4ikbAXGUINkBTnE+cKbhX3EvQeEcYCXrruE= 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=Sk+Hb3La; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=olkXFgd3; arc=fail smtp.client-ip=205.220.165.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="Sk+Hb3La"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="olkXFgd3" Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45L7fQ3A027817; Fri, 21 Jun 2024 10:06:09 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=SR4ORPYab+nACGyn8QGiGYRguIGST6W8IbD0XuNB9J8=; b= Sk+Hb3LacOTURQQfpJoD+iyFBbb+WftgFC7dmZOGqEArRtwev1T3Ffs0ynDjQap6 BHLVUEh0xMpkrwr/wWHYEHKGtA7QkN7GwoZfz9/ByFEIsLMLLNQMA6ZdN8tH/vkU ZSa4snTZ670ltL/7iD3bH2NRWYxBlYDG+juC/+WO/4gjYvNcWZOHmWx2/IIjL4oH pFE+PWjBWS1soPKPkc2bs8gPqOvc/6Ww6sp++dhfEGqCYNbTFDr3WcnhL4AHPoaw gKU7SWYzCDHXIMURMracJ2Dh2G9vFGdexXov1OyvsLJs1OpX72z+uKh95Ipqelsy rbWPQ4Mb1YnX3Ny0YqySdA== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3yvrktsfxq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jun 2024 10:06:08 +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 45L91PTZ019521; Fri, 21 Jun 2024 10:06:08 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 3yvrn3mxst-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jun 2024 10:06:08 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dXddEbP1kL4NNJOXuw8gJL3SwSCN7/RVyvhcO10rtbE2fASW58kAVgS57osmqen4cJSKt6bcXuHsB3dfUlRQn+EJvtyamraFD8W0rpnR25nkTab8yI206MpwCdOVLuqv+PzWz7WOua36YtKkQMofCecsRT/Pj4QcnyVYccxI3c6VhKxzSk0RPOlMrFu3ja0UJYgiKKJSiCzlCwG/2h/DloTq0GogbjvXQtN+5lKsQqtBm/LfBhT4kvpb4JBzzFmXdlts74UT1ZDe1YaFqNzriwsPpfUqTXvVQNwcIRdYyJekfqXjPBL4va7VBuVbE0eebzrgxmaLbA80YPQaK0HXkg== 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=SR4ORPYab+nACGyn8QGiGYRguIGST6W8IbD0XuNB9J8=; b=gb1cUdn4G33miJcDA30WhHwd7/34MjUkI3WNgEH4fAotWe9ss048NNGShSvr2qA15jvAqGkWFrWb7YHDfWR/5LSz5FQgvyS3ibeCWFSF25r9Iw9stpLBYjFgDfJSPf2+um9espj8LI2ImP+2+QtgQMrpgmzp/ou/3FSZqTvZW1ysR1Xf9MjByfAtdKhs9FY5Z9Pz6qj0mZn9aK7hgicX28cYYjVMxdfpve3PiiTEoROBEQUim033xJ9knE9x05HgaJUJpGfpmG0VSKlLxGZp2EZ539mCKO8QcmMUVhrjpvahUnGK0j7OM7LdqnNazBmcSyvrtsLmvp6e8WV4APG2CQ== 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=SR4ORPYab+nACGyn8QGiGYRguIGST6W8IbD0XuNB9J8=; b=olkXFgd37MIh4hS+fFraDsiPvyl+Aq3TyIAZyVVl+lMxkkP9FUzyiySHmA9N99AkTSRX0IRrgwCsCZ2IVoDccv9b4Lln5WW4+LoENYgw9RGvzMZiSFoRU7jTIEcP/eSeGab837HnqGiQqpoUWob50Ilv3cFROC3PCx4Zynu+uq4= 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:07 +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:07 +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 04/13] xfs: make EOF allocation simpler Date: Fri, 21 Jun 2024 10:05:31 +0000 Message-Id: <20240621100540.2976618-5-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: BL1PR13CA0433.namprd13.prod.outlook.com (2603:10b6:208:2c3::18) 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_|CH3PR10MB6884:EE_ X-MS-Office365-Filtering-Correlation-Id: 8d70a4ef-c311-487e-4df1-08dc91d9c46b 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: kU7s7jkJ89+a04eQ0SCjhwe4JLi5V9p3tATaRr8xxBXzEMn3vYNXoQXEEtn9T88TS2XirPBSfwkmug051bM8ChwbkdoIFgZasbEEnco3Fd122yAnanRMBO1uJXQW9pcvow1et9mr//iVX8wqjjI+cLuPLjqcybtY0XRkHuSZZeTU9mF6w1keS3zJmxvSHT1XuR/YBVQ13oRAqOLGitOXkYLGDemu3QfhjkCMqtOQ7EJ374AxD9ScrO4eIexH6OHPKXKaIVd+/9XCk0tJPVUlamF1a3SZuyfEB5q+qsSyAkzUmNomWz0KgTW7ffrXbhJTJsdiToowBh3KS0mSPKoYIPVQ4nGIrPauAXeoYB792JKpEHQSIZRZ8ZstS3enjkaa4sIBXAtXnWJGivoCwUUGUKdo9VWHutxoqZbcWJGaV7qDEQSVK4adaQG113ukkDyyoeBEPiYqnfx2L0w1siWlJ+C/KvDu/9HtSBwL3UR++eHDwngj4RJC7D/anFnkUc9IvDGizEnPXLf/k+iXECJyX9ecveZlY2125duF8hb76J6JufSFamhkwQzcaOdg2c3bepAgOR4ohidKdX7/UxhMeAlsvhirN0Bf+JjJL2+u6O08kLZ7cyVA/lDGDsnkGlj6VU9wt93HO0joeCLMVkcQOrsjuzdfykJc/+K3D+o9//7HAqJLWgqthoezMVKf36aK8HVkuz37b8hRk2QdYseeyJr7xGjsY7wauXPy1C1yVRcQcKGOFRtMibkvODwJ5FSsCb4mtwSMfNAAp1HnGPBURD7VL22fpq3F0E5j6VZqStwbrXXU/C5e2QvcgrctJVCEoeApzxg1GnhhnRdhSmOMxlss/YletbZNtS2Ntc4HdHaQ5c5rp3pRt6Z7UzBoHLYxzQtmiWQFh/V9pmG9IgDOqRZzsFcMebf0IsB8C9SJVaq4JXstI2khsyviJ14z6sY3MWZpLCQ+XYHuWSxVbslzixJ+2SYq53NaYuoP/WMrxoQqVmGB5Hf3jIDFX4k/YLyTP0qomBP+PcrwJ254biI0Md5k5x1T8+j8I7IezXs8vvNWBwf4cNeDkeXoGxbYYrl4MQQWTiEOTAk09vAgwc0wob6JaIKW2xhWCJGmAH8zR8TkUHPtXwExiRJTDBpf1lEE9g/5+Wt1Bvef/XsROIxcVEZ5NEgh2j1Wh9jHkdfZv+R/+cxNEq7ujecP9CoIaFlMjcMrHphwGUj2NKSYzjZLRh+qThjf/7NOzd8lb+ZMcmPBqtDYNnqF/zcKd+UBSp+swTFKhObqKE67/qblTwh62poCaJ6109/gF40bwhQaGd4MrWs7ZTF9TqBnZSRiJRB7 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:(13230037)(1800799021)(376011)(366013);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-Message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ra6JMXYRZRPn5gIYn0fsnsU2X5LNsju9jTQWRd4rV4ePThICVornLMlkIkRSIGg39FfaFQnbPB8GryAhyNzLm99pJzS+nJQTM7zcA5gYOG/vce+rGsmxfm5xiW/pqldXzNWAzN/ftE1uYseeIZViKW1zeN6G4aU0= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8d70a4ef-c311-487e-4df1-08dc91d9c46b 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:07.0063 (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: TwLfCLVfZy9GvMr8uCwAdt6MwdyEOy+0xHnpxYoBqarMutQvI6Jf8RBEqWsdIINWl/7piyAEodxuHeAMVD9Kow== 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: VW1JPkgKJbu6kzcZdiZCdbf2kWUMUg37 X-Proofpoint-ORIG-GUID: VW1JPkgKJbu6kzcZdiZCdbf2kWUMUg37 From: Dave Chinner Currently the allocation at EOF is broken into two cases - when the offset is zero and when the offset is non-zero. When the offset is non-zero, we try to do exact block allocation for contiguous extent allocation. When the offset is zero, the allocation is simply an aligned allocation. We want aligned allocation as the fallback when exact block allocation fails, but that complicates the EOF allocation in that it now has to handle two different allocation cases. The caller also has to handle allocation when not at EOF, and for the upcoming forced alignment changes we need that to also be aligned allocation. To simplify all this, pull the aligned allocation cases back into the callers and leave the EOF allocation path for exact block allocation only. This means that the EOF exact block allocation fallback path is the normal aligned allocation path and that ends up making things a lot simpler when forced alignment is introduced. Signed-off-by: Dave Chinner Signed-off-by: John Garry --- fs/xfs/libxfs/xfs_bmap.c | 129 +++++++++++++++---------------------- fs/xfs/libxfs/xfs_ialloc.c | 2 +- 2 files changed, 54 insertions(+), 77 deletions(-) diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c index 7f8c8e4dd244..528e3cd81ee6 100644 --- a/fs/xfs/libxfs/xfs_bmap.c +++ b/fs/xfs/libxfs/xfs_bmap.c @@ -3310,12 +3310,12 @@ xfs_bmap_select_minlen( static int xfs_bmap_btalloc_select_lengths( struct xfs_bmalloca *ap, - struct xfs_alloc_arg *args, - xfs_extlen_t *blen) + struct xfs_alloc_arg *args) { struct xfs_mount *mp = args->mp; struct xfs_perag *pag; xfs_agnumber_t agno, startag; + xfs_extlen_t blen = 0; int error = 0; if (ap->tp->t_flags & XFS_TRANS_LOWMODE) { @@ -3329,19 +3329,18 @@ xfs_bmap_btalloc_select_lengths( if (startag == NULLAGNUMBER) startag = 0; - *blen = 0; for_each_perag_wrap(mp, startag, agno, pag) { - error = xfs_bmap_longest_free_extent(pag, args->tp, blen); + error = xfs_bmap_longest_free_extent(pag, args->tp, &blen); if (error && error != -EAGAIN) break; error = 0; - if (*blen >= args->maxlen) + if (blen >= args->maxlen) break; } if (pag) xfs_perag_rele(pag); - args->minlen = xfs_bmap_select_minlen(ap, args, *blen); + args->minlen = xfs_bmap_select_minlen(ap, args, blen); return error; } @@ -3551,78 +3550,40 @@ xfs_bmap_exact_minlen_extent_alloc( * If we are not low on available data blocks and we are allocating at * EOF, optimise allocation for contiguous file extension and/or stripe * alignment of the new extent. - * - * NOTE: ap->aeof is only set if the allocation length is >= the - * stripe unit and the allocation offset is at the end of file. */ static int xfs_bmap_btalloc_at_eof( struct xfs_bmalloca *ap, - struct xfs_alloc_arg *args, - xfs_extlen_t blen, - bool ag_only) + struct xfs_alloc_arg *args) { struct xfs_mount *mp = args->mp; struct xfs_perag *caller_pag = args->pag; + xfs_extlen_t alignment = args->alignment; int error; + ASSERT(ap->aeof && ap->offset); + ASSERT(args->alignment >= 1); + /* - * If there are already extents in the file, try an exact EOF block - * allocation to extend the file as a contiguous extent. If that fails, - * or it's the first allocation in a file, just try for a stripe aligned - * allocation. + * Compute the alignment slop for the fallback path so we ensure + * we account for the potential alignemnt space required by the + * fallback paths before we modify the AGF and AGFL here. */ - if (ap->offset) { - xfs_extlen_t alignment = args->alignment; - - /* - * Compute the alignment slop for the fallback path so we ensure - * we account for the potential alignemnt space required by the - * fallback paths before we modify the AGF and AGFL here. - */ - args->alignment = 1; - args->alignslop = alignment - args->alignment; - - if (!caller_pag) - args->pag = xfs_perag_get(mp, XFS_FSB_TO_AGNO(mp, ap->blkno)); - error = xfs_alloc_vextent_exact_bno(args, ap->blkno); - if (!caller_pag) { - xfs_perag_put(args->pag); - args->pag = NULL; - } - if (error) - return error; - - if (args->fsbno != NULLFSBLOCK) - return 0; - /* - * Exact allocation failed. Reset to try an aligned allocation - * according to the original allocation specification. - */ - args->alignment = alignment; - args->alignslop = 0; - } + args->alignment = 1; + args->alignslop = alignment - args->alignment; - if (ag_only) { - error = xfs_alloc_vextent_near_bno(args, ap->blkno); - } else { + if (!caller_pag) + args->pag = xfs_perag_get(mp, XFS_FSB_TO_AGNO(mp, ap->blkno)); + error = xfs_alloc_vextent_exact_bno(args, ap->blkno); + if (!caller_pag) { + xfs_perag_put(args->pag); args->pag = NULL; - error = xfs_alloc_vextent_start_ag(args, ap->blkno); - ASSERT(args->pag == NULL); - args->pag = caller_pag; } - if (error) - return error; - if (args->fsbno != NULLFSBLOCK) - return 0; - - /* - * Aligned allocation failed, so all fallback paths from here drop the - * start alignment requirement as we know it will not succeed. - */ - args->alignment = 1; - return 0; + /* Reset alignment to original specifications. */ + args->alignment = alignment; + args->alignslop = 0; + return error; } /* @@ -3688,12 +3649,19 @@ xfs_bmap_btalloc_filestreams( } args->minlen = xfs_bmap_select_minlen(ap, args, blen); - if (ap->aeof) - error = xfs_bmap_btalloc_at_eof(ap, args, blen, true); + if (ap->aeof && ap->offset) + error = xfs_bmap_btalloc_at_eof(ap, args); + /* This may be an aligned allocation attempt. */ if (!error && args->fsbno == NULLFSBLOCK) error = xfs_alloc_vextent_near_bno(args, ap->blkno); + /* Attempt non-aligned allocation if we haven't already. */ + if (!error && args->fsbno == NULLFSBLOCK && args->alignment > 1) { + args->alignment = 1; + error = xfs_alloc_vextent_near_bno(args, ap->blkno); + } + out_low_space: /* * We are now done with the perag reference for the filestreams @@ -3715,7 +3683,6 @@ xfs_bmap_btalloc_best_length( struct xfs_bmalloca *ap, struct xfs_alloc_arg *args) { - xfs_extlen_t blen = 0; int error; ap->blkno = XFS_INO_TO_FSB(args->mp, ap->ip->i_ino); @@ -3726,23 +3693,33 @@ xfs_bmap_btalloc_best_length( * the request. If one isn't found, then adjust the minimum allocation * size to the largest space found. */ - error = xfs_bmap_btalloc_select_lengths(ap, args, &blen); + error = xfs_bmap_btalloc_select_lengths(ap, args); if (error) return error; /* - * Don't attempt optimal EOF allocation if previous allocations barely - * succeeded due to being near ENOSPC. It is highly unlikely we'll get - * optimal or even aligned allocations in this case, so don't waste time - * trying. + * If we are in low space mode, then optimal allocation will fail so + * prepare for minimal allocation and run the low space algorithm + * immediately. */ - if (ap->aeof && !(ap->tp->t_flags & XFS_TRANS_LOWMODE)) { - error = xfs_bmap_btalloc_at_eof(ap, args, blen, false); - if (error || args->fsbno != NULLFSBLOCK) - return error; + if (ap->tp->t_flags & XFS_TRANS_LOWMODE) { + ASSERT(args->fsbno == NULLFSBLOCK); + return xfs_bmap_btalloc_low_space(ap, args); + } + + if (ap->aeof && ap->offset) + error = xfs_bmap_btalloc_at_eof(ap, args); + + /* This may be an aligned allocation attempt. */ + if (!error && args->fsbno == NULLFSBLOCK) + error = xfs_alloc_vextent_start_ag(args, ap->blkno); + + /* Attempt non-aligned allocation if we haven't already. */ + if (!error && args->fsbno == NULLFSBLOCK && args->alignment > 1) { + args->alignment = 1; + error = xfs_alloc_vextent_start_ag(args, ap->blkno); } - error = xfs_alloc_vextent_start_ag(args, ap->blkno); if (error || args->fsbno != NULLFSBLOCK) return error; diff --git a/fs/xfs/libxfs/xfs_ialloc.c b/fs/xfs/libxfs/xfs_ialloc.c index 9f71a9a3a65e..40a2daeea712 100644 --- a/fs/xfs/libxfs/xfs_ialloc.c +++ b/fs/xfs/libxfs/xfs_ialloc.c @@ -780,7 +780,7 @@ xfs_ialloc_ag_alloc( * the exact agbno requirement and increase the alignment * instead. It is critical that the total size of the request * (len + alignment + slop) does not increase from this point - * on, so reset minalignslop to ensure it is not included in + * on, so reset alignslop to ensure it is not included in * subsequent requests. */ args.alignslop = 0; From patchwork Fri Jun 21 10:05:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 13707189 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 E190D17167D; Fri, 21 Jun 2024 10:06:22 +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=1718964384; cv=fail; b=TrK+Tl4QlDA5oXLn0vUWfjo6Navfq0t+CHxVRYysQYCoYcw77yBzdOOQivmexvqjUSbZ23RIo552Pm2DIJyXwOqBsUxrG3lhn5zR2S9bTJuhD4wFU7sdXvK3LTSgGZBUV/TKuL1fY3in22T2j4lnY6D9XmqdIItvhCxVV0hd5xo= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718964384; c=relaxed/simple; bh=KAzH654l1l3pcCgnbL0oVGabivRWQAL2eDYEpBhEMgo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=A5ys0hOq5lo7hiPYUETsUz/mjTFmYKO1ZgSFGpNv530NeAN36K/lrayll4kUVNOMGMRnNn1/pw+JErj2d55O65NuEu6375b3FXmB4PXxNsZWYkZABeqsRpKhK8sUcKSiMhl88Hcavl45iwnsn68ag/HJvHjusH12LtcS72EFpN4= 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=nqJTQ9J2; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=JL9R+Ouc; arc=fail smtp.client-ip=205.220.165.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="nqJTQ9J2"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="JL9R+Ouc" Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45L7fhvB031177; Fri, 21 Jun 2024 10:06:12 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=LSrsRWhnsw/pxUhwofAbnAqdP463+n+JbVEr26feiEk=; b= nqJTQ9J2ZhXgeHVnUje+EmzCSI8ZAKwDoSyrlNAXq1A9rzwMloKr65U8QNDMQhIx t8FnqIvtSdx3iOC0v/s6zsj7VvaII7VOLZhLvQMW9WAR/Z6u5MJroBq0jxT15KGZ UJQbEel2S5Hfaoe6/1b/a+J8dJRa2gu2W/jMd0iiuKDJvYpYpwRxWp15wZuh5Hzd PDgkHl/uKxndIJ7h55IpiwZ9AJexVarHwIRH1os2KbHFCma9LIRLAZOigu1VAYk+ k6e1KQEHnab2o7GQY/zHL19wnRADbJ7m/xGJWRIujUKm+WjCMFC1qs0NEIGI34Lh j80ApgpTng9ybageICQmpw== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3yvrkgsg4n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jun 2024 10:06:12 +0000 (GMT) Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 45L8wx1M025270; Fri, 21 Jun 2024 10:06:10 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2101.outbound.protection.outlook.com [104.47.58.101]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3yvrn5wcgs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jun 2024 10:06:10 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kZIszIntd3bGgZ1argkbhQe8/4bJcC8t0sHMXypsephW5PZ51acynJwV+H9QCb51zUUaIfBUgHoeIirRboCrgWL51KC7y0k4lO57vxPCOUlY4qSBOu1BViZgAuIxljJ2xsmjcfre9SQr+yxgYF/9ZaUa4d/zTzMJevEe/Cn2+HR6ou/IO+zR8tf8BZx4TQ/X/VFklIkUDsJ/mOYKRrWefmIogkAuAJ+JbSqK83B36YCMBCjc08+SkPK7uNZhLjk3msY8PWp4iUhUgemBCWamjTZ4Q5+V8J89Oe4AbfcPbKj4A0NGpnGDKXS2XdayRuYMR0uDnOycL79QojhDG5rpUg== 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=LSrsRWhnsw/pxUhwofAbnAqdP463+n+JbVEr26feiEk=; b=ArgfedDvvViuBZukuirjh87VC270fSQ93tV9lyi9qSU0ctNvG4DPxWCEVZUCi1WWoAx1jgj1Ikz90lZ0IsZYPUO+g7EQQnxoBRWWELqwzQo4WXIbx7gV94yYmp+uyDt4pyEZK/w+0Hzlk9Q7OYOzb/7hdHoqPHC1yCUpqPZvq0tADQa5fobNbFaAsq3eg/IovkToOVMQBzkffD+ouyK6j2hxLhsfDCNyt2SjHv0DhSIyldGyF0+gXzVz9JVyZa4+Q4JKi2HvyEzihxqP4RnHyeqXkF6AsREeEoKHfBcmpWJeoDlpphNf+Vi+oY7cYi6rUzh2zDeGFEUufrRJzDRY7g== 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=LSrsRWhnsw/pxUhwofAbnAqdP463+n+JbVEr26feiEk=; b=JL9R+OucjFOm3YrMV+8RMs7q0gZyHO+JFlY5SK/T2l9ETWj7ycuWoTJREmdP+qeWbdUt/89hlLxrFyxIdZHJhqEh+GtVWM7siGPlBmIu0JvLb5dTDEGFjPcCUhupulIESKcRDpi2Us7dsRAR02uds13xfxDpoh5JxQsZEj1Hhxs= 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:09 +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:09 +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 05/13] xfs: introduce forced allocation alignment Date: Fri, 21 Jun 2024 10:05:32 +0000 Message-Id: <20240621100540.2976618-6-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: BL1PR13CA0430.namprd13.prod.outlook.com (2603:10b6:208:2c3::15) 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_|CH3PR10MB6884:EE_ X-MS-Office365-Filtering-Correlation-Id: 9bc42425-b09d-43a4-1f69-08dc91d9c5a1 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: tdTZ9MT8gZ7paCuttRqFVR1cFHqWh29iln7j/Y5iWepiDxtKvsvgNCflF6dezZIsg4O6hG+gclmcp5AcEjIutcAMczrsnty9IKaljZpTmk3Bi8Q8dK8Z5FgkGhggp5Yl344Y8KedjMIc+6rBDNodOCDg2AVD3urGDYOEPeoxT3f851H5/n67ofWrl2Gj6s2VLhB7quJE0ZSHBVeY63r2vXlZCDiRYOJrePDClh9ApPWPT59rRuUeI6nSpmVStk1teoXLCY/KQW8dT4zghbuJIU8TiIZyfeNbMiJoHfBYSL5YxZnZsDoo6Q3EiOTQ+lP8seVBP/Ws5yEvf+OH1ZYueufwJxtP24J9ME8iVeBr2y7IA53RSss2KP3ZJjrKkwRYrSuqOzddLS3vzSW1wYQYMvJk5gDWyF+Y28pKk1neBIlaPxFoxJo0ykYhYEokQh8OrXETUfmr7em44oOPoSqyL/LBGuC+bOeEhSH6bPRiSwm7BWKrGf41Hlmh9lNGHAoEe7OAGrGi8Eh92i8XzXH+TUIFLjbsDlvr+1Q35XdtHlnH6jZWVAZYNiuANQiSUODaeX8zV2X2yLlGmRa6rpFz8sPqNqX6+PYA6SXSkyI7z5poeNduv7aO79gL2Qo0BBnzV3M8zRPPw+XJJ+RaUvUktKLrlatkInxBFc+L4DL0GmE9y5x3c86dgvkjiA8E4c3z+ZKWkKq38qpkDe0XVM48L5P31izASbzl7NdP27W64dLpKN+DYIbWNGE1Er102ztSl9BV68wOOFvqSlBk8enld4mIBkdS11tEDFNF4Rw1WpZqlaBPY1kzHtAXxxeQcGVXZveHdwAnuUwyEz0pdLnnV7xe8JjiK5hdSoxic/OggHyAbUsbFQtzJo9PEIRWG9zkPYykHzcogolItN5/pvM0/e73LSQ4VPoxjOuTVwLzhWUQJShjkGdcktjjpN5wVTOXV2PKLHtSr9cUN65gbTPMu46p1X1Gb16iwpF/yIDxVW1NQNYrok+LjFyNhIZscSV+ocw981M/Vf2bSvyXSTp63VD/ri1GMBqNvxvZPux7efK+DHtOMlv7nrX6lXjGiFeQOo1jx3p8+62ehCJM9RC9CsFWvgA3BId048qp3GPgewO6CrLjVxVnsDTMtOk1otw2JQ7aA7Hszf5CSGgQpGQwvBBqjUxcUgA6gPrV0KauGRFZbGwGmkoaRbAssIgh4HZJEZI5RfNQbnAOsccgoc1qfox2M4Z6bCsxjb6V6h/xBDKwAPq2w2lgJuNM6AxY51e23zwCjZBjqsoMr/uwhgGQoJzDBuM7h561NAzSPrY0pP4= 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:(13230037)(1800799021)(376011)(366013);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 0Oyrd6ctG7OHohupbE/P9eYvzhNiGeXVv+bKv1ckbRHew0/3FpEtaVGIo0R8DJcsQQJKbfNvk6zHPqrcxcO74lBIYXF4sB+T1a1z5GS3Z+tO5usyDbpUQftKE2lNEdJOMUD5l86TI7iM7ckvbb99l/H/UTT3HN1B0Ac69Hesuqe3uU1XHfiMaDM30yGty5AEUczn18L2mUXnLCSV/pBVqB1QaCv8KLPylTMVEaUBDYLVb+42toyjQ/t76t8RxbH1eX9l/nLUswWurz6oYZLTRvfeEAD148mV2hIzew/yGJ7j1d6eyFAX3FPvEKL6JZH2wY2cAq8A0bWbj0nlofT532gyHi/kndypScUy6EU35TCAchk4wyl9A9GqZzsnjnpYDJZ9fbvvC7qxQUJYavLrPvT2VW9nBo1ZhAs29Pxdp82o2ecxegRGRFX3Z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dEIOIa/n8/AGAMGpwLzFAttqi2IxXJrkHsTG0M7pcSTfTcMSxKYmJDRNvvJioEzTU2YM6vySE37le+ES/qg+w== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: YR9dxj0KjUG63K0zzZ/G7IbbJKTnfG/fQ56rWDrSN9BGV6OEMckb3yDxrg1m7V4kgoxqid/3hxijbvrFl6VnJwelVDSYhjc6z8HOxDvNjeeBYE124BgR6qibN6IHRN6P1UUJJxg75JAn89WDauElQgx/yH6YdnMcUN2QPhUVePYR47LHggEZ+ZZ/DKEubzgYqisxj6Ey3wTU/A5xNEKFs9JOhmOc7txUI8hJt2UZzmENfn+XG15PnZYDJjHbx+n2HzxgpArAMACbYb5pySyX+AOGonw5XqSXcDtbsNq8w2P7FbDikV8y1wTepL6kLtr1SWh57kkHNG9LpaMDx7fyP6ZXlnxehIlyU2Lry5VvpivTWOtPId8DVHXUTpr4LN58Hpkcp1l76idINAo8czarg254zSiIr/ZRSHqL2z6/2aRQ5oyf+geUCFXiOBUfRH4ZPJSryjcng64qTtYnYeBnJR1230tZyn/Va/02Rm6ieBUSS/JaYNE389Hqc9HJExARNWi8nwckbwcrxx0KaKPD1t0VaiYlSMHehy7F0vbOoNqe5L7eNX3Edw9TqujvP8sZhzwyHjhvc7qfcZLGfxdT5GLUj8LpwMf9C4OnG8wP9W4= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9bc42425-b09d-43a4-1f69-08dc91d9c5a1 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:09.0367 (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: HiyTJus88lqvrEHxb/LT3MWcCamfqvTIOWDkDB0gfVk4Lh9pk6KZARhv/N5QPxlLuTorW10uy96zHUYdAPKLHA== 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 spamscore=0 mlxlogscore=999 phishscore=0 adultscore=0 malwarescore=0 mlxscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2406180000 definitions=main-2406210074 X-Proofpoint-GUID: 0cTKTN1MRSW2uWZZ42dX-tew0yKMAaWt X-Proofpoint-ORIG-GUID: 0cTKTN1MRSW2uWZZ42dX-tew0yKMAaWt From: Dave Chinner When forced allocation alignment is specified, the extent will be aligned to the extent size hint size rather than stripe alignment. If aligned allocation cannot be done, then the allocation is failed rather than attempting non-aligned fallbacks. Note: none of the per-inode force align configuration is present yet, so this just triggers off an "always false" wrapper function for the moment. Signed-off-by: Dave Chinner Signed-off-by: John Garry Reviewed-by: Darrick J. Wong --- fs/xfs/libxfs/xfs_alloc.h | 1 + fs/xfs/libxfs/xfs_bmap.c | 29 +++++++++++++++++++++++------ fs/xfs/xfs_inode.h | 5 +++++ 3 files changed, 29 insertions(+), 6 deletions(-) diff --git a/fs/xfs/libxfs/xfs_alloc.h b/fs/xfs/libxfs/xfs_alloc.h index aa2c103d98f0..7de2e6f64882 100644 --- a/fs/xfs/libxfs/xfs_alloc.h +++ b/fs/xfs/libxfs/xfs_alloc.h @@ -66,6 +66,7 @@ typedef struct xfs_alloc_arg { #define XFS_ALLOC_USERDATA (1 << 0)/* allocation is for user data*/ #define XFS_ALLOC_INITIAL_USER_DATA (1 << 1)/* special case start of file */ #define XFS_ALLOC_NOBUSY (1 << 2)/* Busy extents not allowed */ +#define XFS_ALLOC_FORCEALIGN (1 << 3)/* forced extent alignment */ /* freespace limit calculations */ unsigned int xfs_alloc_set_aside(struct xfs_mount *mp); diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c index 528e3cd81ee6..9131ba8113a6 100644 --- a/fs/xfs/libxfs/xfs_bmap.c +++ b/fs/xfs/libxfs/xfs_bmap.c @@ -3401,9 +3401,10 @@ xfs_bmap_alloc_account( * Calculate the extent start alignment and the extent length adjustments that * constrain this allocation. * - * Extent start alignment is currently determined by stripe configuration and is - * carried in args->alignment, whilst extent length adjustment is determined by - * extent size hints and is carried by args->prod and args->mod. + * Extent start alignment is currently determined by forced inode alignment or + * stripe configuration and is carried in args->alignment, whilst extent length + * adjustment is determined by extent size hints and is carried by args->prod + * and args->mod. * * Low level allocation code is free to either ignore or override these values * as required. @@ -3416,11 +3417,18 @@ xfs_bmap_compute_alignments( struct xfs_mount *mp = args->mp; xfs_extlen_t align = 0; /* minimum allocation alignment */ - /* stripe alignment for allocation is determined by mount parameters */ - if (mp->m_swidth && xfs_has_swalloc(mp)) + /* + * Forced inode alignment takes preference over stripe alignment. + * Stripe alignment for allocation is determined by mount parameters. + */ + if (xfs_inode_has_forcealign(ap->ip)) { + args->alignment = xfs_get_extsz_hint(ap->ip); + args->datatype |= XFS_ALLOC_FORCEALIGN; + } else if (mp->m_swidth && xfs_has_swalloc(mp)) { args->alignment = mp->m_swidth; - else if (mp->m_dalign) + } else if (mp->m_dalign) { args->alignment = mp->m_dalign; + } if (ap->flags & XFS_BMAPI_COWFORK) align = xfs_get_cowextsz_hint(ap->ip); @@ -3607,6 +3615,11 @@ xfs_bmap_btalloc_low_space( { int error; + if (args->alignment > 1 && (args->datatype & XFS_ALLOC_FORCEALIGN)) { + args->fsbno = NULLFSBLOCK; + return 0; + } + args->alignment = 1; if (args->minlen > ap->minlen) { args->minlen = ap->minlen; @@ -3658,6 +3671,8 @@ xfs_bmap_btalloc_filestreams( /* Attempt non-aligned allocation if we haven't already. */ if (!error && args->fsbno == NULLFSBLOCK && args->alignment > 1) { + if (args->datatype & XFS_ALLOC_FORCEALIGN) + return error; args->alignment = 1; error = xfs_alloc_vextent_near_bno(args, ap->blkno); } @@ -3716,6 +3731,8 @@ xfs_bmap_btalloc_best_length( /* Attempt non-aligned allocation if we haven't already. */ if (!error && args->fsbno == NULLFSBLOCK && args->alignment > 1) { + if (args->datatype & XFS_ALLOC_FORCEALIGN) + return error; args->alignment = 1; error = xfs_alloc_vextent_start_ag(args, ap->blkno); } diff --git a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h index 292b90b5f2ac..42f999c1106c 100644 --- a/fs/xfs/xfs_inode.h +++ b/fs/xfs/xfs_inode.h @@ -311,6 +311,11 @@ static inline bool xfs_inode_has_large_extent_counts(struct xfs_inode *ip) return ip->i_diflags2 & XFS_DIFLAG2_NREXT64; } +static inline bool xfs_inode_has_forcealign(struct xfs_inode *ip) +{ + return false; +} + /* * Decide if this file is a realtime file whose data allocation unit is larger * than a single filesystem block. From patchwork Fri Jun 21 10:05:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 13707204 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 854B3170849; Fri, 21 Jun 2024 10:07:20 +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=1718964442; cv=fail; b=YrXYj4eL1RRcRagGmB5tC9YG3OBqrYh+qqTlhtga/05WYzxOcc52UgFw+UCrLw7yZ50Pf2YJhDaL21DP3sxtETzTrBHab0Y2g0cYtXlfrdLhvlogqH6oKdU5ZP/UNb6aqNWJjDP+HDBPKZBgaVQ0xh1S1NjWxHWe5q+1o7ElsZ8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718964442; c=relaxed/simple; bh=5gV2ZZbOczLEbIwF/w0Qbx8CIPJ9JAUn93Cf1etsAxo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=g8YMlmVX/6JbpoMfba1ecPGU0GO1MLnAx/EhV3JFg3dxnyASke6iYXMGR2RKE3n5cLMmnxDaPL6bCmdu6cMUk0jnhvMYb+B3Z/ivWoOeN+dJ9IKG+T0hZrQkgb6lEDJ72HSKgxDpw2yKa7PEnVQG9M84m6wN1H7yJnHFe6o1i+w= 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=e9kc/FqK; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=XuH7+0Ow; 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="e9kc/FqK"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="XuH7+0Ow" 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 45L7fShi007114; Fri, 21 Jun 2024 10:06:14 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=lfuBYEjC3Bso2fSI4L6QpuFe97Xlh1NX0HFaJB0ytJM=; b= e9kc/FqKJSst5BZl20sCSl/AlbHqSocnChaZPJgKp++67cFaN4ESqL3jSLdY+yAt kNZq1u8M+ZjckyCgsBG5o3TdZEdb+NXMlHlKanmbsLoGk/DaeSyFik+q3Zq4OSLe 0WVjmObzWJhuLerzgPFM9Qip8jzFDjUKEiveq5N5itxTbqSFPQhksgMWKiCS5VND km36pbn0m+zi/ofXu0sZSkDD5NyfYbzb9dN+yYWQpMjvDl7LFB9yvuxbu7wlUomj eJJsrjfaIXOGSMsiNjdw/f7fbbQoP9OUKafCUjaSPuXtwdUkBHlCguA1goQBovJt f2VyfJfXKy2zIYaJ9kXvgg== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3yvrkf9dpy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jun 2024 10:06:13 +0000 (GMT) Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 45L8MZmi012854; Fri, 21 Jun 2024 10:06:12 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2100.outbound.protection.outlook.com [104.47.58.100]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3yvrn4er7h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jun 2024 10:06:12 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Tr7S86CjipQRfLOmZIYXyFaaEzG7PPpE++5AoYwQ2E5jfMaALbwrRjDMaO85YxL13PTF+oV1e+wsSbNCMyMRiBhVc4wAOH8JcXz+mGcXwC+DP9fc94CHteSSpR8MIWbVEvkU2Viqzv2lAppowhQrab/NllSfJWCHWGi+SPR39bN/pyF1syO8hhQ4188qyGZrHPJcLwiriIp8iekl7T3crNeelF37p9AD1omRPzFp5/U6teQ2AA8L8enns60l3+apRKtZA+VM1T4eg2smaKaMU8n61EQjntSHHdOHDacMRmDrbXpRYR5o1g6ucFXOVb3g0MP1feKdYP2IDHCubGOrlw== 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=lfuBYEjC3Bso2fSI4L6QpuFe97Xlh1NX0HFaJB0ytJM=; b=GN77d3AkZqos9hOAbpOhTktGUt6sSn4XKFLpVbL3WYuY7ytfePFWEtqq5W88MwPXMc8z1rYlunEQ2vXb/1heI+UQCLkTuyTuFv3z5dZr5g9rNqTZ+06I60o9+WSadL4PAYDpXh9quuW7uMBR8umlnoTxg2J53FXRF2xElqD/ofacKC7Cmcw0AjlBKUnTeRnUElmbmUH0zF20ZyaUqxig1wnNSeUoLCDfIT985HfShSAyUZAa5iVb3RDYChYoURyVcIvcV5T1I312pxmmbP8mmcqm6JYYumSThtSHMqv3Uc+vgHkkZkIdTlaWShVvrpEbiyUNaSJeoHGxTYE11e35qA== 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=lfuBYEjC3Bso2fSI4L6QpuFe97Xlh1NX0HFaJB0ytJM=; b=XuH7+0OwVxRXA9MNRiBAbkK/+94vYuXHrCzCbRrDXdhCRrBXrI5M7Q9tohyQh1OQdE09i2XSATVf2nU8aY21dFSpIfpypb7O8uyp157TRr1vN4qNykcJLq2s3D3QFagk++YqGExCLsXVnQBjPpYB4TO9pub4SPwT/wQUFrPcH4o= 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:10 +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:10 +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 06/13] xfs: align args->minlen for forced allocation alignment Date: Fri, 21 Jun 2024 10:05:33 +0000 Message-Id: <20240621100540.2976618-7-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: BL1P222CA0013.NAMP222.PROD.OUTLOOK.COM (2603:10b6:208:2c7::18) 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_|CH3PR10MB6884:EE_ X-MS-Office365-Filtering-Correlation-Id: 8db0a61a-0aa8-4e71-58cb-08dc91d9c68a 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: U4ks1T8w57CvxhBEbL0KRPQr8Bu4I/WQ0KtBLxkHb37acflfZevZ3Lk2xK8rAro7Q1ZHV9pBlwaJwa2BaLabaUyyR5MIBt4fD81L7wjVdmvv7sBaMB7ADztkdVPWKKigpsKnip3LT5AlJJ7yBbLKL3NBKxBcFh7poCE2K/WEI9kM1FBtyjQs7XOP5J5dQlP2qOwjql0OXEFCh7fPn0W5npK9YksGdyQ41qEWcZse3Qv3v5v3dlPW56wcAbpGy4D71jGpUJOWgm0wvmdjpaAU0bmuelY1ThCtqeNwtmBtZ8cZM2Fh3AYPl0jE5WazfCPKhJXTmHTbUV+Qzim4m4BZ4BhyC+ap7ED1YWWWKLn4qKXDHAuXXoGBk8xzj/4Hygs+qC2eAOekyu/hiwy2ZVj5g5OGvxgOJ18eNTb5wLQkCd+BkokLrefgpubWJK3aYMpINBcXUHwUYqU7YqTKqSwml9y3wB+ro8JBkSvHL4VKQ1DAozPWKJovROQVUeyQhBvp214DnIrXuwdAz7UpW6ja7F9BKRuxq1Et6M5BMv7dP1/0uEknzs0j9emGwIBvWDwQoCzH32H0zU7fbktUPA6FF97V8u8sv2ueabDYYcXCPDg7xH+Gjg3dTCv2LFkW8jRgWfjT+IxY5So/MraaQJ/5XkVDtX6e6g/lsOJr9LiiuD+7u30Lxzz8THnFr6TZfNkRKRJDZvNMQQYZF1vMfbsb2QFLtJbWvTc2XM7HzxvG5fye5EDLOrjO1hlv/BfKdkmpSoKPAHdMPnHSBijp2jGBwKJgy5vnRIgIPGyc/EbRU1cqguUUoQ0db5MV82DxQcwm1wk5dWQFCxkrO9d4PZQa+N916qmx+WUh+5FjcX5WwU+rSZ/bMBN6bXfX1gxaGjFXhz8Eydv9KMTtxJ+NnbY67wGaCxslCIWwo/hBYQEFf6h8lpeEnYcJdjnzmyfLvEpFnwDJ1IlyMTSTZt0pvJq64/H/hqjSLWL8yujKpN7cb8tNHL5oYNSzfEF84jzW3GFruiN+diUcJSJZKBYcO7xwgU/LR88gZCn3ObncN+40Y3KlPQjOfbn7i0aNlzaeCOtmjcHfrEDHblnMsoW95cg9Ja0eQCsUivR129LdYpw4TJo7UOxlSWRbx9WhoZHeohPBEftswA7AyR00rFrV3V8A+8vfQmO2VNScYnyJTeBuXbu+Rnr4PaadNANvK8SWCC5yD+lWv9LvB37E/1Qp9nE6MrgEPAOS8Islr5CDU/CtZe7L9cYU3jyfR1n9+89CZ0mOkbrwABfES+Pp86bCIOj/C//xL9Tx9af8T2qDX/sDlWrJFJJeBNm1CmeGrVoV1Nhh 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:(13230037)(1800799021)(376011)(366013);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: CaMyFezTdmYjm1aq+E1/efw7GkNk6ND2ZQgEJfoYAbOOkkkpK/MMCHUGmz9qZM/y2w3G1NkUopC4Md1QPnqEIgHqOeoa+tVngjH/y0vdnirKpnpFvDA4+2CjUiuH22a6W8rvg8HwhZY2HBDn/AUKIWJmWFJ0+UfTRblhKjRRt8Wi0a78AFttvaXiSCoVC76uuCUYOOPaR+f2ZuDsjNFBer6aFx6yXDeSuNNEaZhGF+MU960fuG361CNGpGXzKMPZvLA3/PVCZn189GyZ9Sapp+05hfX0kCHLWe0Q/W1HGq+qPpdjNhHeoKUc+7PVCgdd4PZ1hhdVtMrQG5GUGahgB5LY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TvwHDDzSLBkRb8u3pUjeCZLyJ8N34MhHCWYJeHEfJ/zwV30jjftiz6f7Ug0tPZ7FXz3ESILnVkEEH85P1j3t7ENaR4NvPq4m7XrQW8p2LhKlOEjJd0DHUD1Lkpvd1ZhoFMKsp/H5K/Aundj8t3VI44q8c12VY+FEsX9lRjjldsNFTG9sDG2sqoqXMW21k3EKq9xxaygzfOCgBtIgy4OqHo2A== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: cfaDrJ56/CEZ85Ff5Em2lD8sFasIALuxlqCF3Vk9tYFx/C3z6P2JZHVNa/CUZiRw78jd2PbzI+fibOKCMkRDJd3BoKI1eoxGk4KpP+wAPnjdmRpYBNEvXqbw4EyRBvzfVNHIfFQQ56eHsWrgXK0G6ttaacevc0VMZrlPfWtEK3f4K4/3FyQoKX5hbvTdm+th5TdeyPngLAGmweg/nvA1FrbHkxkwyfa3KfyBW8oOp2dDmnQmd2fGf0wEDrLt9Dc/qhL8/vxjPQwFZF02S9rlwACLTWGhlwAH3GbyPBQmREuhGK2ELfrW0MBiiVLMwrywkquIt5vLp8lnARLfQ82jAD7mJ9uwRojBpQmJKBb3CuQttR+VkgUgHlJf2gjflOtmETjd+Efc0cTv7wYarCI6ppLDvHYg+NpXu7pSjNTgDG/mQ5t6zDk88r+d+sNIF8jt/275ckGGOTi0wrhnFDzKneGJfJlxmcwqIH4bguIT36e6mFnLFY0jmtL7YuGt/rMqCiatW+a/LwKwoj/QOsPf5nxA0gi9CS81oalkROdAvHgMtQ0Mupq6j2JWIYkfcAXkfNSYufJzgFpiwUxmnnl7SzzB1MRoAGiSGYjN6veEh9U= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8db0a61a-0aa8-4e71-58cb-08dc91d9c68a 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:10.5797 (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: Q2TzNSDxRo2gvYKPPLNmiI3LmXvEMB/gLVoYkEre5S5LmkkeAv4COZGkTZ4dbbE67P61nF33JMqEPjIzpJEPZw== 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 bulkscore=0 mlxlogscore=999 suspectscore=0 spamscore=0 phishscore=0 adultscore=0 mlxscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2406180000 definitions=main-2406210074 X-Proofpoint-ORIG-GUID: 1QeJ4xZC0HVkIbzcYhWFRSuFdp4MVcCE X-Proofpoint-GUID: 1QeJ4xZC0HVkIbzcYhWFRSuFdp4MVcCE From: Dave Chinner If args->minlen is not aligned to the constraints of forced alignment, we may do minlen allocations that are not aligned when we approach ENOSPC. Avoid this by always aligning args->minlen appropriately. If alignment of minlen results in a value smaller than the alignment constraint, fail the allocation immediately. Signed-off-by: Dave Chinner Signed-off-by: John Garry Reviewed-by: Darrick J. Wong --- fs/xfs/libxfs/xfs_bmap.c | 45 +++++++++++++++++++++++++++------------- 1 file changed, 31 insertions(+), 14 deletions(-) diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c index 9131ba8113a6..c9cf138e13c4 100644 --- a/fs/xfs/libxfs/xfs_bmap.c +++ b/fs/xfs/libxfs/xfs_bmap.c @@ -3278,33 +3278,48 @@ xfs_bmap_longest_free_extent( return 0; } -static xfs_extlen_t +static int xfs_bmap_select_minlen( struct xfs_bmalloca *ap, struct xfs_alloc_arg *args, xfs_extlen_t blen) { - /* Adjust best length for extent start alignment. */ if (blen > args->alignment) blen -= args->alignment; /* * Since we used XFS_ALLOC_FLAG_TRYLOCK in _longest_free_extent(), it is - * possible that there is enough contiguous free space for this request. + * possible that there is enough contiguous free space for this request + * even if best length is less that the minimum length we need. + * + * If the best length won't satisfy the maximum length we requested, + * then use it as the minimum length so we get as large an allocation + * as possible. */ if (blen < ap->minlen) - return ap->minlen; + blen = ap->minlen; + else if (blen > args->maxlen) + blen = args->maxlen; /* - * If the best seen length is less than the request length, - * use the best as the minimum, otherwise we've got the maxlen we - * were asked for. + * If we have alignment constraints, round the minlen down to match the + * constraint so that alignment will be attempted. This may reduce the + * allocation to smaller than was requested, so clamp the minimum to + * ap->minlen to allow unaligned allocation to succeed. If we are forced + * to align the allocation, return ENOSPC at this point because we don't + * have enough contiguous free space to guarantee aligned allocation. */ - if (blen < args->maxlen) - return blen; - return args->maxlen; - + if (args->alignment > 1) { + blen = rounddown(blen, args->alignment); + if (blen < ap->minlen) { + if (args->datatype & XFS_ALLOC_FORCEALIGN) + return -ENOSPC; + blen = ap->minlen; + } + } + args->minlen = blen; + return 0; } static int @@ -3340,8 +3355,7 @@ xfs_bmap_btalloc_select_lengths( if (pag) xfs_perag_rele(pag); - args->minlen = xfs_bmap_select_minlen(ap, args, blen); - return error; + return xfs_bmap_select_minlen(ap, args, blen); } /* Update all inode and quota accounting for the allocation we just did. */ @@ -3661,7 +3675,10 @@ xfs_bmap_btalloc_filestreams( goto out_low_space; } - args->minlen = xfs_bmap_select_minlen(ap, args, blen); + error = xfs_bmap_select_minlen(ap, args, blen); + if (error) + goto out_low_space; + if (ap->aeof && ap->offset) error = xfs_bmap_btalloc_at_eof(ap, args); From patchwork Fri Jun 21 10:05:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 13707205 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 3820917106D; Fri, 21 Jun 2024 10:07:21 +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=1718964444; cv=fail; b=Y9edq4K+1MJcEEjEGEJSlt2bCCU2mEGUT3pqf3+2BokF+zWX+sRczd4LpcDTWz/KCT1QBMJHMe/SrKzgZXdaXwkfoMFwhj+Gt3kCdtqV/BqXQXZ7vXFB/lT+qIvKnt/wH2hJ7RH6zJhgm67sM0D3Dv60cUOhzg3wz4NvzEXjVz0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718964444; c=relaxed/simple; bh=GG1e5Fl+BNTKRdViUSAYYz/c0SVz9zdybzXKdAiBcEQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=gmEsfVtspUSKBH1VXFnC8fhD/7o0CgzBSWDbfoDKvhxJCIcpkbDe2aVr5UQrlgVz12sZAhv7JaOQKmpEOEX2VB1btRXLDISsnsc87Y8wKO4ngyx0a/t6qPQoF9A0mlRgMVPDKQQNZ4bU8TjAuFwF+t3VcYeJy5wpEqJjyf0Nfjs= 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=GZV/J0xJ; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=QQmVjub9; 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="GZV/J0xJ"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="QQmVjub9" 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 45L7fP3P018883; Fri, 21 Jun 2024 10:06:14 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=k7sYp+nF8Sim2/j9sZS6qHhfQVk5MUQg4WmJHATUNW8=; b= GZV/J0xJBjIsoQUGOnP3v6aWJoTY+j6vThHKhuC+kECjfy7BcYjt1Awc26Bn/Kkq /SRAPthNy/vGlKPvbC4FFK7ZlRp1MROv5YCbP7DVHfLFyV7aQMkDxV5tt3mM1tiU VNHdgfdME3spXr+jJ2kpCtFMyAknI1y9TC6kS41HETs+KOCij/4BE0L3a14+gfcx 8Dk0MCA3uJiKVcqie91c3k+v13VC75pWFHazy2qmfC8aVFKkRFoG0K3XkRasoksR GA9Wz/+tvQenuamisyAxAhoVpYXn9kGcsyN28cIRGj25/JkhDWCrEeJuVPWzmiWG 2LNSyevnFX7wABT4gWhLqw== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3yvrkfseem-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jun 2024 10:06:14 +0000 (GMT) Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 45L8MZmk012854; Fri, 21 Jun 2024 10:06:13 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2100.outbound.protection.outlook.com [104.47.58.100]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3yvrn4er7h-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jun 2024 10:06:13 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oW6R9I2WX6CZv0KPfowVAWX/8srPslDFuiUzXkx2A3vyPctLhu5JzUew4JjdmDXf7Qvh2VRUjSZJ+l7E1BxT1tf+uCJOnjRQwYo/8Tp2LIgufDs6ChO/4X2Hf/N19DnuIoZQWimX5/o2366Lw1JdSLDbCi5T2HXRBttcBoS41NlHZEuvZA60BK+qf0VQxRuurrOGnrrKXD/iqLfxxb7P7y/yiZP/QD6S8tgfx+u2Sh+zEGfdrbjOwZx5FaIA3mx2VMDXZso1MqHfXFf/GaP1GbxhuBfp1YNkw1l0tiayMfanWOGlB70/2aG/47U1MX2KR5ZNx+bUOGZ1RfPc5gNApg== 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=k7sYp+nF8Sim2/j9sZS6qHhfQVk5MUQg4WmJHATUNW8=; b=QKQ8MFVDDSsjYUYZM9UT6xRSzW7EgAqgGcH5gnECF64St6gN5zeEhobEqqjBkWx/na66/zFGFUPyiDuOG3fuMJDcnivHJR4FjWyra8zNEDqfDYDI7X5DIsC3zkGdgjqh7F/vEwcf11bUa7D1TWvN+otqhvfQ54WYD0xaK9ljrlNX6GX9oGE9XVHUN2oNFjws/ReV09WlasgUVHK03TIbz09XLotMEzaaJylK5brTw0ayCSJM5u+4ZraAmuxZ9ccwv7SYVo5eJ+34RP0HntCcvAuk0MSIvHd67lBjlQiCyo1Wg3WAdwtfAjIHMrWVYlEL4NdK91cs2Ua9KkV4hoGgzg== 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=k7sYp+nF8Sim2/j9sZS6qHhfQVk5MUQg4WmJHATUNW8=; b=QQmVjub9C+AGoQq7ZiR3UE3d6q6gNCkIz8Pbs+oH7IXoh0XrPbfGNJOrD02PvioI1NaXLdb1A2jUMgwJopOpzh0s/yBJYCbbBzuwvOAyw2+ztYMgenDADBiDLPufEbe59VYU69KG2Ua+FZUHQlGaWOIR70p+a9sA38eZysvtlaM= 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:11 +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:11 +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 07/13] xfs: Introduce FORCEALIGN inode flag Date: Fri, 21 Jun 2024 10:05:34 +0000 Message-Id: <20240621100540.2976618-8-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: BL1P222CA0013.NAMP222.PROD.OUTLOOK.COM (2603:10b6:208:2c7::18) 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_|CH3PR10MB6884:EE_ X-MS-Office365-Filtering-Correlation-Id: 1a796d16-2c4c-41a1-9571-08dc91d9c715 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: nwI6OZPHHZckR4KMGcbalKZBqh74MKHJ1682kXkTZD9Lj0g5qFU945gfC4/LSQ7rVw/O4jQOzehdy16dK6NaKGm7+XqHbOpLhaMIEflafvvT1SwtylJdeo7UDrHNuFF/nTYP4SSOc2O970Tq2PAEVKnl6qs/nyjL9BMCbZyGk0bkVS2DJogs3wHftOnzVpF/v9+B+igI9x0nUroLvjAkw1hT31Nwjhtio4fGVprrantkKnmvNkc28xlv3Jo1oBo2tUzC5aqd7tOUfbUlMky4t+0+LfKj8M2rtnzcVdv+e3rL1hwopgxyrnCuI0mQn1rnrzy3HKucNP0TlIRAE8S214oUBfEzL2CyiDb1dUxQmopEh9VSmX8fhUUEaQynQpARZV0TAIg8Rsb766wJdx+UxtvIUSAOd9yn1kKu0n18F/rdUMZh+PiwRlT2JhLfHqB2bpMSzsfS5YHAy4SyVKFx+T3POPzbl/KQ+LFi9uRFzW8yNr1pIF4YN4FvjmZ2i0jMKmkexdEGef9h4Brv+a7EHF4wiqrYCTPjOO6Acj0o3S7AB1PM3DocXsfoD4X65uMexWBK0XXu290sb1CtkuAFUv1yLozmSJqq5YCcoumMjkpGrTY2/aqXAkONfpevf1YWDyQdYyaB421krViNbsw4A0CH9Zj0bo8EANAnWr/Fhrq8BTOS5oo+PsgRoD1io7rnDVsThJOwxXm/hS/hwhHUeRCCKeHX9VGwzVLxXSbnjVJUbJmd+iO8EFzNecDgGPFfHKvNvAb1Hm0mOD+t7UnM+bqIDIwEpG8fM19HyHGIpUoJqeLmfyHjDlT3BBSVtBejoCTeaA7yCVVWf+salFE6j5X7v13dSFvv6uD9fD4P+y60FQMylVjIuD0TGc8y/2pq+A7AEW3Ekx7EvDwj1rf9dRpAALlf6QqEJRqRHuyIUgnY7t1mFHwnp4K2p18+or37nFlzgKg3bknKVK5B96vf/kD/K6OVjiDqFu0Exw3whDGZvuYEHfGMtAh41g9TWqwgm/p0m0qLtXMA9OL2EpdLcxH37yvDMjO3MGsKpRboTrLVGJQxC3NSWUjUb2SBvKIoPux5le0tn0LAdUDzUSox9k3kmmCj1kP5/OUJoJU40E9vxEzwAEASzxAgVVhcmoXM5MtT7KEEZg9byAdneNjr4Q+yWo6K7nZvRP67iYcCKYQyziTEPPZnCTQyaEc+RDqBASPxmpPswIAUBmD+qfMNSiKsnarthte8J6hwGCoRW3ReFYKLRT2n8AwOwcsm6EUdGqI5TSSVXJP0JDHChp0NOUONoIAnQgyYC4pDJqYi31NR+hN0FlhQfjTZo8hfPwIc 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:(13230037)(1800799021)(376011)(366013);DIR:OUT;SFP:1101; X-MS-Ex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F2lsLb+6i9cF0INRlyj5Q+ZpfKyikY1A4q/ow062GY4NMHrMwE2msqFLFUtkeDUEj8rLFDaGBL0CTk97n0Ug4hsGVNDOHOB9iFeoRbCzyB6u8dkim8UhDBivKElckWhtL2UzcaWpA7xUwYG1C+j2sfxmvqFsCgvhsI3Ey9WJxca85a86wfnOnovGfyDdwy6Yt2Ni7w0SXrf/Veol07b5xcNQ= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1a796d16-2c4c-41a1-9571-08dc91d9c715 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:11.4667 (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: s1qvnKxis43ile8apkdwP9WZEdxId0MTrk4ObPM5yVhDtZrZHC2YszrnkI1MuTZk2WgvHP4GfTuqlfvCts2ZOQ== 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 bulkscore=0 mlxlogscore=999 suspectscore=0 spamscore=0 phishscore=0 adultscore=0 mlxscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2406180000 definitions=main-2406210074 X-Proofpoint-GUID: j0xuMG7hRhqlRBoCn_Dkj3WzokcLeVKu X-Proofpoint-ORIG-GUID: j0xuMG7hRhqlRBoCn_Dkj3WzokcLeVKu From: "Darrick J. Wong" Add a new inode flag to require that all file data extent mappings must be aligned (both the file offset range and the allocated space itself) to the extent size hint. Having a separate COW extent size hint is no longer allowed. The goal here is to enable sysadmins and users to mandate that all space mappings in a file must have a startoff/blockcount that are aligned to (say) a 2MB alignment and that the startblock/blockcount will follow the same alignment. Signed-off-by: "Darrick J. Wong" Co-developed-by: John Garry Signed-off-by: John Garry --- fs/xfs/libxfs/xfs_format.h | 6 +++- fs/xfs/libxfs/xfs_inode_buf.c | 53 +++++++++++++++++++++++++++++++++++ fs/xfs/libxfs/xfs_inode_buf.h | 3 ++ fs/xfs/libxfs/xfs_sb.c | 2 ++ fs/xfs/xfs_inode.c | 13 +++++++++ fs/xfs/xfs_inode.h | 20 ++++++++++++- fs/xfs/xfs_ioctl.c | 47 +++++++++++++++++++++++++++++-- fs/xfs/xfs_mount.h | 2 ++ fs/xfs/xfs_reflink.h | 10 ------- fs/xfs/xfs_super.c | 4 +++ include/uapi/linux/fs.h | 2 ++ 11 files changed, 148 insertions(+), 14 deletions(-) diff --git a/fs/xfs/libxfs/xfs_format.h b/fs/xfs/libxfs/xfs_format.h index 61f51becff4f..b48cd75d34a6 100644 --- a/fs/xfs/libxfs/xfs_format.h +++ b/fs/xfs/libxfs/xfs_format.h @@ -353,6 +353,7 @@ xfs_sb_has_compat_feature( #define XFS_SB_FEAT_RO_COMPAT_RMAPBT (1 << 1) /* reverse map btree */ #define XFS_SB_FEAT_RO_COMPAT_REFLINK (1 << 2) /* reflinked files */ #define XFS_SB_FEAT_RO_COMPAT_INOBTCNT (1 << 3) /* inobt block counts */ +#define XFS_SB_FEAT_RO_COMPAT_FORCEALIGN (1 << 30) /* aligned file data extents */ #define XFS_SB_FEAT_RO_COMPAT_ALL \ (XFS_SB_FEAT_RO_COMPAT_FINOBT | \ XFS_SB_FEAT_RO_COMPAT_RMAPBT | \ @@ -1094,16 +1095,19 @@ static inline void xfs_dinode_put_rdev(struct xfs_dinode *dip, xfs_dev_t rdev) #define XFS_DIFLAG2_COWEXTSIZE_BIT 2 /* copy on write extent size hint */ #define XFS_DIFLAG2_BIGTIME_BIT 3 /* big timestamps */ #define XFS_DIFLAG2_NREXT64_BIT 4 /* large extent counters */ +/* data extent mappings for regular files must be aligned to extent size hint */ +#define XFS_DIFLAG2_FORCEALIGN_BIT 5 #define XFS_DIFLAG2_DAX (1 << XFS_DIFLAG2_DAX_BIT) #define XFS_DIFLAG2_REFLINK (1 << XFS_DIFLAG2_REFLINK_BIT) #define XFS_DIFLAG2_COWEXTSIZE (1 << XFS_DIFLAG2_COWEXTSIZE_BIT) #define XFS_DIFLAG2_BIGTIME (1 << XFS_DIFLAG2_BIGTIME_BIT) #define XFS_DIFLAG2_NREXT64 (1 << XFS_DIFLAG2_NREXT64_BIT) +#define XFS_DIFLAG2_FORCEALIGN (1 << XFS_DIFLAG2_FORCEALIGN_BIT) #define XFS_DIFLAG2_ANY \ (XFS_DIFLAG2_DAX | XFS_DIFLAG2_REFLINK | XFS_DIFLAG2_COWEXTSIZE | \ - XFS_DIFLAG2_BIGTIME | XFS_DIFLAG2_NREXT64) + XFS_DIFLAG2_BIGTIME | XFS_DIFLAG2_NREXT64 | XFS_DIFLAG2_FORCEALIGN) static inline bool xfs_dinode_has_bigtime(const struct xfs_dinode *dip) { diff --git a/fs/xfs/libxfs/xfs_inode_buf.c b/fs/xfs/libxfs/xfs_inode_buf.c index e7a7bfbe75b4..b2c5f466c1a9 100644 --- a/fs/xfs/libxfs/xfs_inode_buf.c +++ b/fs/xfs/libxfs/xfs_inode_buf.c @@ -644,6 +644,15 @@ xfs_dinode_verify( !xfs_has_bigtime(mp)) return __this_address; + if (flags2 & XFS_DIFLAG2_FORCEALIGN) { + fa = xfs_inode_validate_forcealign(mp, + be32_to_cpu(dip->di_extsize), + be32_to_cpu(dip->di_cowextsize), + mode, flags, flags2); + if (fa) + return fa; + } + return NULL; } @@ -811,3 +820,47 @@ xfs_inode_validate_cowextsize( return NULL; } + +/* Validate the forcealign inode flag */ +xfs_failaddr_t +xfs_inode_validate_forcealign( + struct xfs_mount *mp, + uint32_t extsize, + uint32_t cowextsize, + uint16_t mode, + uint16_t flags, + uint64_t flags2) +{ + /* superblock rocompat feature flag */ + if (!xfs_has_forcealign(mp)) + return __this_address; + + /* Only regular files and directories */ + if (!S_ISDIR(mode) && !S_ISREG(mode)) + return __this_address; + + /* We require EXTSIZE or EXTSZINHERIT */ + if (!(flags & (XFS_DIFLAG_EXTSIZE | XFS_DIFLAG_EXTSZINHERIT))) + return __this_address; + + /* We require a non-zero extsize */ + if (!extsize) + return __this_address; + + /* Reflink'ed disallowed */ + if (flags2 & XFS_DIFLAG2_REFLINK) + return __this_address; + + /* COW extsize disallowed */ + if (flags2 & XFS_DIFLAG2_COWEXTSIZE) + return __this_address; + + if (cowextsize) + return __this_address; + + /* A RT device with sb_rextsize=1 could make use of forcealign */ + if (flags & XFS_DIFLAG_REALTIME && mp->m_sb.sb_rextsize != 1) + return __this_address; + + return NULL; +} diff --git a/fs/xfs/libxfs/xfs_inode_buf.h b/fs/xfs/libxfs/xfs_inode_buf.h index 585ed5a110af..b8b65287b037 100644 --- a/fs/xfs/libxfs/xfs_inode_buf.h +++ b/fs/xfs/libxfs/xfs_inode_buf.h @@ -33,6 +33,9 @@ xfs_failaddr_t xfs_inode_validate_extsize(struct xfs_mount *mp, xfs_failaddr_t xfs_inode_validate_cowextsize(struct xfs_mount *mp, uint32_t cowextsize, uint16_t mode, uint16_t flags, uint64_t flags2); +xfs_failaddr_t xfs_inode_validate_forcealign(struct xfs_mount *mp, + uint32_t extsize, uint32_t cowextsize, uint16_t mode, + uint16_t flags, uint64_t flags2); static inline uint64_t xfs_inode_encode_bigtime(struct timespec64 tv) { diff --git a/fs/xfs/libxfs/xfs_sb.c b/fs/xfs/libxfs/xfs_sb.c index 6b56f0f6d4c1..e56911553edd 100644 --- a/fs/xfs/libxfs/xfs_sb.c +++ b/fs/xfs/libxfs/xfs_sb.c @@ -164,6 +164,8 @@ xfs_sb_version_to_features( features |= XFS_FEAT_REFLINK; if (sbp->sb_features_ro_compat & XFS_SB_FEAT_RO_COMPAT_INOBTCNT) features |= XFS_FEAT_INOBTCNT; + if (sbp->sb_features_ro_compat & XFS_SB_FEAT_RO_COMPAT_FORCEALIGN) + features |= XFS_FEAT_FORCEALIGN; if (sbp->sb_features_incompat & XFS_SB_FEAT_INCOMPAT_FTYPE) features |= XFS_FEAT_FTYPE; if (sbp->sb_features_incompat & XFS_SB_FEAT_INCOMPAT_SPINODES) diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index f36091e1e7f5..994fb7e184d9 100644 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c @@ -608,6 +608,8 @@ xfs_ip2xflags( flags |= FS_XFLAG_DAX; if (ip->i_diflags2 & XFS_DIFLAG2_COWEXTSIZE) flags |= FS_XFLAG_COWEXTSIZE; + if (ip->i_diflags2 & XFS_DIFLAG2_FORCEALIGN) + flags |= FS_XFLAG_FORCEALIGN; } if (xfs_inode_has_attr_fork(ip)) @@ -737,6 +739,8 @@ xfs_inode_inherit_flags2( } if (pip->i_diflags2 & XFS_DIFLAG2_DAX) ip->i_diflags2 |= XFS_DIFLAG2_DAX; + if (pip->i_diflags2 & XFS_DIFLAG2_FORCEALIGN) + ip->i_diflags2 |= XFS_DIFLAG2_FORCEALIGN; /* Don't let invalid cowextsize hints propagate. */ failaddr = xfs_inode_validate_cowextsize(ip->i_mount, ip->i_cowextsize, @@ -745,6 +749,15 @@ xfs_inode_inherit_flags2( ip->i_diflags2 &= ~XFS_DIFLAG2_COWEXTSIZE; ip->i_cowextsize = 0; } + + if (ip->i_diflags2 & XFS_DIFLAG2_FORCEALIGN) { + failaddr = xfs_inode_validate_forcealign(ip->i_mount, + ip->i_extsize, ip->i_cowextsize, + VFS_I(ip)->i_mode, ip->i_diflags, + ip->i_diflags2); + if (failaddr) + ip->i_diflags2 &= ~XFS_DIFLAG2_FORCEALIGN; + } } /* diff --git a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h index 42f999c1106c..536e646dd055 100644 --- a/fs/xfs/xfs_inode.h +++ b/fs/xfs/xfs_inode.h @@ -301,6 +301,16 @@ static inline bool xfs_inode_has_cow_data(struct xfs_inode *ip) return ip->i_cowfp && ip->i_cowfp->if_bytes; } +static inline bool xfs_is_always_cow_inode(struct xfs_inode *ip) +{ + return ip->i_mount->m_always_cow && xfs_has_reflink(ip->i_mount); +} + +static inline bool xfs_is_cow_inode(struct xfs_inode *ip) +{ + return xfs_is_reflink_inode(ip) || xfs_is_always_cow_inode(ip); +} + static inline bool xfs_inode_has_bigtime(struct xfs_inode *ip) { return ip->i_diflags2 & XFS_DIFLAG2_BIGTIME; @@ -313,7 +323,15 @@ static inline bool xfs_inode_has_large_extent_counts(struct xfs_inode *ip) static inline bool xfs_inode_has_forcealign(struct xfs_inode *ip) { - return false; + if (!(ip->i_diflags & XFS_DIFLAG_EXTSIZE)) + return false; + if (ip->i_extsize <= 1) + return false; + if (xfs_is_cow_inode(ip)) + return false; + if (ip->i_diflags & XFS_DIFLAG_REALTIME) + return false; + return ip->i_diflags2 & XFS_DIFLAG2_FORCEALIGN; } /* diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c index f0117188f302..5eff8fd9fa3e 100644 --- a/fs/xfs/xfs_ioctl.c +++ b/fs/xfs/xfs_ioctl.c @@ -525,10 +525,48 @@ xfs_flags2diflags2( di_flags2 |= XFS_DIFLAG2_DAX; if (xflags & FS_XFLAG_COWEXTSIZE) di_flags2 |= XFS_DIFLAG2_COWEXTSIZE; + if (xflags & FS_XFLAG_FORCEALIGN) + di_flags2 |= XFS_DIFLAG2_FORCEALIGN; return di_flags2; } +/* + * Forcealign requires a non-zero extent size hint and a zero cow + * extent size hint. Don't allow set for RT files yet. + */ +static int +xfs_ioctl_setattr_forcealign( + struct xfs_inode *ip, + struct fileattr *fa) +{ + struct xfs_mount *mp = ip->i_mount; + + if (!xfs_has_forcealign(mp)) + return -EINVAL; + + if (xfs_is_reflink_inode(ip)) + return -EINVAL; + + if (!(fa->fsx_xflags & (FS_XFLAG_EXTSIZE | + FS_XFLAG_EXTSZINHERIT))) + return -EINVAL; + + if (fa->fsx_xflags & FS_XFLAG_COWEXTSIZE) + return -EINVAL; + + if (!fa->fsx_extsize) + return -EINVAL; + + if (fa->fsx_cowextsize) + return -EINVAL; + + if (fa->fsx_xflags & FS_XFLAG_REALTIME) + return -EINVAL; + + return 0; +} + static int xfs_ioctl_setattr_xflags( struct xfs_trans *tp, @@ -537,10 +575,12 @@ xfs_ioctl_setattr_xflags( { struct xfs_mount *mp = ip->i_mount; bool rtflag = (fa->fsx_xflags & FS_XFLAG_REALTIME); + bool forcealign = fa->fsx_xflags & FS_XFLAG_FORCEALIGN; uint64_t i_flags2; - if (rtflag != XFS_IS_REALTIME_INODE(ip)) { - /* Can't change realtime flag if any extents are allocated. */ + /* Can't change RT or forcealign flags if any extents are allocated. */ + if (rtflag != XFS_IS_REALTIME_INODE(ip) || + forcealign != xfs_inode_has_forcealign(ip)) { if (ip->i_df.if_nextents || ip->i_delayed_blks) return -EINVAL; } @@ -561,6 +601,9 @@ xfs_ioctl_setattr_xflags( if (i_flags2 && !xfs_has_v3inodes(mp)) return -EINVAL; + if (forcealign && (xfs_ioctl_setattr_forcealign(ip, fa) < 0)) + return -EINVAL; + ip->i_diflags = xfs_flags2diflags(ip, fa->fsx_xflags); ip->i_diflags2 = i_flags2; diff --git a/fs/xfs/xfs_mount.h b/fs/xfs/xfs_mount.h index d0567dfbc036..30228fea908d 100644 --- a/fs/xfs/xfs_mount.h +++ b/fs/xfs/xfs_mount.h @@ -299,6 +299,7 @@ typedef struct xfs_mount { #define XFS_FEAT_NEEDSREPAIR (1ULL << 25) /* needs xfs_repair */ #define XFS_FEAT_NREXT64 (1ULL << 26) /* large extent counters */ #define XFS_FEAT_EXCHANGE_RANGE (1ULL << 27) /* exchange range */ +#define XFS_FEAT_FORCEALIGN (1ULL << 28) /* aligned file data extents */ /* Mount features */ #define XFS_FEAT_NOATTR2 (1ULL << 48) /* disable attr2 creation */ @@ -385,6 +386,7 @@ __XFS_ADD_V4_FEAT(projid32, PROJID32) __XFS_HAS_V4_FEAT(v3inodes, V3INODES) __XFS_HAS_V4_FEAT(crc, CRC) __XFS_HAS_V4_FEAT(pquotino, PQUOTINO) +__XFS_HAS_FEAT(forcealign, FORCEALIGN) /* * Mount features diff --git a/fs/xfs/xfs_reflink.h b/fs/xfs/xfs_reflink.h index 65c5dfe17ecf..fb55e4ce49fa 100644 --- a/fs/xfs/xfs_reflink.h +++ b/fs/xfs/xfs_reflink.h @@ -6,16 +6,6 @@ #ifndef __XFS_REFLINK_H #define __XFS_REFLINK_H 1 -static inline bool xfs_is_always_cow_inode(struct xfs_inode *ip) -{ - return ip->i_mount->m_always_cow && xfs_has_reflink(ip->i_mount); -} - -static inline bool xfs_is_cow_inode(struct xfs_inode *ip) -{ - return xfs_is_reflink_inode(ip) || xfs_is_always_cow_inode(ip); -} - extern int xfs_reflink_trim_around_shared(struct xfs_inode *ip, struct xfs_bmbt_irec *irec, bool *shared); int xfs_bmap_trim_cow(struct xfs_inode *ip, struct xfs_bmbt_irec *imap, diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c index 27e9f749c4c7..852bbfb21506 100644 --- a/fs/xfs/xfs_super.c +++ b/fs/xfs/xfs_super.c @@ -1721,6 +1721,10 @@ xfs_fs_fill_super( mp->m_features &= ~XFS_FEAT_DISCARD; } + if (xfs_has_forcealign(mp)) + xfs_warn(mp, +"EXPERIMENTAL forced data extent alignment feature in use. Use at your own risk!"); + if (xfs_has_reflink(mp)) { if (mp->m_sb.sb_rblocks) { xfs_alert(mp, diff --git a/include/uapi/linux/fs.h b/include/uapi/linux/fs.h index 45e4e64fd664..8af304c0e29a 100644 --- a/include/uapi/linux/fs.h +++ b/include/uapi/linux/fs.h @@ -158,6 +158,8 @@ struct fsxattr { #define FS_XFLAG_FILESTREAM 0x00004000 /* use filestream allocator */ #define FS_XFLAG_DAX 0x00008000 /* use DAX for IO */ #define FS_XFLAG_COWEXTSIZE 0x00010000 /* CoW extent size allocator hint */ +/* data extent mappings for regular files must be aligned to extent size hint */ +#define FS_XFLAG_FORCEALIGN 0x00020000 #define FS_XFLAG_HASATTR 0x80000000 /* no DIFLAG for this */ /* the read-only stuff doesn't really belong here, but any other place is From patchwork Fri Jun 21 10:05:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 13707192 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 00061172BDA; Fri, 21 Jun 2024 10:06:27 +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=1718964389; cv=fail; b=RQk9Yotao25o34Nx4RvSTbOf5i2Ii9/J8djd2Mmujy/fMvSTVppqktzQD5P65Xdr9Zu0/CmVUO+zwy1fu+dIi+fBys23hIh2/cC63HipMsrLcnK0MDCZBtsA31chWhng0Az/WK5PD1n+iUirhmnmgu3+NNrXwYrzWayW6HQsgFg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718964389; c=relaxed/simple; bh=lI4IakodFeDyKVGgRiu0t/W+URDX20Vh631xFihAl/Q=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=I1PEvKzEqjECkcZACKyANzdFbBUMr2//bl/fLs17QpdD3DHpyXP9sMlcC4upH0yay7ubemCwdn8LNDM9O/c+I0mH5Dc+rpaE6VQUTc+ZORkqnLRBABD0D4r7vFSBVOK70ICRwmAMclMwvAu7mZBYgjpNqARr5pakkqe9PhViu8k= 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=ctkGDptU; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=vHZ1/mKi; arc=fail smtp.client-ip=205.220.165.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="ctkGDptU"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="vHZ1/mKi" Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45L7fV31026946; Fri, 21 Jun 2024 10:06:16 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=iQ3p+Ord99NfXwVLwgo3Vy8ye4VJDJivF4HSz5ncL9g=; b= ctkGDptU2EdyE+jcd17Msu19x+UMgVqbr2QRQjNRjLLHBAwFVRB1e1j4+8W5G8nZ lJoCiRcyqwzUI8q5XIxmI4RIt80h+N6KnTsiSC8vyyr179mr3DlVgOXb4pIYhsKP XO4YA2HkKBbi3YA32XEQ+lqXBsx5CVYLjzHLRgI666tfclpE6SVmWyTJ3iBCTbBA i3z06MDQfuA256Fwi0YZQSXSW47sPENGbyP40O4w/qZ5E7G9GMkuw3GlcfN/Cqis UYkSnHKEqSu6IBzP1f9QrYygHfV5Hq3wGzCklAIzJjKz+H36B9beCBQgU9oktynK 09FrEjyQHcPtR5t2svDRiw== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3yvrkjsfny-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jun 2024 10:06:16 +0000 (GMT) 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 45L8phaS040090; Fri, 21 Jun 2024 10:06:15 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2101.outbound.protection.outlook.com [104.47.58.101]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3yvrn44xv4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jun 2024 10:06:15 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ENqRWeAXcgBl2RWH2bfaFKHShat4r91C6UaKNoOq06KfgsDRgoG0ZxXKhCSth1PxUrt4qL9wzxXZ3IAeRKoAyhuevw7VLMtxtz5NO3N763mfwTJXBafGdSVOgObPWPHzgfTuD+bc97FQm/IIuouuTWEE/5U1EAjZKp55G7KCSywQvXsGCuFSoAS3c0ROb/E+yYGvVHjPPi1RoPmKhb+kI0qHz+kTu+PBB4k7MNyxpBilLUdqKy50NKgjs+1P4mhePMz0T977Ind8e7SQa3uccm+l8UH9shZx7blJ+qfZC3PnpIygWf6l3qYdRR+e7iuJ2QW8r2nuiDnHWV43AKoAUQ== 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=iQ3p+Ord99NfXwVLwgo3Vy8ye4VJDJivF4HSz5ncL9g=; b=kQF9kePFXwJ5e9bA8BqiLbS7IQ2U7hsUUUZKFXDF+VElPvML6WYbdudEyGd8WcRBWVdAYCuBIog3663++uMxWvpnT4xoRwKjyWowO2AmmGvwweJ6B1c+jiEtKdtMqRgngAZ3efQ7MK6JgsgwLjKxdR9pqVx9RU6zL0aRLz8XhdITSH7dTxpHHo5dWdhfAjafU2/Hgu9V+rRnVsWYWdGKHge5mVHMdAnSIL8HBIUmQqpFN/Cejtebly2zRtraVkE3cZ/C6gR7vlp2bdEz2M1/fPC0WwgemCEVuKX2PNCM0GBV7rm4gkbVzEVsS2artkGHoiPjyxLAW6l56cTxC5fPzQ== 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=iQ3p+Ord99NfXwVLwgo3Vy8ye4VJDJivF4HSz5ncL9g=; b=vHZ1/mKiRsbrpSPr5B6dLTeYzyu/1uN+W+uy7eI0/CbqCH2JHDDKLpiL8JFn8z6yILe6ihXFMmNy7TP/nZb6mL1+J3NQcD7eu3n2JiBBcMBerW5jK24ZYN6o7MvfOBqsc1EeQjSdr3LUivJEj/jH9ngqrBpWTk7ktVwwB47UUoo= 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:13 +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:13 +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 08/13] xfs: Do not free EOF blocks for forcealign Date: Fri, 21 Jun 2024 10:05:35 +0000 Message-Id: <20240621100540.2976618-9-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: BL1PR13CA0215.namprd13.prod.outlook.com (2603:10b6:208:2bf::10) 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_|CH3PR10MB6884:EE_ X-MS-Office365-Filtering-Correlation-Id: e13db29f-6e7c-4916-6a2c-08dc91d9c81c 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: Y0ccG/cy/ur0F/RUPQzfj5UmpN/hDMK/dipn1zyYd/MwtLYx4U4dFDL3xJXqIWl6kzjjNB7GwNn86DfF0y9hIZQ4RUZueO0btO633A9uTO1DyKHrqQ5ECPFVo8Icmkweq1lT7g2w0roYFSUeFCkkd2an7AFtiKLnWUKvpduda8QaKjDBrC5/1DUzQVLmUqV/H+6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jm1F8kKiBqClapssrMcab/WmqMaQ4Bl2/fWbooJgM8YHdTHY6eCyDGL+2xDOQeH 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:(13230037)(1800799021)(376011)(366013);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 9jni+e10ApTzNfy4w5d2a/RcUGhHD/hFl4d83T7J0gBYqOORNw8WGY+N4qLbLJzwsIP1kCRhdfsasss9PPqsJwxG/4+t/56p5bmR/dnneSkkWnO9kp5FXyLoEG9jye3AfR4h1PbiSlzRt4Myl/Fih7BT/IHq7Mr/q637U0gcOlpAPsDVTMVv8L6H7J+K7XLEpSnlIeE0rSzu0Byy6LisqG3X7izcoXv8pTVJ2JcByGBE5WuD6oBTVXJQHgK6UOjyF/ncshP81ASAK8stmlHcI3TAZAwwXEsJ0LC5lTuPlgrkj4/0xEIQiykiBPbIxD+aWaHMnxChrvJpk3kO6XvMzTc7akIEp5qIg/oprdDO1vrK+qas3JAfOSHLujVuqGlFL50mHrIn2Wxg32gnoHiS7/B11vpwUwK8gW/1+FXfbllppuyeBvp1uOczRAICls1X35OZ/QoVK8J9BF6TQ+4kCA0l3U1MRo+b+rFPHNf3sGfXFzSIlloxHucfp18KGAbagAKB24fHx/f1/htucw4OUouIRv7WmtkaycNhoBHGaj80ctKkjkWhAHl+VUi/X/I4R1qtn7zGC9SmHG6rFP7YSWqb2NBh3cx4ej8FF1mNsZJNRPzGVCoD4nPf0C95RUZhI34DA+m6Yk3gyYsKApSPFQR1/eNlrRFr9k93/vaeac33JMecuJl6sRqHOksrT6dNcrcTVvdToi354NteK30LRveaG7cyNCQT9QMioaehMcwBrsPc56lM+N3YitQni/jEHhVCHYsboNHE+ReRyQzuJKixV+rMhq6hVtWGshI++i1855bUZK/Mj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VDJjRI5yg/MueANql40jCOFtcF4Dj3QJe/yzh7YlnAtH02NYzO8YfCAxCBl6UlC+ATSL2nhylxm8to+OjEaLlGwJ1fVE8rGoSt5bW19hz0erJYTqUoYpVUpmVo7l3hZghzFcipyl/enlIOtuo0WFqNX6RkmMpFPnBdQ+VwelsD5KjP6Q+QYQPIV/+P7L0YQjrHk95QAIqa7Tj245fHzVMMFIpj3Hp+8/1apTs4FaUy7VavCqEClGlZ6tGaSgbo/bbd0mwhkdriZq+YinSups+NfGGocJYefj/+f4rDVts3siwAz7uAXUNQ2EsUi+aV41zV1E4xd/JSAFRir0Qm9qvrsGPx9V1llW//u8PKaXa7hn8aSpjPMRWeGWsUi8CVRc3VEHFJ7ALbXsmgtGw5F9AG2x0/NU= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: e13db29f-6e7c-4916-6a2c-08dc91d9c81c 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:13.1934 (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: I2ytEjQLQ5O5UdKS1Iqe2mo9pvXvs+zooNfT8B4rLD9egm1zzs+QISYT+aEpzwHcAtS1xMq/U93/SeTeEBKHMw== 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 malwarescore=0 phishscore=0 spamscore=0 mlxlogscore=999 adultscore=0 bulkscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2406180000 definitions=main-2406210074 X-Proofpoint-GUID: KBs_vu-SJIYhruRDsp19HihFH5eSC2Al X-Proofpoint-ORIG-GUID: KBs_vu-SJIYhruRDsp19HihFH5eSC2Al For when forcealign is enabled, we want the EOF to be aligned as well, so do not free EOF blocks. Signed-off-by: John Garry Reviewed-by: Darrick J. Wong --- 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 e5d893f93522..56b80a7c0992 100644 --- a/fs/xfs/xfs_bmap_util.c +++ b/fs/xfs/xfs_bmap_util.c @@ -539,8 +539,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)) + + /* Do not free blocks when forcing extent sizes */ + 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; From patchwork Fri Jun 21 10:05:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 13707191 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 E72FA171088; Fri, 21 Jun 2024 10:06:26 +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=1718964388; cv=fail; b=Wy2WN6AwnJgLQGc7Dgaonooa412doEoQkVRbADzDvX65OUCOR1QvvM42vpoK3WHbAYkAjJiJesewqQ6aBR0zyG+GNx/kMpoq7/SFwvyhKHN71toa/b8V8ltV7VR9OYnoVLivXRdKxpeEa91qv/y4MBHw0VhegTnIAWWK/NcCWDE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718964388; c=relaxed/simple; bh=82sCfoAC9WuDwuln9hyQwoNqg9KDv1En2/tPws82uyE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=UzZUO6JkHoozFtW3lSL3QfmM3kAzC77Chbxqkk5GLoRo7XIrEmS7GauRyMjmk1UIFiw5iEZillovW3hd8Xj6Uk9yU4t3UTv5QJQdojxjfdxiL4VWSI6SOiL3iBmEQ3rdjiABeuu5cFmHfm7LPbNJJTYfWbVd2KdkhoV6I77lAso= 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=mo7hpwXk; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=Q1W4b5ZY; arc=fail smtp.client-ip=205.220.165.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="mo7hpwXk"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="Q1W4b5ZY" Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45L7fUIP032220; Fri, 21 Jun 2024 10:06:18 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=mvli9j185b4V2Z0WWHE92YaBw0w/4HtqhHzK1B/PIDI=; b= mo7hpwXkrhnrGeAJUExOnIHFg4+T+wJ/O8Pby2JoKDLbukDK8la3q72gSvknQbWN RRG7j9rUwQL5W5r/ETOo0XbPMPbqa04gVc2+cYde3WpQQYS86qbe9WokSwpM0Cp7 kr1cPbHLTm8K7+OSX0qCEGeQqGvv5/PjAc8jfe/L+jOiggJoUBtWgDgLoaWpU+0G em5IgnYjhg/B/b6+5jDm+u132iPVmbvIbDU4UqQCDu1x1ZOlAP/1+f01TDCzUwyi sLpdgFazHwNG26K6l2CHaF2Ak2gvUWLN6PmbcCZFtKEa1HEUBXFjAGaWITPifMTk v/p2Qqn1s9DMi8DoFAAXXA== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3yvrkj1fcx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jun 2024 10:06:17 +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 45L95UNX019490; Fri, 21 Jun 2024 10:06:17 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2100.outbound.protection.outlook.com [104.47.58.100]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3yvrn3mxyn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jun 2024 10:06:17 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=i6yoniaeoPcQzhExG6fFGVAA8AurBie0mtFsaCB5XiDnhBIDDN2IbkwTUZ2Aar91Rlyq9i6ndW31ktg53eYtRd+DWdWbMejgJujDipHIkPG6aq/fryPTcN1f4OJAf+t2RAQL5ohNZxopGU1guBbKqYErWPbt4nrZboRBSFkLncg6X/HqCXNLFYBhu99W2hUZhPI4/i6fPRHvKsm/abRCmfZx6XhJg/rZTCJsudBpCPeU+bmrv/IbtAkuh6NqlN8l1C2p+0PzOj3iJeDw8uG70gqN82/CsCAlaHduugvGFml2btvaqN0qOfVIxE6jUJHONsdFxzVTcSanx0L9XJehCg== 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=mvli9j185b4V2Z0WWHE92YaBw0w/4HtqhHzK1B/PIDI=; b=Tte7NQ+R1BRTD+FazYmAioJVcf4Oc/APsZP+C2eUwjzPloaz/Mz6JU5leDb3rJetrMgGbnmLRREYTdXOkF8JomGVsUz3xmtGoDJfGespSAD/diu7OaXk6kWtMvfDijPoILs9fdDlA298d9ONVBVbhmVQj8/zhiy5khzwSALbhayWEyEVJNy13Hl//c9EcHqOmyfdpROktg4Ps3Gj2HpGoA7l/ZOYqcOnWGXZBEhNDGWh5ZQlTfmAIBsTzNp55U6XFPzL0OZa7tgwCeq/qhWgw1+r9mSgZyTXNBPiUX/gotepvd+0ZCqFKRaaBSDPiWGVhS1HE72uxUFhKJaDLmB1BQ== 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=mvli9j185b4V2Z0WWHE92YaBw0w/4HtqhHzK1B/PIDI=; b=Q1W4b5ZY0Eu9vfXmVgqgx+rXx9+UHeZPyNzyfTqexF2Ras5TvXamQJpv44fwuN2Z2ocQf6j0/h6uRYRdtfioH04D8SkFhNbueBtGvKqkAYDGD8ZPe2w6eZcMXjPiNvRRU0sYU/B+wY5XCtMlYfFzdILmvYY3NS10e+NpTmWAnAc= 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:15 +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:15 +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 09/13] xfs: Update xfs_inode_alloc_unitsize_fsb() for forcealign Date: Fri, 21 Jun 2024 10:05:36 +0000 Message-Id: <20240621100540.2976618-10-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: BL0PR01CA0003.prod.exchangelabs.com (2603:10b6:208:71::16) 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_|CH3PR10MB6884:EE_ X-MS-Office365-Filtering-Correlation-Id: 3cc3ce65-a362-404d-36b5-08dc91d9c93a 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: s7zs3pdK8qMzb0GBfcZH5qxh5QHWft6IT5jnlM6ONPHm6Zu4M176ccqXuunWigdUd2li5llC30ieICIrcyYnEdnifTsXtMxPt2UekRmIf0XHRz0hKcol/vfntRhgXe8CHHOUpa5JOdlG/KvlQOhgOYLe4BgH7LUkxlrDK4vDV8eyALJwiCDPm6J5EXWpYn1LyGZWl6nWoKKi+pRHbzFKk2n8LHM+VJWiOuJUYTY33TdfJLhCBg0GFPU9x2HlF6vUGiX/I2W4Ktq4+R8u9Q352aGEJMxv15x0zfZVHJTAlO27LDuvyEq7S8YypYnf+p/iEfNir3Kf2MmGAONG1o1SvsHfK3hRzwudW4+IlHBL1pdMoMC41V/uUVmZ015zxA8c3mqFOHSy8HhgUpGZt0Gxhmrs2OmIMn/zTFVdb4osdlJ1zYC5GMVu/96Z2yQpW9OpWrfgExHzePj8egcMPF+u2eO1J8rQjB863zXMl1acvfIR+9RDWvSxK6rPLN0OctHVcngkIuHEUtE4w3WsR1M+PBErMJnV65ts/mryKVcD8EFyLzG3sMal3knhbL12or/OL40w/aW1hUYvZqydyL71Uay3IhtMp3sJ0mpkOorV/PbHTf/8bDdzmPTwogeBOQQNWKHTdAC3LIWATbBT229rW86cBY0TpL+BuXld8NIm+/UHCDeaxju9enageWtrIVZmYuRf7/iZ2X8mjJtBvpcKakiiGh58rje5nAsMkI3oV1//LvEf3FsyJCBriJJ6flP7IoFacvPDfVX9v0Bg0RO6gPmELMdajxI/TgSGP1PpUyzB0qFNlwXNEfPOQVYEZm+i/Fqz4H5k7XYS/nWjRcx0wu3yavXHoIpq/IXcfxrRRmIcK6ESny8G4WRXtEakUtI2JUiuGOOSioLvvvl2RFnB2JLIGTRQjtu/FpkqIev7ekjrVCWPl6RO6r1l7IxPoXB8a3dIz0EyWCUYRCqypH4OcEyKhpcBii33sPJTtVq00XbGqdYoBLEyJqcEW+lImmQnIP72R3wTuoRhfzfgKRKDl2O61c0IwFSsZXgUriNvz+1qXjgtNmGJAWcQPdBSoTOdXwSW+gkuSWihG5DSlEOkSw8Gv20foygSorbOHWbWE61Nnux9CRcYIB84Jh3mNb4XEj6KaY4ViVVUtJN20UPsA4GGgektrYlj62R8FPgzMIbqLkfmlr4f3oX/tEa2q5E+P6/6S2PIFEupv+QJSfyQaYAy86hcYUsfF+Lx4PolUaso9NgfXAvuarZylv6yJuXkPHYUzg1bvuGE/bpamkWFgc1sGUSx+DSFOqzu6pCpAh0= 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:(13230037)(1800799021)(376011)(366013);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: H8eCnmhiJL8VvGvvprKhSA2m1z0htZid1lUuwFK6VmbiWPKNI7YiHWtsuAHHCwarvws04V5Tg+UWxrcuNdEg30s3ujLGZ3dDgOkPz39VuX8iXvCVyxXR1aDu4TFWpTvt94aA21W6TDefKbs39ZDhMQDzpxj0kEE+kSWeV8SBDSM0tJN7Y25/X0d6oiPUWZnHzQPIrzS8XnyBNHOCY187Z/rDqq06QgTnyemZnhPjRVOj/KZO3G3QABqaXVPkSvuAe8qqkjZSxkLALk86WV1kQkwq9gqxTXqQW/taF8O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VoZoMoxIC1EuEiJUItT5lSZZU2SOgvcr4rO7iaMw2gff94o0seBRTt7mBbKIcAkk3JdPs7FyfDjb9EKuD4Uob9XGT5ayaML9m5u5P+B+ILs+htiRC0T1jn1xCPk6hfdHcQVwweO6p6LFW5vuJR4IzRthLdywuZzKVFER137dZnpxdecAgN1S2LdYdT5L5JqBb2kdYEPoStE/N20L5exDabbxu8lEQ/Dj9oa2Igfa5w/zKQ== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: FV7XPeyB1/bQqDtbA1aqT9Jbm1Jnpu0GZWIiUXyvCWQsoaFemg50isnTf8XWNxK3XMtyHS9TLxao9mm59Dt6trAsmlDdrqQ07qo65M3V/wZ3BAuljItPMlS+2G/ophxefkZ/xXr25qSEI0Bvv7pq+2F6hPazi2Dg/u0rMR+x//wxhp4jVuszewmT0UllzIVWu+S3Pm3KEZq5XmZ68q2E3jjSbtZAlzYQRhsXEjhV4e0GhcuEnoIJk1Md83KJYoMb16dwGDxmwAMKQ08uLCJN3ZvmUOACLKAsEx1vOY4ZdQqlFSIrTmzz4YNcIbxefsPXjgjZ8mX2V3Ian2NgiZ5kvPc+37ESIpIXGIdKK6V70WAXZINMYRFbOlxtxNayKuey1my8sw1ELXcBUDFzw6S4RDU0lKdyav1Bw23OsL6VwK+hYhInEahE/2YjF+stBiJhDGCrN82fc8UMS9YMKnMCAXhyeSSrKwIYcyTDh0ts37Eb5Okymvy6xzU0I75N0N28FH0YNff5CvQ3SayBPFbTpdKI87dIsx97x3OaYWj5/i16iq4DAEsL3OUFlZmQuQZU4z8kS24IL550yBgWd+ueC/+E1WdwKzfazw2HrHISgyM= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3cc3ce65-a362-404d-36b5-08dc91d9c93a 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:15.0541 (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: 1boG/sxX3z8s/xQdjRZc5sx+TyIZJfY7hPQhgW7zhRKHF6HIfXVKP8FoMx802c4MZx63iL4CHdz0TTPKoXCoKQ== 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: k-mQ7PZ70UegpL4vuufCqLL30thwkl1n X-Proofpoint-ORIG-GUID: k-mQ7PZ70UegpL4vuufCqLL30thwkl1n For forcealign enabled, the allocation unit size is in ip->i_extsize, and this must never be zero. Signed-off-by: John Garry --- fs/xfs/xfs_inode.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index 994fb7e184d9..cd07b15478ac 100644 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c @@ -4299,6 +4299,8 @@ xfs_inode_alloc_unitsize( { unsigned int blocks = 1; + if (xfs_inode_has_forcealign(ip)) + return ip->i_extsize; if (XFS_IS_REALTIME_INODE(ip)) blocks = ip->i_mount->m_sb.sb_rextsize; 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: 13707206 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-xfs@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+1uCCOC99ZgKxHHFoKHZtnuhIW3sYmFSquXRRuz2EmHqBufHyxC7CyoE3RYI8LbQ8C7YjUr8ekJfzNpWTScqtfF5Di4irj/T7M8EEy0XwSppFQHSbC7syS6j9bKsa/8OOg16/6EmulReVKWJed2UgUM/EAIr6cEe/Y8M4fhdbeD2cr1eyGzIU4IOTMCJia1ipyuImXehomcfhK521+ikydi2F3E/HH+aBk6XKeh+KpvtATN3wRd3z3+QzmUVlRZpz5/Q9tG4M4RXrcd/11Od+WlxYknEp/wPIzxV2XsV9h7RBlpkNHIuJLBJHRcmNOeEApz9m8fFjqmtYun5XDBxBgYO34KCoFLyJAu1fAgA3foNIoSgKzGD/aAbFzhNh7MnKI/emWZBMZNYi6W/wfPnrIq0d1Xn7dFGtQ7ntMOQTB5/9o0fk4TPzhZc1KOTzwh5MG74+aXulDt7hYS1AChC79bdzwAFNr9daQ/r4biG848bc1l1/1BjhKoYVRxCULOoxzchYwgymAE8a3038Ao6lqZVr/cPSJtlUwkCWfG5jzcO5etze9+DWvLJJIGvBFmdw6M4xtZHzrzMZM7xRuXHMZzdPJLR7yC5hQAxUjg0eJuFZ9KHocDkbbPLDdY38Ksq7m4KtHpaS6+YQn3C8EDpu/P/1rwPc+oFHir5gMlsAZV8JFclJty1+jY7n9O9hT/xdAohaaVnUrwlZ4AaiGPEqTBt84d/au6Pdt0ynaxeK5HYt4odjvVWVNQUc9CuGlfgF/L/i5ukDjSF9VEuz1LLd7TicVCJM+TpOx8li6l+4owwO121zmf806BfGsLGSmzu0u61G09sAuZ3FXJHm+7461DRn7lMjivJCrz6im/ZkNZa4grLHgJF+FgSzKU7VnGW8ZqTWpeIiMDAPCvP95oVwznCaVqvkCjbIw5gM5JmzK5xN/U5/3MD4C6t+fRaM1cLye0rzQOOOGP6kqkz+rHI4wXOhgGEnIKzDSWxRMVlslIAeibDZnt33PRosobmayD+L1/AaPgzbfN6CHA9CQqPZJXbkZqQmS8= 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:(13230037)(1800799021)(376011)(366013);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X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EdifzdKlDw8SD24cCbpZ8grSMBL2C/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 From patchwork Fri Jun 21 10:05:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 13707208 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 2656F176ADB; Fri, 21 Jun 2024 10:07: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=1718964450; cv=fail; b=JO6/lrotAEX8MW60DSR/8d0ad6YvdJdxBChuvvkxiDFOsBzKWK5zJ0J9d6WNa0NOT0CKBLNVglrhVNUauC7G1KEYX9USab8XrrnuRLujBIEFm8ryg/OIqLIotcyDJNU3SbtfEuZx+4wA6lBHO+/+JV840dpuKNvKv8Vt/+Hxpq0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718964450; c=relaxed/simple; bh=7A0UP1knvLD46RpasWbfGfM2XP1F/TaSAZuhe2gGZUc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=KeqO3JJ+FVbqE9pZkRLnSWxjrs8RuGwPo1DlNnYk2eVSJEO6Wf7PY5Dx9LTEycZqiWhd9g2D6h2I/BnKLdI8WPgsFYvm3mt1qIcPmbbudGpQd72SUwZ11uSkN+niueWYxe3QBPPLKPfBzBXPKPkuext38BUsBUNCqkLBYa7mpNA= 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=V3hs5Hc5; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=k+RgRC7Y; 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="V3hs5Hc5"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="k+RgRC7Y" Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45L7gQJV013807; Fri, 21 Jun 2024 10:06:20 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=HDhvO5bYGBhBuZX0wWVjWzM0MXq1wQKWMu6+eCFTp1U=; b= V3hs5Hc5SOYIqWzcVoBbubWWDBMCUBMqI75m8yB8ad1ijCDI9xWE9WcYz4ozJu8j qZWBlUeDv/zNXGsqbJSnKOEZJOztjyxt7MIIzRWIp2NhEYPc8JT9PaEA/EtguTY6 thlRuHPYBD3MdxXZFMkeIQ6LCkdNlu/L+auBpQ5ZIJkTPb+Dzf3couzzBxqGXRBV EaiCBMozvo61duKZQ++Y9bEdU7nJe8pfI3x7UlT0iP81w95YviutGxV8yDClLtF7 z40M0J58JR7IWA9ciJ1RpaoJ7XOjG8Xp+QtL6x8glDqqTeJZWjH3rZtkvb7nDVqz XpQvUNTXPMB9gYVans6mgA== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3yvrka1e8n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jun 2024 10:06:20 +0000 (GMT) Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 45L933vW025228; Fri, 21 Jun 2024 10:06:19 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2101.outbound.protection.outlook.com [104.47.58.101]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3yvrn5wcnq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jun 2024 10:06:19 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Sg/yg/qOy0Mx/AcCiERQslpm58rquRECOrdT9IaCYxUlDlRsmFqQujpRRPpoNO3IFcPdFaFVFD6/iqAGNuSdCeyO0JpmGThXHfGX06Mvw/7r4HwE0MBAsQEBMLcwoC8lYu8Rz/I5fNKSKQd6SYdv1MzkosfmsHGkBhPzIZlP/TwNEc8qOPRyrCdgyX3s1Hlg1tVmkkDzYzGpGSMjfAqbAmdx+1NLJwS/0DGHWr1YPYG865M8p282oQKy/PQep4vWzIj0rbpoinQEnHlEQk1TDJWE+8RRUitLOudR7ct13UI7TX0TzuyH0KD550RrliBVY2bi46CBh1i5ci2ladw1VQ== 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=HDhvO5bYGBhBuZX0wWVjWzM0MXq1wQKWMu6+eCFTp1U=; b=j8o1bWRSywywQJq//Wio+eYBqIT/lby2fMZ246VCdDMuWoLnrZlbl3RYvEeR9yYfrUHvvQRsFSGumOio9awJ79d77RL7cpbytLoNbuysdahctGN7Iy38N6AVWy/z00bROwxwWQH5SH2/6mFsFQV5MYgP/luagpu/jR/W5Nje48UvwcpaPaXlDWXl0+Pnt5inEPgO2fKjCDijVvUdHGjwq9sXC8dqBdvdU2j4/1ipb2NdctiWBadstqr+g1VMnykvqcojHIdiR1RcGxCWtEZiml2STiHqVsF4u5Uj/q7+7CQ6JNgRt4jbGXpzxnKRy+8OqScmRR2E/RdQWIm5QLl0wQ== 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=HDhvO5bYGBhBuZX0wWVjWzM0MXq1wQKWMu6+eCFTp1U=; b=k+RgRC7YoFIiapushX1f5afEFuW3FG99DiNCmCdT3E7BBbTsiyck4063248YVKjjtbvAbmcghrmL8Dq7RmPW3Ki5VzZWDfgsXmoqcLt9JAoib+pSW0/aMq5ERmXlosf60fk+JYHBlNepOTvE0K6dopTevmBLS8KBJd3FCw4mu4Y= 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:18 +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:18 +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 11/13] xfs: Only free full extents for forcealign Date: Fri, 21 Jun 2024 10:05:38 +0000 Message-Id: <20240621100540.2976618-12-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: MN2PR19CA0055.namprd19.prod.outlook.com (2603:10b6:208:19b::32) 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_|CH3PR10MB6884:EE_ X-MS-Office365-Filtering-Correlation-Id: a6c0e5a9-ff9d-4467-146e-08dc91d9caeb 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: MTEQkDqh0y7OX6wy03VBznTVXwMrlfyehxYE7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OvwLZgo2xMy928MmHG0+Ztx04FQBBkcQkWP7P+4uccISgu1kIVdV3MhvjjMx2al25kh8xF8J4MuGxmJGNCWniOnN/MWB+Trfc+KTdCQqqpLWfRQScF4F6ZRFEnSnHpOGkO+fIVx1+Bxaz0f7eBbYD0D98ueMyAaP/8Ny/8jwEB79TRo4j2OkFhCe9DfqlwhaHjTbrJBLI89hVLlE= 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:(13230037)(1800799021)(376011)(366013);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: w1pj6d3e7DL6K4DVgw60j68aUlMXsA1Fw32+7hvJ6D9+2qTk7PywLmWD/gKBmka3GTqDITKZsLy0JQ334n2ij13WMmag0ZiVRaQXeRmztl+LCnU1p/5SvwZTpAZgabo2RCihMgNBOxgVcp8lq/LaHuG1uwgndTAj/oiQ8crJ5Stix+hez443hhsOTnbjcMNtq9wceRTalAkpAl8nax8/8FK7T+r5LaxMIi51m2V4j0k2tYHTn9hvghDumzvFyygmKnmxNp7M2kuQELEOvxBR+lbq+cBPFaR/SPdjgwdLBGWrthPXR6UiqXU5AH6egtsNW6M+MXtMYTv/GRzfpUSehdr33GjBMR1tqKIskZmkkLhecvbSuKjv1kDhcDQQ82QiTltSvA8ekZYCGqBtDehj3STrgVNeO1zhJQiBBTpgZWocr9wr7oaXuJ4ThyIr33fn7Arr9qkv67f8vC/vTy9jG/a8xfsyC8zU4BIcvR0EWvkY+Oz8qW/tLlN0/MhHQofYxLO+pJ38D1PC+Ezc/htUbaM4qHe2UCFHJDbWwRUD2GI/I/KANI8Q/M+DX5hdA8n+NbtzzF+CFg/fxzeFH7hDIW1HOq+fktLMNcpn8xuRmf6BdIgWU/oUG+GpBANlVY88Oc0STFGAc4og+acPjZNqVaFzoSEOhHmmXqFCTRsECGJAMOfUayVJwXTOueLzwVnj8jUU5ZH0D8uzkNQKXsTCnSgFmIbatvFzRLYslddNV1GB8IjWPApO6rKKqPiN6rQJaoo6y1jVTESVVYu4uUrUi68ln7Kyw/iuykVZuxFN/Nr4gdrmcX82P53YdTZoYU18dnIV8QtD5G9pHd/TenNpQj+MtynLg2FOVHNslaiXuJRXULHsRwbGp+0Oo3bY8DO1iA7vZopSEWi1m39+2f4CWDghEyZUFVGOadR9DhxsjlKZL7cNvrjcommS50cbnXdIKj0zfYh/qZoFg88VQ/mLQRENTm9WDBGvwqcx7E8U45WieYuZMd2pg5PJI28W39ECYkJsM0T1TpJ5+a48a1AiigdXqG9H67qTbtfOYtNal4PeZ+x65TxwP624rmprrglS/Shki0Hn/PI28bEw7PmcIlsIM8NxFCcm9JcpWXD7XGdnrAsI/J6Q8iDi9DczCk7yt0/J3hJEc76ibiyaqJgvWgk0z//XExKAt6rb/BKD+pEXReDCRATrjuV5flz1covRZuzTWRhC2Ln6OGy0R77KFXg6r0Lg4X9V+5zJoN0gN34pNpQ4iO0PbsQccHLfAmwzzHJJ80OMxMcqPhrcyRNC0q4O0LIMCJEWdZx4fF5iiEENHFwymNNI9WR6Uh22st1SycES3ujOFZbDYT74EIvv/wTHKAEUovYkwqKkYzmFqxJO9rWyMwLnMcmVK6Km2IKihjXr1hKt4YVjroRGS3qspFGt9JimsOMaMzy8QWZIHyJbn8IeAz3jeZOWtxEAuIAXH0ryTypZ+T7nGlUS14i/QybjeKPdbVdR/q80OQd4mj6DJlc7QyO2U6gFCje2pOYtS/AxEKH60slAe/2yGtvG1b5ZAGxWh/un90IhABkrpKxH9BOU3tXddsfMXqnGToCWBRljXWugBCDgEhdvdP9Oqw== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: cdMriZG/U70YBp2dRUPkuZNGB7A9DqxgzghA8cXeXQXEExH6zkioJff/Hh5+UEVLZPFOvmBUvNUktETQ/98+0zWGk8zkMdnq23rLDzlX8+R+xVv6jp6WvEKG1xcHqvy+bXHxjCywpvqnWbUr5eEOuGhM7Lokg3bko/5qSt8AsZ7NjW/k2YhEmdHA5efRhG0IIgygWxmUS9wbrcL1xIM0uga5N+0qompRy7F0vemPmQVScwrVw56hXrBSUe6cPLKrRn52uICr/7VXkunPrUDUPxQUQhHfd66/Y2NkUdbZBEAFEc3wbw+2U9MH3igbYiFWMBnFR+8KPsZ0lAnU7ePiINWeldfOkJ9WmZIoCadj7gB/WOZ7unKBwGQLanN18lnt8tq2awVUeojmzIL1QTFkbUyRCY8ApaogLE9OprtfsWajswSr1zLBkW2i2RHGdVhpVK4+HqxGdMVZmDJN8noF9Of3tZSOrSTpP1xjhcJJlqeMSBIKyeX/yota91YgYfqwSL5tBQSBl8WjrgRvmCn9ukYjxamrfXN1BLEwBL9OTxyDkNRhODR2WOTc8XkkJzQ+jSpQe3VpJUVr4oCnaUgkIfH/PEtZie1Zj8VtOXM6Hgc= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: a6c0e5a9-ff9d-4467-146e-08dc91d9caeb 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:17.9589 (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: qrotsF2OWP3kIg7XXtiH7lQrQ6SeVx70NKxVfEXl0vm4rcccALMqSwNh5SYCC9UJueg783LgYUZBQOv31yM1Hw== 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 spamscore=0 mlxlogscore=999 phishscore=0 adultscore=0 malwarescore=0 mlxscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2406180000 definitions=main-2406210074 X-Proofpoint-GUID: klsB1kQm12IFT3t2iQAn-mU1MhI6iY1Y X-Proofpoint-ORIG-GUID: klsB1kQm12IFT3t2iQAn-mU1MhI6iY1Y Like we already do for rtvol, only free full extents for forcealign in xfs_free_file_space(). Signed-off-by: John Garry Reviewed-by: Darrick J. Wong --- 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 56b80a7c0992..ee767a4fd63a 100644 --- a/fs/xfs/xfs_bmap_util.c +++ b/fs/xfs/xfs_bmap_util.c @@ -842,8 +842,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_inode_has_bigrtalloc(ip)) { + /* Free only complete extents. */ + if (xfs_inode_has_forcealign(ip)) { + startoffset_fsb = roundup_64(startoffset_fsb, ip->i_extsize); + endoffset_fsb = rounddown_64(endoffset_fsb, ip->i_extsize); + } else if (xfs_inode_has_bigrtalloc(ip)) { startoffset_fsb = xfs_rtb_roundup_rtx(mp, startoffset_fsb); endoffset_fsb = xfs_rtb_rounddown_rtx(mp, endoffset_fsb); } From patchwork Fri Jun 21 10:05:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 13707209 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 1636C17837E; Fri, 21 Jun 2024 10:07:30 +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=1718964452; cv=fail; b=QnxOvTrp30ttLMHRdWwyCeK3AQoeTpucidGUl4NEHAvuKAqTggbR1CP7nczV3Wi2q7AUJrYs3jBzvM6Ej7Lbwq/TYIEL45cOc7WwtIKvtNn411S4i9kUdYBDydE6vbCXxJKgyjw5/ZInQf2/kEyX5dw67thfJYCdsO4Ge360/Ww= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718964452; c=relaxed/simple; bh=g/5F0h0hL4GfF9apVDX+Crdk7zad1iBFYokVEfSQIqI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=fNMh+CM14l4hAJ8VVEFKkdTJxByEShkrVH67n9g+0iqBlYSEFWB/dmXPrelg2op1Wb2mZX/S4rVmcuyBHq8P3fTqqa+gkA1m8e73r44j96web+PlQIOzordVvWpwNP/9yjrV9hIzPraGRK1krdX/yXFW7sk43QhyrOYaqbqNLDw= 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=B/0fViXA; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=IWlefkqB; arc=fail smtp.client-ip=205.220.165.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="B/0fViXA"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="IWlefkqB" Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45L7fVW1032374; Fri, 21 Jun 2024 10:06: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=iQSLG0sBSRHLRNlCCS4+s9Ylgn0wtVJ0VDVh5KcEyys=; b= B/0fViXACUAl/0vwOxcqQgymBpYoLJQuKnpQeP45OtxEWNFKrkb9d2nlA1P0OkEs W7/E9KEgfcNiBzJuFpEvYhA6i21WGLBy9ufvAM+BbOd1TEAbI1bqhJZgke9wMIZo X7jNNtrIEufY1Bd3wcLVMuG+lRfPFrAbOJOknqxDUIbDYTvG5B+7w4jsjhJajbvx xPY6xcTjG3fVVn8hWUGB6RV5ynMgpWfSSwN9FXZFbrgSZYB+9u2ZMdEVHW+YqB/l hGqW3biv7zw9Pns+oHzAN2V0lSeM8bn45GzLInMXHkVxmGU5K+MvmHWkl9doabF9 4oLd5M2dxiPS5zdjSADZRg== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3yvrkj1fd0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jun 2024 10:06:22 +0000 (GMT) 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 45L9OIFt040028; Fri, 21 Jun 2024 10:06:21 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2100.outbound.protection.outlook.com [104.47.58.100]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3yvrn44xxv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jun 2024 10:06:21 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZhoGOg27HxGtLuCOEC3yln5gkvZqsYGBii26JG3LH2uuA2h/l+Xum/oKKQsGlgtDUPbWZ77hPqayvnLgLtLwUj3k+twKYRwIfqZzKam2ZD58RQ4lw/Xp0creyEJZ2wUroIO4BA1W96qzf0V6dpddM07O1tNyV9t1ERMNBFaAyleX0d6w9YOmuodnltiaCzk8PqZRuJTZla1Y3T19I7OU0fvCY5mamJ+ArFL6HOMZXajCqgrACkQEwl+SkBM9+lttDiKsFxRkN34VnDsGXrupy/V0SsbkABbFGQ3WokhhV58fZjqmDevQFdrgaSyXE7bsFP3ylrgsDTMK4I/7+uPkEw== 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=iQSLG0sBSRHLRNlCCS4+s9Ylgn0wtVJ0VDVh5KcEyys=; b=DJjjmnR6O5SgY41o/W1Y5bTifgHiTwNS6V2xo1y/ZfQ0R2mlJ9Dd9uCLn45PdfyMw4y2BjAvy6h+RBkfcPBgk809Yt474oiRDb4uJFXhX9H5Bn4Dllav/h+c6p+FYzpWdFHHjdqc4ebxfu6WThTspzCtccLp2Ybst7Hl+sVYnO52iapbSfLI48/jBe25DL3wFcd3Lw1KgO87wkqr+5oQo8mFiux9VaeGcZB2TeIfXS99U5OsOsaZS1lgIeJaDB4WBM4TM2sB0HdChHcXFwu0sl36DwNKoEZoyU/1frrHHwq1mCv3V2+CiqPiDN+PLAV6vLGjgJEiGWkO1y0Z7JR5Dg== 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=iQSLG0sBSRHLRNlCCS4+s9Ylgn0wtVJ0VDVh5KcEyys=; b=IWlefkqBULa14rlgxGaERMC5VmZxsP5/rN7IvvB+YxgBS9h9MMhpRLqqpY5MN0P8zdjpnNNq8RXITiGliQCcdYOsmz5LN8DXHepCQQksGj7E2LvEgeCWaw2imDtEMZaHeX8yOLH6Yc7Qck2x/i7mQAcTWfm7s4Fc9QqJDds92XU= 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:19 +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: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 12/13] xfs: Don't revert allocated offset for forcealign Date: Fri, 21 Jun 2024 10:05:39 +0000 Message-Id: <20240621100540.2976618-13-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: MN2PR13CA0017.namprd13.prod.outlook.com (2603:10b6:208:160::30) 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_|CH3PR10MB6884:EE_ X-MS-Office365-Filtering-Correlation-Id: cac7d4c2-b6c1-4b98-e9de-08dc91d9cc02 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: +/s9mLkRU6HNZz3fpqj8u7cWf5956poux1D/z+PUJXguRcgqEoto7MjfnZ3/aixuJX4+vj+zpb4CGh+TWYyzni7lc0LznXu1w3GBTP8d+uUlxFkN/lIqDTQNikXHbHiQA9WOH4mwfiUVnMY6p2pjy6iWrq7u+zkWID3T9f7cL9bzWRZ3xHUMv9VU9Zsd0DZJJbgqc5HcFqN61UEdIKDBuKtQrZQNIPQu7BPQXYPrwz3KsZj+f24EZBAeICRoaXWw5hukPES3ngBInrtbF+uzRgVF97sCuwJoIn+MBEJS6ATndl+P7s50mcj9x2U/IM/IJSQW/MMBLws8pNRHvKnymEAmhv45gnusAoEaapf/i5T7IXYYaB1c9vW3tEh19NUT1zY1GTS0PFlvOYK8Ynr4cOFSeSciLZnLX1QrWzaABITh2MGZccH3m5wVvVUKNlJlAtVFo+juwBJIkmippbod+3NId8RgfEYJLYH2NOFhLfIP9EFwlhBwRkAonhszeShvqJ5QvbDpo/ORtKQqWrXXY1QXt/O26RIKdW10sPmeXqFgyugvD1j2RilSmFk+XL5seHiLBQLCO+fTdH2AVjv9Go5Ut5DUd8Bw+PyDfdEkKKqHk8caIdZrif/DbXD+B1voh0xbxQqyq0/wY9XkLFXJW/Y97zp6KQ1ifVN/NTbiysR+35LOW+aJDGhgJUIGkAyeFfrWbknjKT6Y0dYDR+3gUKwQEErvZjSINsnDbzTsSVeokZC1Uj/uo4lhyKXE21m7W1KuW6peGZIWQG9UU1UQe892BzcY9HNuOGM3E5BU9Io/MQ0MZxLh3d/S/ETkYYfN+IrrmLCBjFhN8g2/5Hl7/Y0YWqzO5nlAHl3gAaZgMNj6xm1fLtTnq/4OEMyFIdpCkaVPMyE/Hi+21j+bctlHOFsw9gVQT1ubqhFCt63iC2xpE6/Oft3a7LCqsdIW4UXTVHgrXKA1WmERhgy7EmgMIyWyZ9O1Pr5H05oGy5s1A8Gst3yn41j142WvN1pbPuUHVeYP8w9qcIWJOQk4kHaoLFC53+n69oXmdjOTqWzDpMMtr10civEm8BT6QUkYwvzMlwa2nlasdKzJYkZmPvMH1kKnV1ZZ0pxETU393OEXEvzue+cGcxz9FdQX+bRh70Ulyh1fIA25jdSZio/dtocO4/xA/ypGllhRGNu0Ua0fdK0RTi84YjpJh6odCS7oGXpR7FpjsOpTeroKQfmJ130xruJM0YbEDd/3nma+Fc0qtiHuUbd5Jn7BJN0pDkAYAzUeee+KzWEIu+nr9JJyH7QX1zAvkMdtx9REUsOqYrlEqF5p+leAtWdSVTBYiYqPwC5P 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:(13230037)(1800799021)(376011)(366013);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: pVvS1hMiVlkOTqqatzs4ZoXzgZsXU92dLVqoESZD/ZTwEMaVTiQsHbnV+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MdN4hediB5u+Hd6ZmMEum5x37vrNYptYs7/QhVUs+eLKYC6g8Y4DYgsqKqmeTEBuiZuXzAb80b631v6g4WrOxpemMpE/M= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: cac7d4c2-b6c1-4b98-e9de-08dc91d9cc02 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:19.7734 (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: 30YMaHHQBYHnvgz3urJcZ7DZqoxR0hib0O8S0WXymmaVwp9cc+qYp94NWnqFOwNwYatpvZmevvNAv+qQF/+yfg== 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 malwarescore=0 phishscore=0 spamscore=0 mlxlogscore=999 adultscore=0 bulkscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2406180000 definitions=main-2406210074 X-Proofpoint-GUID: tOlMmAXWDiTYnDFgCcXXidcm0bzWeMF4 X-Proofpoint-ORIG-GUID: tOlMmAXWDiTYnDFgCcXXidcm0bzWeMF4 In xfs_bmap_process_allocated_extent(), for when we found that we could not provide the requested length completely, the mapping is moved so that we can provide as much as possible for the original request. For forcealign, this would mean ignoring alignment guaranteed, so don't do this. Signed-off-by: John Garry Reviewed-by: Darrick J. Wong --- fs/xfs/libxfs/xfs_bmap.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c index ebeb2969b289..42f3582c1574 100644 --- a/fs/xfs/libxfs/xfs_bmap.c +++ b/fs/xfs/libxfs/xfs_bmap.c @@ -3492,11 +3492,15 @@ xfs_bmap_process_allocated_extent( * original request as possible. Free space is apparently * very fragmented so we're unlikely to be able to satisfy the * hints anyway. + * However, for an inode with forcealign, continue with the + * found offset as we need to honour the alignment hint. */ - if (ap->length <= orig_length) - ap->offset = orig_offset; - else if (ap->offset + ap->length < orig_offset + orig_length) - ap->offset = orig_offset + orig_length - ap->length; + if (!xfs_inode_has_forcealign(ap->ip)) { + if (ap->length <= orig_length) + ap->offset = orig_offset; + else if (ap->offset + ap->length < orig_offset + orig_length) + ap->offset = orig_offset + orig_length - ap->length; + } xfs_bmap_alloc_account(ap); } From patchwork Fri Jun 21 10:05:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 13707210 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 40EF116E892; Fri, 21 Jun 2024 10:08:35 +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=1718964516; cv=fail; b=K+nrBfoDMLT8gqGQ9txpa4iMqzyDYPd2oNdUuPnTeuniHSkQMtdtIuTnLibdVIwyV1XOMOPN5RTTX0OLXuF+LnMBbi6odJ0+lBh+id08JAlqseIeh2L7W9sO2UE83WROwCte5u/fbFmzVB/iA39v+goHOU421/tsxuofPZkBg0s= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718964516; c=relaxed/simple; bh=9FTMcA7rkZfmIgyL8VqAmzt5cNENoCeG0+P/w6VgWLw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=HeGcz/diwPd4T2aVg0bR5UFRY/7m6uN8UJ02/K7RPUwgpKoo//cEa96en9HL8pm5iK5SuwOTdRLdnTGE6G/S0znjvjFJHNEY3ygqIhXKUbEKKRdELWVuN9CPiQYhnMO/mRJsa8g7ir9YGgMZxFFI0yHf7kYw9QCcuf+09YXiv9s= 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=Q1fTyfbK; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=h5LcDJJs; arc=fail smtp.client-ip=205.220.165.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="Q1fTyfbK"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="h5LcDJJs" Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45L7fV32026946; Fri, 21 Jun 2024 10:06:24 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=IJpgAtqzqy5NPMAuN6MwKwGQVoR3/AfpA32R9j58sLA=; b= Q1fTyfbKLO3kvXmKEfvqXsrsoVdCQ05rtpr+CWHix8VwIni/vuuoW52V0hDAwWNT AWHvvT9ZE1BK1zBAA5KXcNnI28ReFNnnr9rhBJl2mGIqAckV0l4/nO3LBmip1XI9 UfijRdh6v8/b4+p/8zkqf5a8WlMFX+pwujqlqPa09jxUPR48zO6kwwUbZwuuWdie vzi+Ae06DQQfQey0ZrzC+whU3ilBUghXRYq/evQJ4kE4WNeDNjJdZozd809D40To vl7WYbbUE9Aan1lLoQVqmEz2b5bBwVqusZvmUiKUEIYYvK4C3Q11Fh73OY8VH1c8 D60ArpQLCNieozFK4HRRdQ== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3yvrkjsfp3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jun 2024 10:06:24 +0000 (GMT) Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 45L8LH9M012928; Fri, 21 Jun 2024 10:06:23 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2101.outbound.protection.outlook.com [104.47.58.101]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3yvrn4erd4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jun 2024 10:06:23 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mkvPFIEM+SxUk5KyjHRn/Hamj4Uy+9fiFU+d27wkcoR8xxJ0WfuA6U34aW3A0dxEjwqxH3dmgFRbqZL6ydS/CoA/QTw6Eqpqim1Gv+E2GLnCIemplNpwmGjhPUzlXAbYAPqHh/LNitDE9wExa9MmlcZFmKr6HpQOOFQzzpPWCTcEQ+6eoPAw7NmeWLD34tIj3dtE5545O2c1ByM8dQ717en9h5AqGwYGCkmAnVQ8hxEE+oqRgu4IO4jQQ/B40i/EIZu14X2sXgIj2DnBZILmR9D2FbGLRzjhUQmXWg5uawoUw6W0YNEX4t/RNtbp2sPA541Q8Rz5rdrZdWwmGh8gkg== 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=IJpgAtqzqy5NPMAuN6MwKwGQVoR3/AfpA32R9j58sLA=; b=W5ypj8bV2b7P6Qx1okXw9a85UT/5LRsET6mQ4g4PQXo+qme2V+gtdNF1DPD0LqoVbWB67Afdf07V+ATHkK+Iam4eMpbYK2+0cExVSexBGUTrR0LK1kwHHrN1Ky8wnNuaRoMSDR9YZE1J7A0HGJmgEnzink+qwceOveO5DVmUPNkMTMhbyF9qM78nRgaJ1qkSyTRdcekH4wiQ127npznz9hcYKNfFSv1LTh+pxm73JZitYl+DUQQiNtCjOdIe56MHyUgbTGXsIe+6RaHy51DnrN4tF2Cx4Wjht/5iQUpVa31+0VPNAzFnyzMrIa1ic5nPGB6P5Ajb56/ukuOlRe3y3g== 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=IJpgAtqzqy5NPMAuN6MwKwGQVoR3/AfpA32R9j58sLA=; b=h5LcDJJsCk5sUICiWas0loFaYiCMKxjHu6M4P/7Zo3cs4cZFBIfcdFjCTF+h1GI0PEWfjXQ1KIyDlv8ikayCRofPuC2me564ABdispaKBZQGxjgIR5Q4HK6ZNVqLgL0Ou2zSETdI6bk5wbKQyEkSQYjRPGJtw7o/4Qhj6o9cJ1s= 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:21 +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:21 +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 13/13] xfs: Enable file data forcealign feature Date: Fri, 21 Jun 2024 10:05:40 +0000 Message-Id: <20240621100540.2976618-14-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: BL0PR01CA0019.prod.exchangelabs.com (2603:10b6:208:71::32) 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_|CH3PR10MB6884:EE_ X-MS-Office365-Filtering-Correlation-Id: d75f1902-84fc-43ee-ed7c-08dc91d9cd0f 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: zuBeenhKtI4ihsTPdMgBhTzRg9isOXJHCtJF21J9jAZoIUAovmjPQCDi/RhdvoDrR+WWJ1ChfZqNd0XheV24jziP+jvEIkvlHBh/KL7ESxBbQ5lC4FdY7fctM9rZhSv8iypcZuayCF6WFYqdwukNK+8vK4bs/H0RXQsdSBu0keOyspVM6T22Rf3Zv+4DpjDaSazk+jdlFvodgEQQaFMtFg3Arq7/eqy/z2jtTUmkUyUqL6J/w+39hbEopffkuwFsp2+o2qxOti046mUpfjIDU754JoD5V5ndqY+rUa88k49sGcR3+siFAnVwMOuQavPbJn4ROiqMwHAtgyGHxcekden/68BFFdpNEfEgjBL3A3mvd465LypUhTr69q1SZDj67kNCWGfqxmsckRBUNzXELRwG+Plh4eluSoMFy1WfrK30blcstjGISoj0yMU45a5d/sKPTj0UN65aZC3l/T+LI5OsI5itozI1NCjKr05vco2d+U8b+WuE0WawgLN3vjw53kVZ6bQ8Mv9rYykIWFyPXnjr1iGv2iRn/QRELxK9EM0uHUxKuZfBD9k2ZhJhSKuLAqWSbNwQE+UYWxWNQOKGpSQ4SuyiSF6vnAABplekTOn678u6PT2E5mF1vI8xqzXICROvxsFeMcAC88V6pcCPHQSjT+zmDCZo7pKO6IS2ArVdO9PKVHfy4hXO4W3/E46HwJciUXVF/OELnuwJ5jS0ZqWaMBvTWER1Z2ipqO2Q1iDdmC8Vfq03Akf4Ql8oNbKeSuwGecFWwfoUF49q8Mk20Q2Wk3tSS7sXnRj5KQt4fWrht0GpWb8brWyL0B8/r4IjLW4uiQ5x5jF1QPTLyZBsSK2ckQmbPSHOg0BMnDIE6fpsxhcneu9yaa2Pj0QUrrjT6NRMsH5hkIqhuwzQ98BS8s7fMhT+L8LSCMGqHjC4Hfphm0vZKsZF9sdFP6R8/01K8cq/n35l9RTol/7/h8SDLJ4qK73kUwJdEBB//L5L/COtiB1WJM+WxZ4kGd/4759nI7hsaNbJFj5ljszk5b8AS5wFEdF/YwgY6iE3q8Db1pf95Dd+040hAlc6w86oODrLGAYhyvvHfKG9hLPvLtdygckq0oRTsa5lO+JxnN7fHBEHTZPDxht7tM22AgPBwG8ZuAwN1/rj05D5ScKCotik/6/kf2UfAAG2lssu2v9NNyNiSNj6Ts1/NYnlyRMb3rbFGD+nj0W0UNtIbLeQjUyNhTUYvqPSWsuHJg11++auud4WY3v1aLINBr17nAg+qYKSap6zXoysk5kFXrZCfDSoMLD0JGCOVdbEj7bz4sNFwaaeMnCugDzjQPA3us5RwRWW 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:(13230037)(1800799021)(376011)(366013);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: VL4QDDJnJvh7dgxrmQaigG5H3GrQH5sTa0NjZUYQ1GZa36sjJodjTNiyfSX0jOQMFD4sYQg/NUkZTAOIUi4fz6aNrpTHshx31HphqXTl/r4BibMCbDRksfEYhxIsoh6GzkblMJnF77t+grAlnZHzcDQia+YZEyW6BAvaCDLs3r+ztlWoECAT4hn0ivJjOPF98OzYaubhRPuilAu+bl7TcYuk6joM+RFoeZNg+b5EYuP/OJhz2UWAi20oyZO7yGSnOtiUG6EbeoQuuzKhK/WtYT0CvAwsuBjOcQub3lSwM/geIlIzRVUnEzp7DF1h6cF/5f1ytm3G+kMCzcqoZb9O6SaL7IsH/Se1xK50ZkYBMuuzbKqP2vnVpca2VFPbzM6SRTTdzH7z9xVeUc5dDKwJn64SPzvkc/0SvqtDhyNfl9wD/foeN/jsc15zZ7RZBXPlN8HHyDbepXYeFYFWftK7HS0qeiABfEJrZ+zr7hDom0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yM3TYqgvFDU61jd9NZ76YhRNV1/ZOKu4AWHM6bldTCh2sWczLuu1qRg== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 5jA5IDeDIMuGDsUu78SQL3UjgZU9GqoTS4gcW56UNOIviEFOklnhgYAJ6T8TT76MiagbBL6RupMYCOBTDaCxKNhohFqke14jDlKRvf0sirTxQrjlZKMMG66bQUZB0siV9mrqE8pgmC/PTxa9J9NLyOdEIvtjj+mkvLuJ3YOtlMgJGYoNZqdFP74508Kzgm7l4fcrmQVw0bynggc+5WQLXjWmaIHCuTGaSfLVSmOgqeg7+Y7oLhbGITkbpQe+SrzywVjx6NkHG5K8lHLidijhZo6QI+gryysdirJurjcDWowFwg4sxkoRvBMbunLfKvNd41ub6fSjnWNNVv7+zb5+5gV6otLxXiomDQloYPVcOjQ14/wOFsqifvjBSV9rN4QadySed8Q+1g30Ptd94D5FsLWVL9BXquEY23hfxXU2+NKtXUA36kmsQEPuMCOZCa931Z6b07YaXJwpNv95JHNvOjpSo3U2dYGfSR5SKOHqJuc7YpulUySlvljzuM+pvzHrU2WF/Sye+OR89+hBcBFUggjpNMBMtIa+9rnQ2muqOBb1xeloffPU/z1hJb2zhAbFnkUwgmovLktHZ/xyQkrxOurRX3wO5Em7xYIh0Zfxd+w= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: d75f1902-84fc-43ee-ed7c-08dc91d9cd0f 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:21.4927 (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: nqEvcq5xBaopwvzq+HPpZI3nY3gZyjLBKJCvu4oBPFzyGknEFMt/Vd3HUOrvMfmOpjRhIpfZbA7ndjl7Oap74g== 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 bulkscore=0 mlxlogscore=999 suspectscore=0 spamscore=0 phishscore=0 adultscore=0 mlxscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2406180000 definitions=main-2406210074 X-Proofpoint-GUID: aI4QdKtQHjEcP6t-X-9bMUp27dg98eH7 X-Proofpoint-ORIG-GUID: aI4QdKtQHjEcP6t-X-9bMUp27dg98eH7 From: "Darrick J. Wong" Enable this feature. Signed-off-by: "Darrick J. Wong" Signed-off-by: John Garry --- fs/xfs/libxfs/xfs_format.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/xfs/libxfs/xfs_format.h b/fs/xfs/libxfs/xfs_format.h index b48cd75d34a6..42e1f80206ab 100644 --- a/fs/xfs/libxfs/xfs_format.h +++ b/fs/xfs/libxfs/xfs_format.h @@ -358,7 +358,8 @@ xfs_sb_has_compat_feature( (XFS_SB_FEAT_RO_COMPAT_FINOBT | \ XFS_SB_FEAT_RO_COMPAT_RMAPBT | \ XFS_SB_FEAT_RO_COMPAT_REFLINK| \ - XFS_SB_FEAT_RO_COMPAT_INOBTCNT) + XFS_SB_FEAT_RO_COMPAT_INOBTCNT | \ + XFS_SB_FEAT_RO_COMPAT_FORCEALIGN) #define XFS_SB_FEAT_RO_COMPAT_UNKNOWN ~XFS_SB_FEAT_RO_COMPAT_ALL static inline bool xfs_sb_has_ro_compat_feature(