From nobody Wed Oct 30 22:13:17 2024 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 B20981EB496; Thu, 1 Aug 2024 16:31:56 +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=1722529918; cv=fail; b=QAfw9YvVVnwoHovmniR7+AL3CclfHdJspHpuuC0pbG3xgtXDmhKdUc+RIGVrGqVfkzJ1suOJDagpyIZF5B0iS/VXb23jo1acnrs0y79Esr+qPtDVBi5Evl4eNoHewCxi8AHAS7F4owE4xB0LU/0cocK8A0v7QmAUDA9r5X/3IwU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722529918; c=relaxed/simple; bh=3d0NAqismK1oHxyZsbPGHkoTG01Z3JS438mo/jksfq4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=ufC3gvDtnZ7qZbQEdHvP7CcxhI9sQ84vvi7dh6Q6vxd1MVVq6PaalCEJp+H79L9GetK6j1IbDiqV0htuNWECyP2qnsEqroHP0B7FMNSR1FPKwKdu7QTeuTdR9gMW5lsYtOQxSt9RsXdeOXqJCm57moIYlp70AKjMJUjgUdng2Qk= 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=VGwklavn; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=UD86mU1F; 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="VGwklavn"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="UD86mU1F" 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 471FtXPZ011506; Thu, 1 Aug 2024 16:31:41 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=DVAFJDnrzrSAvCrZzveWH0484OJH9pv30i1p8PpGPbw=; b= VGwklavn8Zwr6ahg2NOnjKPb4WoUnhEUjWVAMY9fZyHpCaLvZXJnnPghrdklpFii BVB76Nd7DKKGlynvlyZga+X3Sr/Yy6nIjqfgbSuOUxp7XZrkqLhjX0dx3e4Qb6vc GuOM5MT179bUfvGw7LS9VdiM/CQoopAs/jj40FLYAIcIUQZNwVRgiUQVPQTEVVYY JrpLpWiwZZWOu5qKXWjBPKWy7GUt7m3Hx8IAKP1DZW9zi3nMeuWwRKavCNv3Av6U S8JdpWyeMw1GGpbdPQEEmtdtwyzY9WxOZioJ+DqYo3/d2hE2fxCm2dtHuTGhkSR8 hk5tDOR5hB+7oC970CcdIQ== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 40mqact5fy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 01 Aug 2024 16:31:39 +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 471G4CBp029016; Thu, 1 Aug 2024 16:31:39 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2169.outbound.protection.outlook.com [104.47.57.169]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 40qmpt8g7u-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 01 Aug 2024 16:31:38 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=dr2GvMzi/hcer/VcIE7U3vTHWMMbWh7dauz3jB37oIy9EY5bVocvo0ah6Qcja36LgXi0Z1/1IWwvj437goAEWFb5WLe26GJnV+HpMTToT/nKn+JdI94G4FSW8sSL59DuWldO81PoTOskJMv/XMOq0MU9LaPGDQFdo5/VohM2iExVbDGif0OWx25VABTpKHoIJYMnSaYAakSqkJFhXW6bsKb/uCmih9mRUb5uaawaPy4K4297eCgLNqQrL4CHB83NxcaAsL8DrAIcBJwctcXrjO0O9grZhfwv758aMy5cPAMEeRqiBBqrvXAUw0NKjT5QsrpaUPfVAxBo9L6y7lgaHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=DVAFJDnrzrSAvCrZzveWH0484OJH9pv30i1p8PpGPbw=; b=b2MkzZeYIarNZq0L8in5fw069H5WesRboEgkGxdkpEC06oo7GHXV48OR1OfEzk72mDL3wHKUgp2ap6zqpVcnBgUdM5eDLt+ugT4P9XTEhDuihRjDHpAxGvEPYbW3A4wPj+CdtvYxxbnwW2R3IpTsgp40uwLktlUjR+wCSOMvEFibKXN398RlPUQ5YR/q0K9TlZkph1N+xa9II5nOkErGb2Yr9+5rQwOQ8gRQnJkoAauIRifo2jEeLG1LMRUK3TyDIXSMyxDOaCFO3lBGexWNEcHdoMLJocPEUDMV9AAh1714JYNC/4Lq1raYYMS+5hIZoHAYMRtNJ6NZKecBD6MnEg== 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=DVAFJDnrzrSAvCrZzveWH0484OJH9pv30i1p8PpGPbw=; b=UD86mU1F76SOW2YDEkPatRtG0Ptb0opLFCbxLOjp6neH8a+2SRa+cUCUtmMVmxPHfiLdjlvs6vL08qaAWFRK5MELXXAHBXTzISu3VYWHHKnqAd18krXO46Bzun8u/bwXXwXXNxGVFLbbidxuWg8CVP6KZ4utgUH9t8fTP9jc//E= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by PH7PR10MB6081.namprd10.prod.outlook.com (2603:10b6:510:1fb::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7828.22; Thu, 1 Aug 2024 16:31:36 +0000 Received: from DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088]) by DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088%7]) with mapi id 15.20.7828.021; Thu, 1 Aug 2024 16:31:36 +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 v3 01/14] xfs: only allow minlen allocations when near ENOSPC Date: Thu, 1 Aug 2024 16:30:44 +0000 Message-Id: <20240801163057.3981192-2-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20240801163057.3981192-1-john.g.garry@oracle.com> References: <20240801163057.3981192-1-john.g.garry@oracle.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: BLAPR03CA0170.namprd03.prod.outlook.com (2603:10b6:208:32f::17) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|PH7PR10MB6081:EE_ X-MS-Office365-Filtering-Correlation-Id: 67ca4426-8c41-461a-324d-08dcb24769ae X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|366016; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?rTxZTz/hOppwnVUXV+Ks0+er82EfeEGz3R3J6PI3IYcKyOb6qBtBoX0mwayh?= =?us-ascii?Q?AKmed06YllXY1KQqVQfWqkMb0Klw/xLlIv8wAlNW0X1Pgfz30UBIsM7LPKhC?= =?us-ascii?Q?VXVg34PFkq1GmifwZFyEjvi1M2yN+15oG355MWoEPP6k660kZ4F3sgfh4Ygj?= =?us-ascii?Q?DY+LwabdLUyABp2P6GrlP223cQ3EstsJDXiPaHzOpiGDE6gi31smvwO1iSMv?= =?us-ascii?Q?y0J9VF+6V1kt+N5nEnD2oR7pfVltRdapyQVijQLX7RJCq99+IB8HAUV2LSmr?= =?us-ascii?Q?8vT968D3RovyJHNbVwzdVz2lLYyKzf02DV+vI18yvPA4ioZVh7p3zCazAfrV?= =?us-ascii?Q?CroHmbuvWS4gJ0ylwma21rb8sd5rE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9VodFUZ0fkpKw2V?= =?us-ascii?Q?0Sl/dSHdg33Pe9x/dFT16/6pJJGJk2pz/IRQLtEJVZZD88sq8I+i2UZ1aW7L?= =?us-ascii?Q?MnnGwX9m/engAMk6OGwi9kQH6LLAHXZ+Ek2Va8sIzYAaIg=3D=3D?= 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:(13230040)(1800799024)(376014)(366016);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?NRp2SZGYQgne7GTgUG+0ZnoErWZLzG6woKyMn7BfD9jmpNSTgtY9RIi4xCdr?= =?us-ascii?Q?BolUeWs7iUobEFztalIfhoCL48ZzkqB3NuSxURTfI3240eOf2OWggHxONuEP?= =?us-ascii?Q?D3QbCaGQXnKZ5KN3rDRwC4kOg8pgVQ4I/PhtxT/rXHgmrZzvC9DiPBVBB9kK?= =?us-ascii?Q?qLye8LbkDPX7U3UbxRiicS2dvGlbnbZ4dRvtruBHebvY6+/Oy80RKUqmeDzD?= =?us-ascii?Q?+GJ8fwQuhip3gBCi0IptKES531ylEAWe/HyzkcWA8ux47xHhx+MIPkd1nGcR?= =?us-ascii?Q?H6PzUekd4uKFcFvFjJdvoXGg/ujcBdQpS0teRSSO8xIbvoINKjie3zy/Q1cO?= =?us-ascii?Q?H2qV04M6vrrRb/Uizh1KqyitE3RUvibhY0qrYX4ZlfI0gij+52556dM+Mncm?= =?us-ascii?Q?75WOmbjaMz54I2LsPzDnHNOWLB9/l1snk08LNji1x6nxUqX5CTyxIohq3LSv?= =?us-ascii?Q?qQwue/3vk4jHMFCCz3bUCETIRs9XODa1uYeRNShD+NrdAxmJ2apr/W0wKnVb?= =?us-ascii?Q?bPOeY8fx1/y9Jlp6tznytUz7j++O/1inaRFEoKA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HEVARSfcmiLWhRdPFh+zR3ygs7xTVcKTcoDhYSrSDcW3FGkn?= =?us-ascii?Q?2qBKt1DFalUWtstO6fPP9zvYAGdwj3RkVoUvc7fPqmiqsjRZEp0zpKaduQLm?= =?us-ascii?Q?W6fNg85z9d4DXe/+Dz6DAb7H7g7s4ZXW0QxO+T55w5hp4y9b/5rB/GFGoRqT?= =?us-ascii?Q?ug=3D=3D?= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: Pui7xhxCGqCqLiLWxciLGqPxThGOHaUPb4vqzqYUU8LT8GaXjHXYphOnMzkTh6JWLjB/jZABc9dMSw9HnbMbsadu/nw5C8t5MWk9l10Z5oqfUlolg6dpPyKiqz+ArzX9rOrkbplAukt9BREPaA/sX+/1C5jEkEEEnKDtti46YCGnc9cbN4bdwRy9O2mLLKQJtXa26hj29zpixdMzHNRitcjwMfThvv6ktgZzhR/IIorUSnAKoMNusUupBWStY54ABaytF5tP8p4UldxqWh/sxQU0n24Q4sQZPCcC7wzFpdu+vM+fg3VsYEeHyPcKNRe81mX26adVqkjkv5nS+Pgt5UnGzaLc9VTAnvZmB7e2YSlyrF2ozGjjZYkcZJ/6K1rtlBmpxw8I46+IXhA3ERkhdbt10RNHYXtrwO6eG18s+d7/dRjhfjzn5LA1kjTVYwhxOz0KkL/7Fzm8J8Uz8YAw5CTnUKbgQnh0j8+v02B2yikZ4aWVn+WjdSj+JefUY1X/5bD3IWkmkdw8vMkU5DjCGG4pdlvPGcwAi63K0kLQLXou5DQEdoGMi++lWonmWIt/fUWBj6WqSrg0PYWazA9BxtruKK3xwoyiu2/lYiSmyv8= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 67ca4426-8c41-461a-324d-08dcb24769ae X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Aug 2024 16:31:36.6820 (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: wC4jQCzrNe6wGfEBCCGs+YYn/BoZcr3I7gpUKAbmvov+jIvn0pQmSAeTX5ODPpOlK+FADdeoZe7tc5wU5b/nqg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR10MB6081 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-08-01_15,2024-08-01_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxlogscore=999 mlxscore=0 malwarescore=0 suspectscore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2407110000 definitions=main-2408010108 X-Proofpoint-ORIG-GUID: ie_dUltIEFf1ZQKZqMFESsH0v-gzyJch X-Proofpoint-GUID: ie_dUltIEFf1ZQKZqMFESsH0v-gzyJch Content-Type: text/plain; charset="utf-8" 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 59326f84f6a5..d559d992c6ef 100644 --- a/fs/xfs/libxfs/xfs_alloc.c +++ b/fs/xfs/libxfs/xfs_alloc.c @@ -2524,14 +2524,23 @@ xfs_alloc_space_available( if (available < (int)max(args->total, alloc_len)) return false; =20 + 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 =3D available; + alloc_len =3D args->maxlen + (args->alignment - 1) + args->minalignslop; + if (longest < alloc_len) { + args->maxlen =3D args->minlen; ASSERT(args->maxlen > 0); - ASSERT(args->maxlen >=3D args->minlen); } =20 return true; --=20 2.31.1 From nobody Wed Oct 30 22:13:17 2024 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 B20D51EB4BF; Thu, 1 Aug 2024 16:31:56 +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=1722529919; cv=fail; b=R7tpIzgLbs+vCaVVCPKh/5rZ3cuAAGGrU0B2XJzH+h+RoOKFPPtV4i2ZJedjyOfz7Ej6fLYRsV32EMwUbSLmRd2NO8fDxAqbSseW4M1OyeDHQh5oPfB5DqxYhPkhVR9xi74MGrW5I8abaq83mIrecFA6PELeWSF1bqMWJHRQI3k= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722529919; c=relaxed/simple; bh=zWRDLuo/ILWanQJGpQZkcZulk/YZxcolQW3I7gFzbp8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=g1DfBDhTdDVWgpVypKhsSkM5BJ3l4bhP00TWLA2bhNFVbHkASROJWNeONGugtmte1FUsJECLStsFCyxNDZMiN3e/jhJGT0l6d/tN8uhT7PU4zFwaWFpaCoczYhJCkjXV2B2qPjzUSeskXovkjRt11aNMFHPERiTNiSP9cMr9Dao= 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=fmLJjKR9; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=l9jtzMJA; 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="fmLJjKR9"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="l9jtzMJA" 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 471FtX5b024065; Thu, 1 Aug 2024 16:31:43 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=/vGPOSgKv4rwY21roIrT4v81Jkb2+AWEDbk7Fux44jA=; b= fmLJjKR9M8nuO4jGmMmE/FqC7rkEBr6UgvqOZqaToD4Ujx85cu1GdZjuJ6xPaM6B Cqkm989m8QU5DMSgmbDlGPzisuZ9W+O7ATkrz7ElQ6BG0eXADdvaXmRHiF/JGjsS yImKbw/NYh6xY30QcGU2248Vc0i6no9SLpTl8cXeHboMtU+hEZpmxtMXhFN8phmH IIr03H42abF2r5HZXhHyBBd3uy2n5ez5KCm3pfPktveZA2jIBcLsHWpzZwEaTQLe mgoqbGLqsnfHGUXVWlS5Y6sy6tMetWzaRcNe5iX9eDl7//wl+QuIWLNyLfgX1dQX N8fy7NKb3ygxNmlnPi+n1g== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 40mrgsa65w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 01 Aug 2024 16:31:42 +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 471GO58k040207; Thu, 1 Aug 2024 16:31:41 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2048.outbound.protection.outlook.com [104.47.55.48]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 40pm866rh0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 01 Aug 2024 16:31:41 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=S8RHY5fxllzdghXyQw7Kn+UY5FyGXR/K4K6NnSi+jRd9G1XljiSSlCEWlyg2oa+XrhZi0htaDhSlQW/8YXDKU97+hz9c2UMuPOUB2pGQSJpI2dWaijo3MCZBlHi7EaWcbeFWylBTcXXZTx3EknMluacBI27fV+1Gkk6wgj7BMER7U079Hsi4NMey1WHwtfV/33AjSI4u0djIOiG7ywFA/dAxguZIgK34qU3D97Sd834xx3KC/PSj9AWbp31TcgQngcMIK7XDeSitk4z4DlrgjUx3YN07fYpx91l2QWNbxdWV+dD89OvWxEc3KYanHU3OPkciN4QOjwI/cubReDMmLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=/vGPOSgKv4rwY21roIrT4v81Jkb2+AWEDbk7Fux44jA=; b=QxUeSYzHvokoeR5/74zzY04Guvs+JZ1blEBoEKzyDe92/R/0NB6Kz5e1hNhT4N35k2JNGQa/BEZj9GG6ajcJYlq+I/9RzIXJ17tapKZywdnB9+o31Rzxmr0Ipo+KHqVhu7UHGUdy9Kt+WCbzenWLE2qj/JaE4DFbY9w0ZNyLV0wDhftdurH8aB1VucMwGfCbJYgc++xvMOVC9p9ArwQ5zfhDoPa4BcJzq0D2FKi8HpKBrNUzThcv6hMj+FNHgEfVe3rHjBUDYqxzZzEawAnATTvNd+JfbJRl/IYjoMOSDhO7Ppe9Rza2PHLC1r4qvJf5dHtxaqShRfNF8Jrfa2pibw== 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=/vGPOSgKv4rwY21roIrT4v81Jkb2+AWEDbk7Fux44jA=; b=l9jtzMJAiIz8M2KArdnXLaYKL/9BJawDJkEbfGBzpQLev3B+vvdLM5vUN+gq4DdjM9QdJJAS3gPQbEHMgH02ka54gv7rwVZZmGCDeYly69/a3Z/FmdZikm94EyYy1nz93EU6XK4O+OnJEliQ8emzRt9jWfjcDCro+mMdGWA5ChA= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by PH7PR10MB6081.namprd10.prod.outlook.com (2603:10b6:510:1fb::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7828.22; Thu, 1 Aug 2024 16:31:38 +0000 Received: from DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088]) by DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088%7]) with mapi id 15.20.7828.021; Thu, 1 Aug 2024 16:31:38 +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 v3 02/14] xfs: always tail align maxlen allocations Date: Thu, 1 Aug 2024 16:30:45 +0000 Message-Id: <20240801163057.3981192-3-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20240801163057.3981192-1-john.g.garry@oracle.com> References: <20240801163057.3981192-1-john.g.garry@oracle.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: BL0PR03CA0010.namprd03.prod.outlook.com (2603:10b6:208:2d::23) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|PH7PR10MB6081:EE_ X-MS-Office365-Filtering-Correlation-Id: b4fe2b78-b872-40b9-4d64-08dcb2476ace X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|366016; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?8eHZyMzFo/T1iCPY2WyckmvtdhvvjhBw+w4cNUe2fTSgorMHfHJ6iKRP6NAJ?= =?us-ascii?Q?KnKnMbWknaRS2g0FCG77wdSXBldRUo1nLXmzgRy0h1lKDL0U8eDDz2Ay1KfI?= =?us-ascii?Q?hp9cusMd2iS/3pn/pNboPDhSRQETxnwkDBR6L4T3Xb8JOdGPIM72s67SkrPw?= =?us-ascii?Q?QK6tcAUPf6MNx5/aJ4U6FNsW42pi5PNGSoqUhrTgDz/x0c+vJIBxcGRUjqPD?= =?us-ascii?Q?UO9liYbwydi8Fq938P2N8p0M1zKVaULG31ryL8QlZJdQNXt4IsLRqONwYNgm?= =?us-ascii?Q?VWjzocDpcZk/jBamm8tRHcfevqHyVE30aI18LAR/10VbTae82bnEXOad3H4U?= =?us-ascii?Q?Ai6YAGBuvbikmpLvcUZ6pJmX7hRcRdwDiNZODi1tF8DQjrikScIerh60TdsY?= =?us-ascii?Q?7PLNrgQeTmrqW0CC6Men2ctQ51dBHEbyRh/ywFJc9RZ5dXVN9qe6Zg/EoKAa?= =?us-ascii?Q?Nu4m3moaasRtCE7SP0MjnzzWsoG/LLMfw0DnuN5DosahH0Ux5hPvI8bz9uE6?= =?us-ascii?Q?djWsmaQSZcHHWyeYxMmOom4PANpHMSTxX5o5zTYwx1OtkRnn5SCs3DFoN99c?= =?us-ascii?Q?KmC6Mq6yv/aUHl44SX7kyzZIKElOnaTJN4ovyaulKzXxbvOd/Xaa+R4/mcUc?= =?us-ascii?Q?bE1nvRUssT122H3EHknHmLtl0iK24OmEDy+HBdgyRwtIoXbFcMZJtpdm+FXx?= =?us-ascii?Q?yCgBCDfm6TVWT8fqEOD6S1bA4O8ylScHowEeppbXJ1Bnx5eJl7Ufa8zbRQt5?= =?us-ascii?Q?upceHO7Uc8tn0eG+l3Y/dsf6DzRONwa28KTpgIQpD+hRsg0e3kTPeLe+mWMG?= =?us-ascii?Q?s2VweOubHmTMcRZCo9tNEKVXlr4a8BWdplF6t7taezlw9LVCIIy0+1cPoGfj?= =?us-ascii?Q?JbKp+/aTiatrV53n9Bs3a1hFCwzimPEbzNUVA0hpoob7Zr5MZ1R6wvysXVCT?= =?us-ascii?Q?ea7p04pEYrfwVETQd6YFsA8sMQ5MYDIW0ks8UCuQPsUcGiVsipQGKqpzXh/c?= =?us-ascii?Q?btZcFwy2x5pWqblJVzAUcyeYd2dKkJl0hzJP39sUd6TAolA0VGx6OYkcWsdY?= =?us-ascii?Q?330fabtX91jMOvwytVPpUR2ZIFrXlxAr3Pb0uFgI6li3SxFU5upkWX7r5XGm?= =?us-ascii?Q?AkYgisUdqpcDzUnhJ2V9pxNAXnERodeTDQs/U9rxa8wD9q0XyEnLP9fSjFXj?= =?us-ascii?Q?A/mTnv4PEo97YBlMZeQ+CpJs6evuAKYwnoWqauvjA7/EOBNSECxXKs4xUsP5?= =?us-ascii?Q?zazKHJ5TD9aGPffVBv4pxpv5KCT+ojAa3sNikjYS7hXXqvXzto5n3NRkJuof?= =?us-ascii?Q?9Z4kxRY0ro6y9hS//oUK0vxUGFWWEKf1jxu7bQD6SkgrQA=3D=3D?= 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:(13230040)(1800799024)(376014)(366016);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?FG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Im964lbr0XG2jGCx?= =?us-ascii?Q?nS4RkqyVs5AIGyHquYmRaIQXm//6KReDXwjfZdVO34QeaBLRjebHdNw/LCJq?= =?us-ascii?Q?5VBuGeevU71FG0z7ilwcDWMBvxaK6VDnZqdJ3jx5pgg66ghW1WTkqCurdd+Q?= =?us-ascii?Q?RhtPn6qstB1AkJUkciSWmlS0FDIK29IxjJFQa8baio/ZR4bsW02OWi3Wuvp1?= =?us-ascii?Q?Gvey5Ic7zu8qRek3+CuktGSxGOI/Em0ygB19dj5H5dsn+k3pJWrS34FihTbr?= =?us-ascii?Q?T7Md6EcTIXA6HlIsDT3j4CQj/Mm2h0r8eF/1wselC6NUV39zh/pvXVe7vhI6?= =?us-ascii?Q?sSemjpMab0gt3mTstEp8wcQ5MMAma8X4mSgCEAZrtzR4AzQWbowyoJz4GsFe?= =?us-ascii?Q?IAw7Po7pk5hMsrHbCiDh0n9cFHdotTbLiyN+1Ir7phUwIqVeCBEOLeYlTSP9?= =?us-ascii?Q?nrTAL6Zf73tXoD3SQ3ofOau+zHDl2froued4dy5iOPPDqRCSKTE11XjEe7ka?= =?us-ascii?Q?EtgQ1K+hw8AitxVSkHmP6vgA5qxAzA60b9KhT/nFCbbbxlbymcE9N8+jl+/W?= =?us-ascii?Q?4G5zYHFJbuW+9qi+b/DHxdiMlely3CrqjQcknaqkIKUaLanCM9PQJxsiMNzH?= =?us-ascii?Q?kiiPXKPfgy0TqTOygSg6Bjd3Pf+E5wv/jXh2+ZnqoemGBfzDpdwlg3gWWi1b?= =?us-ascii?Q?0PfE2LPZuGbi0oIr3X+7ZCcn5yRUXimbS4chnWSRtfLGSwpJNc8OzCvEKYyr?= =?us-ascii?Q?lQ=3D=3D?= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: PM8Gqw78kenARbMRbo8iAUQs7rSY3VX1/R6Zn9FRi/DMkQHfPZHJgE0xb2LCFN9t0WXJ5tMoFkJSJaDBRfcxI8QlZGKht14tZx6OMxGcAbCgGZOT5EoiFE9tCbL+WGmO5iAfHhqWjJ95oO0Kk7D+G80vEEhjiyouiqHF4cgV2H8DpIDAuPvlKVPv3Jl5561iDFf6LISTpFk521ocYY0k/tgGBOWI6rnakZD9tVhRl11cfS6Z7+8VhygKG1f93xBvl/SwU9Nx3AuIVf+2Ap9dHjWhtAqWxqupdbsj0VVOUbfc1LUmF7elHex5dHd1oTWTow5rCDTpRy92/7BtkyjTTC1Y6AD/VMp0kJ294OSIgLtebg6TgTalrG3Kesww+5o6Qo3Q9UEbzhA4xaSW2Re5ZWtVEvtC8ociXjhg6D5xYmgX22BTkEJU+v7dVKMI3eR8g4i7wRLLalajlXJO3tRMFevB2p+SLaMPq2mpYTbEhW/sviqtNJYDiO5jDBT7OlkKV08HEq4k+DrLIs5zKZQyluT8hlzR3yOgEwuLRCWEUY4Yrclr0zi2PyXQTYOTeWFeYDTaG/ZLGzsa3mfwQPcHOFcN19KsXK1Qp5me4kISNCg= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: b4fe2b78-b872-40b9-4d64-08dcb2476ace X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Aug 2024 16:31:38.5191 (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: Q9RMLUJzUD6nA2wKru8yyv/ZS7fO0WJUeuqc0rTWNdICuiD1TsCrc87PwolC5jYIOxwirMLj28X7J6arH9LScw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR10MB6081 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-08-01_15,2024-08-01_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 spamscore=0 mlxscore=0 suspectscore=0 phishscore=0 bulkscore=0 malwarescore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2407110000 definitions=main-2408010108 X-Proofpoint-GUID: LmTDpyI55qGTdGxH4FM03f5lr4QfTV-U X-Proofpoint-ORIG-GUID: LmTDpyI55qGTdGxH4FM03f5lr4QfTV-U Content-Type: text/plain; charset="utf-8" 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 be 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 Reviewed-by: "Darrick J. Wong" [provisional on v1 serie= s comment] Signed-off-by: John Garry --- 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 d559d992c6ef..bf08b9e9d9ac 100644 --- a/fs/xfs/libxfs/xfs_alloc.c +++ b/fs/xfs/libxfs/xfs_alloc.c @@ -433,20 +433,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 =3D args->len; =20 ASSERT(args->mod < args->prod); - rlen =3D args->len; ASSERT(rlen >=3D args->minlen); ASSERT(rlen <=3D args->maxlen); - if (args->prod <=3D 1 || rlen < args->mod || rlen =3D=3D args->maxlen || + if (args->prod <=3D 1 || rlen < args->mod || (args->mod =3D=3D 0 && rlen < args->prod)) return; k =3D rlen % args->prod; --=20 2.31.1 From nobody Wed Oct 30 22:13:17 2024 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 2F7B61B3F37; Thu, 1 Aug 2024 16:32:04 +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=1722529927; cv=fail; b=OYYHP2UesPaY5vosUtTvm7MyV80xvf2tHPfpbk4/VsTlIKTutzcEV7kYiDDogguof3ucSVM23Cew4XKHRSWJdh3cAKjjE2kw1GILgBgVTPRrQ/eWDDtJOM4tbn5YxDKzIRHepg3Wr6cTlj87/bshmzBcAdZcA55VNU9SQZtp7Is= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722529927; c=relaxed/simple; bh=kSm/J2GIcpkORW1LRJoOmfjleQFS3zsoEn/U5zUFaTU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=NR8m0bKlz2TYmuwLH1I0OanW7YhypmGvcsAN8oqb+jt0Q9m5Zz8jTEoEA6cDqPqNj3vMkVbj4HMnfpizEXgBcTPYDwZK5nluFAEGltxd4B4beJHdAmx+rOEnykOdD5pINp6Y3BqrC71LxJ+2V2iWDByPFvsdG0sQ6WhN+u8Uz4A= 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=Jt9DlyIY; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=VglVvXki; 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="Jt9DlyIY"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="VglVvXki" 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 471FtV8j028570; Thu, 1 Aug 2024 16:31:46 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=lco7Ffv3l0/S/vyZtdQ3L34JKK2e6B3Aej8RGg51LUA=; b= Jt9DlyIY3RJ4XUXzKRi6hG4nZ+LvOwN0VvW/QtxHXHIAha+pvCGwo1LAhZtSgn0e oXlI+kjpXPo1rRtmFRI855YaYueyiLGXE3HT9PXkAsaJrFV/0xS743EtKBumBclt EnKZkVsX7Jn3ECPgrvJ5126BHTwa0DTEj39+aI7LutZhHRuzVJSja2juNh6Hcqv4 /IpJvnzDzTd9UdBJRw9Z3GH7kKsTI2XvELyegG7r9giX7Ru4nDw2u9WEjdiJDVWA T1yy3XSWgltXirhWg9qoDgIY8PtrpGFn8n2viL0T1bHx11Fo8a/cmAwpQZcB1QrS ztydNz3Cy1I9ov2B9OAD2w== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 40mqfyj777-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 01 Aug 2024 16:31:46 +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 471G30Kw040303; Thu, 1 Aug 2024 16:31:45 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2168.outbound.protection.outlook.com [104.47.57.168]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 40pm866rjd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 01 Aug 2024 16:31:45 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=LTIlG+YFrseOKOkZLqmook7J+6Zk9phleUEIn8AunQNwBNkWuBCzOQpJPWV9lyVuIXfyTUXqqmWNEtAkjI1Z/NSGFAozwbj4ca2fC4WbJ1dZOGHzvoY4UyyaVznbqDgwOyASd7luJxfArrcrQ+4tQEvmb9cFbv8eXxErt/4pXGNgvJyJlFFaDOxHnPxA867zUYpL6IL3p4DYAcQpGk6aet84aTk4lC3xDeyV3AAAA5rBRIXVE1WCXzvjQFdjDP1PikqxTrGW0FbwhZmX+CJUR0c02ndbSYMeRi4FAQQ8Y8xPaw6thykWxF1hGzX413gn4cZ5Pq13Gfl152gdr1DTnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=lco7Ffv3l0/S/vyZtdQ3L34JKK2e6B3Aej8RGg51LUA=; b=GifLt89req6w/WsoRQJnZOcpFZJe1z/HLDopByINmrseW4IB8A4n0/xpFO+TUewu8YeoAMdzkHowlDO+FJcloBAH0PCrcNyM2B2NHBBG7xX6U5CmcKqywC5fGh3EzR2xEubyiPAKtWh8SF75ZPVYcoWWSBwnOZHQxlA6w/911yQjZamTa6FLg7j8uTA/XimSYGJ9zlhPl/T48geLmr3/j/j4MwjRT1VOXVBCPEuSp7Bi7QtcjF2ISMD96yAiYwjMG/5txgnyx+jmGdwncTZVuw7riuxaGtX7h199tBY+Z2rEeQ8F9tZQgsJlZRjGPBswyCd9doq+/pOHL0hgFaCTkw== 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=lco7Ffv3l0/S/vyZtdQ3L34JKK2e6B3Aej8RGg51LUA=; b=VglVvXkiAXOK76A7Myau/49a37OJQeOK5kb1CgNNXXYhqJuveTSg+fml+U8HhOq2cMIYm2jZguNxMXuiPYnzm3jrYy0UsACkFkwwLf6W0Mm/T4bSZioXlpHChPjkO3KuWEOw4qpj3335MP43MJr/DjfmKgju0q5Kkn8bx2ymlJo= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by PH7PR10MB6081.namprd10.prod.outlook.com (2603:10b6:510:1fb::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7828.22; Thu, 1 Aug 2024 16:31:40 +0000 Received: from DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088]) by DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088%7]) with mapi id 15.20.7828.021; Thu, 1 Aug 2024 16:31:40 +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 v3 03/14] xfs: simplify extent allocation alignment Date: Thu, 1 Aug 2024 16:30:46 +0000 Message-Id: <20240801163057.3981192-4-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20240801163057.3981192-1-john.g.garry@oracle.com> References: <20240801163057.3981192-1-john.g.garry@oracle.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: BL1PR13CA0341.namprd13.prod.outlook.com (2603:10b6:208:2c6::16) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|PH7PR10MB6081:EE_ X-MS-Office365-Filtering-Correlation-Id: 18581e63-ed45-4182-ffb3-08dcb2476bb1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|366016; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?qnxk5XAHjKbFGxbgb7IrB9dD7ZovTCHFl5aLixLC83K05C0FGeX+TzcRPS2c?= =?us-ascii?Q?m1bcon0yCL61qRuksQ2NNf1Emr/ZUwk/oLFbLZktMASUTvhjmJQVfc+Q6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A2ONHwSIDW2HmB1EUPyetTY/+fMQrM7z7kjRuOFodyBS?= =?us-ascii?Q?rXwoa4UZMsAT3WGAbbG6taIOGMWUnRfnXQdWJQsp/WreUQxi6W10B62TyDgE?= =?us-ascii?Q?NGvd1ddtqyIvqd7uDJJjrK+nqXJyAzumpUSk7tl8Rr2bJCLKHgaya6o9Um+D?= =?us-ascii?Q?Yd0+BbWuXTnhlVXjCAnobM/LbKloEh9sk2oysvqpjSOA/QPt5uSUnRJw9bRm?= =?us-ascii?Q?kFg1qmA2dsJC0aunY1qu6uAbkaelUT5Fhiux0aCdyLdRMrqGGTGO2JUlU32a?= =?us-ascii?Q?2aUdjwj/u4RIh15vN94JxOw4fkvY7adHk30LwvUFiKiAfsYCp0uSoLusIOrD?= =?us-ascii?Q?ENaEtzFtRuXVbQGWE+Y178hnQ+MbqPLGU22axo2Ay7dv3Q=3D=3D?= 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:(13230040)(1800799024)(376014)(366016);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?Mk8iANh+hHIiSiKdMDkZp8fjj0DwuAXd0SxPrKKd1zCHWX9/lyndtwg3Atv+?= =?us-ascii?Q?YwfS7Hq+8vpPokLonGngNTjWJ/wULWLwhXJ+7pGLbyk+N2hyhi7PzgZwPTC2?= =?us-ascii?Q?M7FOhP8xtYOjDbnMybdncRcqwiMgvJ8ey2eCeQnCCnYYaC+qcKMiwRGUhyEY?= =?us-ascii?Q?cLSk9XUiiKT1ZHab4SUyVBXdaJAQtQZXSzAhN/CZ41okFLx9v3uD6KE4s+zf?= =?us-ascii?Q?sXvaxrgml1RfCX795nQ5RHEodCBKY89SKOQtkrQ+1zPqpr6BTkQGDIt50zk7?= =?us-ascii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qtF4/iRRI7zWodNOc8CIKVa?= =?us-ascii?Q?STJkVAZ8rOtVYKoGaaDwWO+pewLhRsUIp5NO/36n9tBeu7C5oUzm98nLWXtL?= =?us-ascii?Q?3o4Z4x0TzCoFufYHKlMdZx4LkBhfIruTPnXn5ttVuCh6LAldgPI6Rfjicejd?= =?us-ascii?Q?7CyChhQGgJjSpJ3JPK5KLnzKvzp80BSq/62Yk0inX4JK4I6sUs2yaITFsc/c?= =?us-ascii?Q?yjPS/yekBG/YYNuMTuENIqM37NQt3nTqCP15fyKCBk9WfD33QEObs2H4EP52?= =?us-ascii?Q?YKyKDGfw/0fgSobrpYcgjZDhDk+3PMnxQuh2oNiVi7KXgqFP8e/qM3kwNuGZ?= =?us-ascii?Q?gXIBuw6ZtAO1cH+sOjxiMX6VOT0C+eX52IzqY100k4TwPYKngHkwI+KsWiPs?= =?us-ascii?Q?/qeY0FMKpsO7AWShu+pjbF0bZV2iW8qECf7w/bYjJrMtLp8jy6yA5gtdy41v?= =?us-ascii?Q?Rg=3D=3D?= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: avciFrSVzrwOepsi3uUWhl9Wy1vco54QdbAVtzE2tEK/GHAylzY6HA2wM402qalFEe8ugvr2UvozRledyxgpEVU/NUmR4OzG4FXms4lgcubzaT8ydotpsBAfs+X0F57LLMQs0gQ0gj2nrANQWayE8/VzVPuJCHFWooGPTcmTTTYIbmWSJh1nQc+xgliqNZdzRUw/7uXsmblcNVpiz/PsY0jP1Xyvi+SLqyxo+S5LIxV7lb87jA0pgRWoaTiL0ubITj8olSWPRkGG/NCjTE3jcdMH30QMI+1Hn2HH4r+07AHk6QMbwcltgBvFCBF2NOdMP6AhubKc+nYxGy5oMCwnA1F14B1ouEe9vfO4qXFV1iwOhp5F6u5mdvQkJnmjQ5SwxbJXS+Z7IKFoOyb04S99nPX2COh4oLpTju6p6VkxjGbwaY/ux1tD4dB+m8w006KyQixgqE5UKNByhI2t3Gk98IpVySEBijxhHJstZ4qyTT5hDEaUzgajq4ZqpeRXhz+n9aYc6S0JcPu5jpcViWl1uirvmemmbrAYJKRLubgRzAGH51vWEpaRIUWqJZq9VOx3b5AtDk+Xjln5iHQnTps3oyJDbbsNc1WYR7xaNzw/cCs= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 18581e63-ed45-4182-ffb3-08dcb2476bb1 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Aug 2024 16:31:40.1862 (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: fcm1jU7Zsi8Qat4rM2ySHw0sUMqyof31rpu3zxUqU3fm3ZSBtkorK8uzHyJmTR7cf6srrE+WomGM07TLgHp3cw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR10MB6081 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-08-01_15,2024-08-01_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 spamscore=0 mlxscore=0 suspectscore=0 phishscore=0 bulkscore=0 malwarescore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2407110000 definitions=main-2408010108 X-Proofpoint-GUID: ATuZYtKiQci8Ufk6aZfpjxdFKBTxqWiq X-Proofpoint-ORIG-GUID: ATuZYtKiQci8Ufk6aZfpjxdFKBTxqWiq Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Darrick J. Wong --- fs/xfs/libxfs/xfs_alloc.c | 4 +- fs/xfs/libxfs/xfs_alloc.h | 2 +- fs/xfs/libxfs/xfs_bmap.c | 95 ++++++++++++++++---------------------- fs/xfs/libxfs/xfs_ialloc.c | 10 ++-- fs/xfs/xfs_trace.h | 8 ++-- 5 files changed, 53 insertions(+), 66 deletions(-) diff --git a/fs/xfs/libxfs/xfs_alloc.c b/fs/xfs/libxfs/xfs_alloc.c index bf08b9e9d9ac..a9ab7d71c558 100644 --- a/fs/xfs/libxfs/xfs_alloc.c +++ b/fs/xfs/libxfs/xfs_alloc.c @@ -2506,7 +2506,7 @@ xfs_alloc_space_available( reservation =3D xfs_ag_resv_needed(pag, args->resv); =20 /* do we have enough contiguous free space for the allocation? */ - alloc_len =3D args->minlen + (args->alignment - 1) + args->minalignslop; + alloc_len =3D args->minlen + (args->alignment - 1) + args->alignslop; longest =3D xfs_alloc_longest_free_extent(pag, min_free, reservation); if (longest < alloc_len) return false; @@ -2535,7 +2535,7 @@ xfs_alloc_space_available( * allocation as we know that will definitely succeed and match the * callers alignment constraints. */ - alloc_len =3D args->maxlen + (args->alignment - 1) + args->minalignslop; + alloc_len =3D args->maxlen + (args->alignment - 1) + args->alignslop; if (longest < alloc_len) { args->maxlen =3D args->minlen; ASSERT(args->maxlen > 0); diff --git a/fs/xfs/libxfs/xfs_alloc.h b/fs/xfs/libxfs/xfs_alloc.h index fae170825be0..473822a5d4e9 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 7df74c35d9f9..25a87e1154bb 100644 --- a/fs/xfs/libxfs/xfs_bmap.c +++ b/fs/xfs/libxfs/xfs_bmap.c @@ -3286,6 +3286,10 @@ xfs_bmap_select_minlen( xfs_extlen_t blen) { =20 + /* Adjust best length for extent start alignment. */ + if (blen > args->alignment) + blen -=3D 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. @@ -3394,35 +3398,43 @@ xfs_bmap_alloc_account( xfs_trans_mod_dquot_byino(ap->tp, ap->ip, fld, ap->length); } =20 -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 determin= ed 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 va= lues + * as required. + */ +static void xfs_bmap_compute_alignments( struct xfs_bmalloca *ap, struct xfs_alloc_arg *args) { struct xfs_mount *mp =3D args->mp; xfs_extlen_t align =3D 0; /* minimum allocation alignment */ - int stripe_align =3D 0; =20 /* stripe alignment for allocation is determined by mount parameters */ if (mp->m_swidth && xfs_has_swalloc(mp)) - stripe_align =3D mp->m_swidth; + args->alignment =3D mp->m_swidth; else if (mp->m_dalign) - stripe_align =3D mp->m_dalign; + args->alignment =3D mp->m_dalign; =20 if (ap->flags & XFS_BMAPI_COWFORK) align =3D xfs_get_cowextsz_hint(ap->ip); else if (ap->datatype & XFS_ALLOC_USERDATA) align =3D 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); - } =20 - /* apply extent size hints if obtained earlier */ - if (align) { args->prod =3D align; div_u64_rem(ap->offset, args->prod, &args->mod); if (args->mod) @@ -3437,7 +3449,6 @@ xfs_bmap_compute_alignments( args->mod =3D args->prod - args->mod; } =20 - return stripe_align; } =20 static void @@ -3509,7 +3520,7 @@ xfs_bmap_exact_minlen_extent_alloc( args.total =3D ap->total; =20 args.alignment =3D 1; - args.minalignslop =3D 0; + args.alignslop =3D 0; =20 args.minleft =3D ap->minleft; args.wasdel =3D ap->wasdel; @@ -3549,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 =3D args->mp; @@ -3563,23 +3573,15 @@ xfs_bmap_btalloc_at_eof( * allocation. */ if (ap->offset) { - xfs_extlen_t nextminlen =3D 0; + xfs_extlen_t alignment =3D args->alignment; =20 /* - * 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 alignment space required by the + * fallback paths before we modify the AGF and AGFL here. */ args->alignment =3D 1; - if (blen > stripe_align && blen <=3D args->maxlen) - nextminlen =3D blen - stripe_align; - else - nextminlen =3D args->minlen; - if (nextminlen + stripe_align > args->minlen + 1) - args->minalignslop =3D nextminlen + stripe_align - - args->minlen - 1; - else - args->minalignslop =3D 0; + args->alignslop =3D alignment - args->alignment; =20 if (!caller_pag) args->pag =3D xfs_perag_get(mp, XFS_FSB_TO_AGNO(mp, ap->blkno)); @@ -3597,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 =3D stripe_align; - args->minlen =3D nextminlen; - args->minalignslop =3D 0; - } else { - /* - * Adjust minlen to try and preserve alignment if we - * can't guarantee an aligned maxlen extent. - */ - args->alignment =3D stripe_align; - if (blen > args->alignment && - blen <=3D args->maxlen + args->alignment) - args->minlen =3D blen - args->alignment; - args->minalignslop =3D 0; + args->alignment =3D alignment; + args->alignslop =3D 0; } =20 if (ag_only) { @@ -3627,9 +3618,8 @@ xfs_bmap_btalloc_at_eof( return 0; =20 /* - * 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 =3D 1; return 0; @@ -3637,7 +3627,9 @@ xfs_bmap_btalloc_at_eof( =20 /* * We have failed multiple allocation attempts so now are in a low space - * allocation situation. Try a locality first full filesystem minimum leng= th + * allocation situation. We give up on any attempt at aligned allocation h= ere. + * + * Try a locality first full filesystem minimum length * allocation whilst still maintaining necessary total block reservation * requirements. * @@ -3654,6 +3646,7 @@ xfs_bmap_btalloc_low_space( { int error; =20 + args->alignment =3D 1; if (args->minlen > ap->minlen) { args->minlen =3D ap->minlen; error =3D xfs_alloc_vextent_start_ag(args, ap->blkno); @@ -3673,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 =3D 0; int error =3D 0; =20 - error =3D xfs_filestream_select_ag(ap, args, &blen); if (error) return error; @@ -3698,8 +3689,7 @@ xfs_bmap_btalloc_filestreams( =20 args->minlen =3D xfs_bmap_select_minlen(ap, args, blen); if (ap->aeof) - error =3D xfs_bmap_btalloc_at_eof(ap, args, blen, stripe_align, - true); + error =3D xfs_bmap_btalloc_at_eof(ap, args, blen, true); =20 if (!error && args->fsbno =3D=3D NULLFSBLOCK) error =3D xfs_alloc_vextent_near_bno(args, ap->blkno); @@ -3723,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 =3D 0; int error; @@ -3748,8 +3737,7 @@ xfs_bmap_btalloc_best_length( * trying. */ if (ap->aeof && !(ap->tp->t_flags & XFS_TRANS_LOWMODE)) { - error =3D xfs_bmap_btalloc_at_eof(ap, args, blen, stripe_align, - false); + error =3D xfs_bmap_btalloc_at_eof(ap, args, blen, false); if (error || args->fsbno !=3D NULLFSBLOCK) return error; } @@ -3776,27 +3764,26 @@ xfs_bmap_btalloc( .resv =3D XFS_AG_RESV_NONE, .datatype =3D ap->datatype, .alignment =3D 1, - .minalignslop =3D 0, + .alignslop =3D 0, }; xfs_fileoff_t orig_offset; xfs_extlen_t orig_length; int error; - int stripe_align; =20 ASSERT(ap->length); orig_offset =3D ap->offset; orig_length =3D ap->length; =20 - stripe_align =3D xfs_bmap_compute_alignments(ap, &args); + xfs_bmap_compute_alignments(ap, &args); =20 /* Trim the allocation back to the maximum an AG can fit. */ args.maxlen =3D min(ap->length, mp->m_ag_max_usable); =20 if ((ap->datatype & XFS_ALLOC_USERDATA) && xfs_inode_is_filestream(ap->ip)) - error =3D xfs_bmap_btalloc_filestreams(ap, &args, stripe_align); + error =3D xfs_bmap_btalloc_filestreams(ap, &args); else - error =3D xfs_bmap_btalloc_best_length(ap, &args, stripe_align); + error =3D xfs_bmap_btalloc_best_length(ap, &args); if (error) return error; =20 diff --git a/fs/xfs/libxfs/xfs_ialloc.c b/fs/xfs/libxfs/xfs_ialloc.c index 0af5b7a33d05..2fa29d2f004e 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 =3D 1; - args.minalignslop =3D igeo->cluster_align - 1; + args.alignslop =3D igeo->cluster_align - 1; =20 /* Allow space for the inode btree to split. */ args.minleft =3D 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 =3D 0; + args.alignslop =3D 0; } =20 if (unlikely(args.fsbno =3D=3D NULLFSBLOCK)) { diff --git a/fs/xfs/xfs_trace.h b/fs/xfs/xfs_trace.h index 5646d300b286..fb0c46d9a6d9 100644 --- a/fs/xfs/xfs_trace.h +++ b/fs/xfs/xfs_trace.h @@ -1811,7 +1811,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) @@ -1830,7 +1830,7 @@ DECLARE_EVENT_CLASS(xfs_alloc_class, __entry->minleft =3D args->minleft; __entry->total =3D args->total; __entry->alignment =3D args->alignment; - __entry->minalignslop =3D args->minalignslop; + __entry->alignslop =3D args->alignslop; __entry->len =3D args->len; __entry->wasdel =3D args->wasdel; __entry->wasfromfl =3D args->wasfromfl; @@ -1839,7 +1839,7 @@ DECLARE_EVENT_CLASS(xfs_alloc_class, __entry->highest_agno =3D 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), @@ -1852,7 +1852,7 @@ DECLARE_EVENT_CLASS(xfs_alloc_class, __entry->minleft, __entry->total, __entry->alignment, - __entry->minalignslop, + __entry->alignslop, __entry->len, __entry->wasdel, __entry->wasfromfl, --=20 2.31.1 From nobody Wed Oct 30 22:13:17 2024 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 063581BB686; Thu, 1 Aug 2024 16:32:03 +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=1722529925; cv=fail; b=MlDwt5JXB8zTl/Fg1Z2F40MXbkEEOrgIqEBcE8J1uu+f1PQ8TmJTiYdEmnXrMUVPVZwPZ8KrEsVckGHIETM0SaAwAX4nVochv7Mev+ZdztMfytaHvEqpisv/+fIOksDrZVM/J7K1Np8okAcqoKlUtJitN9l4u9ZARok6AJX/r5g= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722529925; c=relaxed/simple; bh=c8gojaNtQGaRgutvm42uCgJqO5Qhcwrfzgld/BMcKhc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=X+rZyUy5gW6ToMhu7WZOuGwkAHXVs1WSNsit0Rd/+uhog2HOROLziz51KBd67Vzw6XxHhoiQDpJGCHfqIk/UA10ZT5zjp5F1mz5MGCIXwqLOZ0DYMNGMfSx9rqdfSl2BE0sRxaCIeX8MXbRTCytwO7x55gYyywBagWvnNMfl9No= 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=WRmqYxHe; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=OzmniJQp; 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="WRmqYxHe"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="OzmniJQp" 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 471FtV8k028570; Thu, 1 Aug 2024 16:31:48 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=mfT8Q94CDIpjJ9DeddZlavq3BAlepPIDJNWQ+avK3tM=; b= WRmqYxHe5sCtYVSmrnGZlqOkbhndGbf845tclzGya6m//eMJdvkJfBvdHQ9Vfb0c PHjBod+9miBulXUJH0FLAITJIOJL1Tfs3vAcz27HNmpSm4UBpUnjQ+juJDovLNWK S8Ckdve9cEP+as8wU/+kDFtRk/a0P0G1ImuM6BURkoe/UktdwAbc41ku++m5DJ7N fdHdUPBZc5gu25D8u7o5AHQiV+N7o9jssGAWz5u0BM3dXjCNuuVi1c/ZglzgnloN j/KEwxUNGIWq/BdqXmOSmKDV7IGRB39nqF0M/ReS9cxQTL/Nc2vY9v19mseNnzOq Cx3r5K6Vpxw3uJHDIktTZQ== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 40mqfyj779-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 01 Aug 2024 16:31:48 +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 471Fe9Hg036902; Thu, 1 Aug 2024 16:31:47 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2168.outbound.protection.outlook.com [104.47.57.168]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 40nvp0es54-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 01 Aug 2024 16:31:47 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=t26tKcVDsDYGmnh1D0EXikIfI0zeooubdSBdZifjbo4tXe+UGRfVHkXSpRp1gX2T7e/yANuIwLEo3pNnJ0rKPoqRyz1iKtdU0I4AjZZDr7ayBO8MFQoO0xZYqxswYM0pBBHpPRdaGxWXx728XDfmXCf50WOremm0+C2uojsqkOjq09c3QwNiIIg/3WexlwIJxSBExhAtUbC50WPwyprVEmKjIppu+iHZVbFokzHNGR2UstFF1BmCHu8jbc/fWL7aubL+Lq0OqTVSff13UyS8ARzkiKDIu73zFLnqlBLnzrQ+VkzPpwYj5wwJrcQfO5SkYtFW/bqMBKvRRNdvcuNJNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=mfT8Q94CDIpjJ9DeddZlavq3BAlepPIDJNWQ+avK3tM=; b=kq7i/aDrzhgeD1bxEafohueyWzLHMgkhTpYiWMG/iaenNFk08LOwWFYflPtzji3uVbVZGita/9DaaVbGXsHxesv42sv6pV4pLrx1HhTG+8BXvEJNMm4fsezcI/pi/LM7U6TH9g2hTf7l6tEywtTzk9PVSW0qF+ZzSerZYNsUPAoeYaBikNZD5sv/HwKUh7imeJrMvr9/p2BTq5KC2TclDc69AXbEGtkO67Ij7L5p5Fav0EtKe8H6kb4LuX91jy9UybLNNpW//FNSk08rmKDw6tElcnce5fCHqZLoPk6goIyTKU2TL7I5wIsR7f6P+Zv/gD17QzvrMblCpa1U8B9Snw== 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=mfT8Q94CDIpjJ9DeddZlavq3BAlepPIDJNWQ+avK3tM=; b=OzmniJQpuEkLvrcCOcRC2H8lBLdtUIT4ypKA3fw2km6EqmQuSAOkTrLKh0tiAOVvxz7rCBh0lnj5iTD8lbJmrBheVYfsv6f8uUgNCkmJVY3zWwXb/LUcozSFFOM0jYg9Wr4kdrAd8PX+Gi9M0DqkkSM8m4OQR9NsVjHU6ss5EKw= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by PH7PR10MB6081.namprd10.prod.outlook.com (2603:10b6:510:1fb::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7828.22; Thu, 1 Aug 2024 16:31:42 +0000 Received: from DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088]) by DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088%7]) with mapi id 15.20.7828.021; Thu, 1 Aug 2024 16:31:42 +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 v3 04/14] xfs: make EOF allocation simpler Date: Thu, 1 Aug 2024 16:30:47 +0000 Message-Id: <20240801163057.3981192-5-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20240801163057.3981192-1-john.g.garry@oracle.com> References: <20240801163057.3981192-1-john.g.garry@oracle.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: BL0PR03CA0035.namprd03.prod.outlook.com (2603:10b6:208:2d::48) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|PH7PR10MB6081:EE_ X-MS-Office365-Filtering-Correlation-Id: d942695a-1d8b-45a2-ca52-08dcb2476cec X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|366016; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?6BbZ0tYR1Qi0n49cmc2sPUZHSbh96g9mHKSXAMKp9W0Rd5cXxd2AIgWZ6eD7?= =?us-ascii?Q?gGzdHGnGW04F94CZgPLxDuTACoo4g+CM7+E0YcWmDbwA6KGXMwBDsdXPkNzf?= =?us-ascii?Q?u5zIn1XJUdupmsjwwMn+HVjavonpsjHlpaEuaFAyWXQubumtT1+DPRayycp3?= =?us-ascii?Q?In/UG3IaVRbnpAdmqwrnhMySjNZDrkv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gX+lA5iy4oCTKjgRGxD+0TYtb3TezcLc6TH9/oRA3RogUufZG/D5DrmO?= =?us-ascii?Q?gp7nkaVXZYlmP1F6evHOkXYyLKs/zucnzij3vCli/+lhjw80fMLqQSYZFEZC?= =?us-ascii?Q?BwpAw7Lfzil0M2jv13kFSkiPOFlUFHdCNWkSclM54x8m/613zQCVbafbVqJw?= =?us-ascii?Q?n0fHi+Fg00gSrywGT3DEP0zN4FmAxZO0mIFpcjtCdiaxXweAs5TdsnEz/6aY?= =?us-ascii?Q?pQ60V8uDYZKekj2vGyx66l4UcSOBgArnGTBGvIHCaudZpA=3D=3D?= 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:(13230040)(1800799024)(376014)(366016);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?UV1T+/DiMAuyCQg+sftiN5LJ06ByEWRbwlJVKM1hMuVzXgML1nWNZCtrYTPt?= =?us-ascii?Q?Rk4NmobyAD2hxw4ZLjHOpngSxNZLkqPamNIv0xdBVw1t+hQvs7DMvVTp+pFv?= =?us-ascii?Q?4KyF3IVaHJJU5ECgFLfb8AH9x/JrgCOVn8keFVQvYB4iQiY0RCVgPHP6q1T3?= =?us-ascii?Q?DgJErU/XS65ytpTjHeaN9nYlPT+7T/hzSK9PluJqceFeSHritK0ZQl3Xr5EQ?= =?us-ascii?Q?GXQ0kZfPrWJRJoy46qLa+2P6RJt4OYcjkC0SmKicduVgJ6n0LuidYgzb/5fU?= =?us-ascii?Q?jO3IxQdmk06TlcqDd+v790MvP/V/qvtbvTZ+FKTjeWrtWas9f2rDIOjxsu+g?= =?us-ascii?Q?NB0tmGxFXAOEP/8+mItgKXblxPbMq8Qpf5p8a3TenTXabSsxZbhcA2a3Si3P?= =?us-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1/NGieWefbju8tr933?= =?us-ascii?Q?PyXuTcNxaU9NMGmGWOQ7iswcFZcDDHqz1OsCYgUh1+F9TY1+Nl+BGtqODwqD?= =?us-ascii?Q?G/tSH6Xr5BKfZnAxa5bHfUmDhNKH58O6/TK6iNWVfuTtMfXEnUJYAvttSJvA?= =?us-ascii?Q?Dpx3OU9PHxU/CsUPGVlp31QJa0nofS1qpv83cYRghvLnV8aaRUkJCZYO/8Xq?= =?us-ascii?Q?RUrv/YcV8HNanQ1dqKsrhx+Rm+Boe3qS0qrjDnzZQwiw8Rx8DH2rJ2ybuSaV?= =?us-ascii?Q?YAkD6Jd/ndZyavRHOMDF7OgW3zSusc85xmCTA7qZSTR7AkFNpbKSEFAX8AUO?= =?us-ascii?Q?Og=3D=3D?= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: hW5t044uH7eANYE81PvbwcPeFUCBEhcEU288ygip7g4/FT5+rp+qLIlWWraj+P+cypHpjZt/bGRRH3wJhigGZBRjPKRvmHRGzSP1lGM2NlOzf+i621jC0lo5iHxJArXAlRVpD8W4jCJCL5lOhJCZeZ2c91QeNZ+ZnD257PiqgPB3IORC3Q/A22hpz/ealkvKHJ9cZoUmpBie9NxfVimMPVN7AF6ApEk2kDknKopyk4orHmSDD7p45vuJhs2IALHe/720Lm+SUC5z7HZi67uihk+gXqmN1ULmm7UAfMmqgBY9/1XsqfyvEn2R3PeRHbsQkqDDRWRx2V0V1uC+KneYYUdeiLT+qgMysW1H6VhFrmnFPSgKKrOuh7ADt29DRPiydG2WazX3hqsYS95S8U/kd5IyJ1KI2vhztNG9K9ptxnNImAA3AoVAVBESO4Q2lQJx4BPqKYMBg85BNmUzz636d6cZGnXpgRsgWDc3du/IInNyfpTj+KCQJvcrzabD7xm+GlVQHxqheMR4Cj235RO9OOZuxz/oziopv2FOMeV1buQEg1dfE67sVhNKGFG+58+sgz3rpJIrb9/2r/A9nYI9TiFhAi3BdgSNsXWRY54/zZE= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: d942695a-1d8b-45a2-ca52-08dcb2476cec X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Aug 2024 16:31:42.2147 (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: qXV33Ad7m2MMMIJ/+/PPh6g5r4hWHRMvbqN4+TxurPYokMBrLXgtRArbz1IzmoO3M7dscSGnOfyibPPUpYPZKQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR10MB6081 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-08-01_15,2024-08-01_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 adultscore=0 mlxlogscore=999 mlxscore=0 suspectscore=0 malwarescore=0 bulkscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2407110000 definitions=main-2408010108 X-Proofpoint-GUID: QaA0oiZVGOYFqmrqbHmqxoCKznQfT-c- X-Proofpoint-ORIG-GUID: QaA0oiZVGOYFqmrqbHmqxoCKznQfT-c- Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Darrick J. Wong --- 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 25a87e1154bb..42a75d257b35 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 =3D args->mp; struct xfs_perag *pag; xfs_agnumber_t agno, startag; + xfs_extlen_t blen =3D 0; int error =3D 0; =20 if (ap->tp->t_flags & XFS_TRANS_LOWMODE) { @@ -3329,19 +3329,18 @@ xfs_bmap_btalloc_select_lengths( if (startag =3D=3D NULLAGNUMBER) startag =3D 0; =20 - *blen =3D 0; for_each_perag_wrap(mp, startag, agno, pag) { - error =3D xfs_bmap_longest_free_extent(pag, args->tp, blen); + error =3D xfs_bmap_longest_free_extent(pag, args->tp, &blen); if (error && error !=3D -EAGAIN) break; error =3D 0; - if (*blen >=3D args->maxlen) + if (blen >=3D args->maxlen) break; } if (pag) xfs_perag_rele(pag); =20 - args->minlen =3D xfs_bmap_select_minlen(ap, args, *blen); + args->minlen =3D xfs_bmap_select_minlen(ap, args, blen); return error; } =20 @@ -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 >=3D 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 =3D args->mp; struct xfs_perag *caller_pag =3D args->pag; + xfs_extlen_t alignment =3D args->alignment; int error; =20 + ASSERT(ap->aeof && ap->offset); + ASSERT(args->alignment >=3D 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 =3D args->alignment; - - /* - * Compute the alignment slop for the fallback path so we ensure - * we account for the potential alignment space required by the - * fallback paths before we modify the AGF and AGFL here. - */ - args->alignment =3D 1; - args->alignslop =3D alignment - args->alignment; - - if (!caller_pag) - args->pag =3D xfs_perag_get(mp, XFS_FSB_TO_AGNO(mp, ap->blkno)); - error =3D xfs_alloc_vextent_exact_bno(args, ap->blkno); - if (!caller_pag) { - xfs_perag_put(args->pag); - args->pag =3D NULL; - } - if (error) - return error; - - if (args->fsbno !=3D NULLFSBLOCK) - return 0; - /* - * Exact allocation failed. Reset to try an aligned allocation - * according to the original allocation specification. - */ - args->alignment =3D alignment; - args->alignslop =3D 0; - } + args->alignment =3D 1; + args->alignslop =3D alignment - args->alignment; =20 - if (ag_only) { - error =3D xfs_alloc_vextent_near_bno(args, ap->blkno); - } else { + if (!caller_pag) + args->pag =3D xfs_perag_get(mp, XFS_FSB_TO_AGNO(mp, ap->blkno)); + error =3D xfs_alloc_vextent_exact_bno(args, ap->blkno); + if (!caller_pag) { + xfs_perag_put(args->pag); args->pag =3D NULL; - error =3D xfs_alloc_vextent_start_ag(args, ap->blkno); - ASSERT(args->pag =3D=3D NULL); - args->pag =3D caller_pag; } - if (error) - return error; =20 - if (args->fsbno !=3D 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 =3D 1; - return 0; + /* Reset alignment to original specifications. */ + args->alignment =3D alignment; + args->alignslop =3D 0; + return error; } =20 /* @@ -3688,12 +3649,19 @@ xfs_bmap_btalloc_filestreams( } =20 args->minlen =3D xfs_bmap_select_minlen(ap, args, blen); - if (ap->aeof) - error =3D xfs_bmap_btalloc_at_eof(ap, args, blen, true); + if (ap->aeof && ap->offset) + error =3D xfs_bmap_btalloc_at_eof(ap, args); =20 + /* This may be an aligned allocation attempt. */ if (!error && args->fsbno =3D=3D NULLFSBLOCK) error =3D xfs_alloc_vextent_near_bno(args, ap->blkno); =20 + /* Attempt non-aligned allocation if we haven't already. */ + if (!error && args->fsbno =3D=3D NULLFSBLOCK && args->alignment > 1) { + args->alignment =3D 1; + error =3D 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 =3D 0; int error; =20 ap->blkno =3D 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 =3D xfs_bmap_btalloc_select_lengths(ap, args, &blen); + error =3D xfs_bmap_btalloc_select_lengths(ap, args); if (error) return error; =20 /* - * 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 =3D xfs_bmap_btalloc_at_eof(ap, args, blen, false); - if (error || args->fsbno !=3D NULLFSBLOCK) - return error; + if (ap->tp->t_flags & XFS_TRANS_LOWMODE) { + ASSERT(args->fsbno =3D=3D NULLFSBLOCK); + return xfs_bmap_btalloc_low_space(ap, args); + } + + if (ap->aeof && ap->offset) + error =3D xfs_bmap_btalloc_at_eof(ap, args); + + /* This may be an aligned allocation attempt. */ + if (!error && args->fsbno =3D=3D NULLFSBLOCK) + error =3D xfs_alloc_vextent_start_ag(args, ap->blkno); + + /* Attempt non-aligned allocation if we haven't already. */ + if (!error && args->fsbno =3D=3D NULLFSBLOCK && args->alignment > 1) { + args->alignment =3D 1; + error =3D xfs_alloc_vextent_start_ag(args, ap->blkno); } =20 - error =3D xfs_alloc_vextent_start_ag(args, ap->blkno); if (error || args->fsbno !=3D NULLFSBLOCK) return error; =20 diff --git a/fs/xfs/libxfs/xfs_ialloc.c b/fs/xfs/libxfs/xfs_ialloc.c index 2fa29d2f004e..c5d220d51757 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 =3D 0; --=20 2.31.1 From nobody Wed Oct 30 22:13:17 2024 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 2F8371BB688; Thu, 1 Aug 2024 16:32:04 +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=1722529926; cv=fail; b=UFLZz64U8cAncsUp8QPG3h8rlHt6vUzdS50RDSroe8a5iuWooZTAKMdav+VRBUUETTyd+t422evM8rjSu3CvQOfV/8XnH0y5wX0ygcaO3fb59/H4WULeh6037jZuojpBXLWwPmDKChCJ9oi5dG6UZYBqmUbicyy3AKHtHuqDlWM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722529926; c=relaxed/simple; bh=z1AqAu1tJg7fQddCo/GgIMBw7lwPeiVDDZo4ripdTns=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=UuYOTfiG2aOxXbJmBsq0ioxgkteAhaQLpkzjajzqzSNnvWrkwgH9Ynh7fK98I4u5oIlcGRae5qFh7R7gktchUxcuISUqXB7F16ZmAZiAFyq0QL2ZGLit6eV+m7y6ulYsVJxCKa5xqkYysfung5P06NRBNJ6Y/i8wztIMCfgyzXc= 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=P09Pgxuy; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=Gr04oFmK; 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="P09Pgxuy"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="Gr04oFmK" 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 471FtXdY010818; Thu, 1 Aug 2024 16:31:49 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=0bzkiy0u/DAI6YbJeATr2j9i1rFJTZAu/X8HDWVEXB0=; b= P09PgxuyD730ARYumSYdldFtxRriS9GeW4K3+YdMRhuN/8KsHRYPrzbseJz+2Yme CfqmRQ3lHkFZNgd8fbsHNvfFbUt9kPkpk9OT+hU+vbfs1yonTNyORM01TUxW2khB +1RHIQJ1afAUhs6BpLHpwCmRfZyAdVj5RkHqq7A7h4e3JQWs0d76mV72AndQXero XSII9jpy4S4aX+vJsseT4Cfjm6n4B8kyzIx7UlnkQvIgAdTVMQwNQit7K+F3la9T g/MHlRWt/pbjdGx05Dg6oFYn6Yb4GW0Fo4gWQ2NgFFHOlvHb5/dNwfFo7fmBE8Wl MS2u+9ssa1XtXnGipoiFnA== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 40mqtat9c4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 01 Aug 2024 16:31:49 +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 471Fe9Hi036902; Thu, 1 Aug 2024 16:31:48 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2168.outbound.protection.outlook.com [104.47.57.168]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 40nvp0es54-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 01 Aug 2024 16:31:48 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=tJXfK/p46dUQ7oH0Yc74xBdVsPSg7Fg0oGSVsR5FVHyJMHFo4kOYlIHztPWVHMm1CVRGOz3dzK/3y3JCBVYK4tZOAdTB34UyS7D6V9fXlBR3rW04yAUZc3lPs5kv13XUfTkl0vsR5piWXsPUoxSxzG/WgSp/9C/qRZrhHU0XMyJB9j/Siihby4PWEG+X/UfuyfdV8S5T5qemJ7NkXDN++2bo/bVJUislDgYbx6N60iPgyjPU1v1aXIgJLg6rJSFHx+MV4GemJTOmHUgNrtB6sG6RSH1VaglIGDCNeVNDiJhYwZ058NW4RgBqqYeEhlkJ9a7Uq6QvVhHWMoaS0XzwCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=0bzkiy0u/DAI6YbJeATr2j9i1rFJTZAu/X8HDWVEXB0=; b=EWZiH9Sxogx8wHelc7tSq8RbRCpIKCuZbibBv3wt5YuVvIaHidmd3WRe72brX9Wliunko77wLcUFH3DpUdIEKNC/mhvFqLovNNxG0usyWhU1MfXQ31ZDrXCagaTQesjzZT8vtLiiEhKmWkDmS54IbNG3QwPO1XEuSIj1cnySEnt1Boz/sXwub0CHfeXM7z9Le6GabrOSrAHozHxAUpTYGTiRVbHidGINUd7JtWnkwk9/ZL8vNcCpnT2CPYL1Nesu5BHIukgAQrk/lGNMHiYdV6fLIth2qHi2Hs1HRRIwfjmX86EOppgduRnJ6mzDgUCJB7etEIxWv/PrUfLIxOk26A== 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=0bzkiy0u/DAI6YbJeATr2j9i1rFJTZAu/X8HDWVEXB0=; b=Gr04oFmKZmbLwJgtAWGls6ntK64Lk81oC7dc+qlVaajKQoAmR5afZfE8nRprIZQapE3iFe71EcSV+0PqxDGuMCVfsZiJDQSwTov8KfznWzOt8hzw1xysYNe3Ojyi/IQDdaMdMsvepZ3eU8XHSsep5J4HU5Ol8v7gt2gWiCSHjQI= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by PH7PR10MB6081.namprd10.prod.outlook.com (2603:10b6:510:1fb::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7828.22; Thu, 1 Aug 2024 16:31:45 +0000 Received: from DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088]) by DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088%7]) with mapi id 15.20.7828.021; Thu, 1 Aug 2024 16:31:44 +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 v3 05/14] xfs: introduce forced allocation alignment Date: Thu, 1 Aug 2024 16:30:48 +0000 Message-Id: <20240801163057.3981192-6-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20240801163057.3981192-1-john.g.garry@oracle.com> References: <20240801163057.3981192-1-john.g.garry@oracle.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: BL1PR13CA0357.namprd13.prod.outlook.com (2603:10b6:208:2c6::32) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|PH7PR10MB6081:EE_ X-MS-Office365-Filtering-Correlation-Id: 3a348af2-c745-40a8-75e0-08dcb2476e38 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|366016; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?06QgEZLkp0z7cZQ2HCNnybvd2t/dh08XfJQPkgKbhahp2UnhBv0qTTTXGbxF?= =?us-ascii?Q?0W10k8p6jqTe/Dtd+SRUsYwPZoaiEONGRk02htK1i6AwhmWXrc0mr5zLgv0f?= =?us-ascii?Q?tjqZk8BtYg2XgMiiBQpsn1NcDmnoFf4p1ENI9wiZX2+9YGyPofVxered4sJF?= =?us-ascii?Q?H/49a62MfUiHXgpxpITZL7HIrpCgssW6+NS6naUKE6GyD8HHD8TuVjymn9z+?= =?us-ascii?Q?k92bl/7aNMcemXi6LqP49M23iru+Aduu69bWrvgVANwMhsZJSGJo7eZrr9KC?= =?us-ascii?Q?9v1LDuV9aaVRbc6KnYgNqfrXxtASyHgvgMloh6Rwng9mOu8BytJI32pp/+Yg?= =?us-ascii?Q?rM3ZAjSLaZJDwB7pbjQaeHciI54x+zE5cVgR1MHY0z4sBgjYMqdqbvQSu/Fg?= =?us-ascii?Q?vZqo4X/xV91r/FVDn3lNu96uvXa9iXMhaq3QGyvs78knIBwHc0btN0ODzt2/?= =?us-ascii?Q?wrqae9naO/VSSlaIdG5CKE6AVq9v1/5XJXrSpObylYF8OJxphdL6jaJZ8VlX?= =?us-ascii?Q?tJylqAZdrye0VmDwM/3M0IGQIq7sKex9bBMXMzFDyfnmgdO7huW3IOiBeXFR?= =?us-ascii?Q?i5Tp0Fhah2d05GrCLEpmpEXaydQ2p0VnMBNIPj0TqKoXmAcUEKf3S3oOMhZC?= =?us-ascii?Q?gTxYTFstjGF7l224vfe6lJp9LWBkYdueerVQDo4NdNkcWxvkRkqu2IsNMifU?= =?us-ascii?Q?PcWcu8jPD8KJrdOBvq9k7Ph4StZIqbSrDcdnxBgZ8VNnkXAyP+ajlritq/5T?= =?us-ascii?Q?fU9jnI3rgytjgyc2ybYwE0Zsr1ObLA1T7IGq1jqVR4mnBdIp6NDhYQNXvhLH?= =?us-ascii?Q?kj+Wvi6PcuVqU0F8OjS5oBEXq9pwC/rkA9VXrf4PIQAxkXSgIcAyakpI+7UX?= =?us-ascii?Q?LjgWQhau57hsJA783BBh8n/5yXQ0i29x40goD7N4O4WMj6rd2EUJbxa44hZp?= =?us-ascii?Q?Ex0sYVVNe6LqkpDITGK2Og6Ce4L9iPuHCsXBaBOXqXDc1fyP3nIhhgUr9ic9?= =?us-ascii?Q?5iHozBGau6JFjIayy8uYrYMQn4XmHDilLI1xVKvpNAeIHYQqHwHYRXGIpeYX?= =?us-ascii?Q?9Revm1JXgQ4vAWTDQeEsnpXR0lIRMbiB7zp/ndSk4nVXkc3ofyVaoQBCKlpH?= =?us-ascii?Q?pbSkHaPj4t9azaMRh0szgK/1e+hOy7qFGQoyc2uWUa1Or5PjKOWEpgvp9fWY?= =?us-ascii?Q?o2y6NtxZ+H+B7WiwW73hhrlS81dvyoTv+YuHXod4SYhoho9p25gBUu5Ga1hy?= =?us-ascii?Q?UGGAVyzs+Y4FN07A8TinSkRFC3WqF16kIdj5j51NDovO2xvoYJggsVBeW1n8?= =?us-ascii?Q?z8WBigLgTK3OsGwbNP3nSsiTxGs/hrYfPZV00pEgpf45rg=3D=3D?= 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:(13230040)(1800799024)(376014)(366016);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?K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2Up7f1ZS/+wUn6?= =?us-ascii?Q?TyRNvESSWQVHb3Zvaql45OxgdMxjThNTlbZi4TFPGBpUZ+mVURy+pW6MAs6I?= =?us-ascii?Q?CEbSD7uR2pdVtZsR2VjEkp1PZjU36TnV8MsOqaeBQlMdh0cYnlMsrJIgTmVa?= =?us-ascii?Q?CGnyL6hcy815sG3MUzfM7xHjOooTLqvcYqPoEpr8oazYAk4YWD8ox7wP3m7s?= =?us-ascii?Q?c3+uCVgdvZuQqnvVE1smoX/MgJc/qdmhMbl/psLmW+JfHNbTJZSOmXVsw1sQ?= =?us-ascii?Q?7ASmlKlSh8HXt9X9YReAfAwre/fM2weu5ImZ/Idbhiu4T+xdqZayML/hfaPn?= =?us-ascii?Q?bH/GYyqcQ6siyp5WBrqX15pC+zYN7dHX1IS2F33KtSrUc7P0skdfOeJKPtcE?= =?us-ascii?Q?FxgVDvzOwdUo0cpvCcSMx8n6j0d75IAHyZdFLnxwHEh8HxSUr7tzJ+uQ3jCN?= =?us-ascii?Q?ofcMAi7tvp63tyQOw7ynPjPwUhb7vdo2hZySyILQ+Bv/LARHg7t2BW3poqvG?= =?us-ascii?Q?boVfvbabi5QhRiqLsM0qFz/Nab8Sh9jVeJXEtro+ZdUPLnD7zB1Fu4PUflBj?= =?us-ascii?Q?RRGShwIZxoWpHVBma+0hjFPDXy7sbwbKjyW2FyObHk6qFDIEeF+IwHh08urE?= =?us-ascii?Q?tPuz/V4s587lIgjLxtwiltByamKNd+ywAo243YneKtZGWJgk3f3wpGPC7fIa?= =?us-ascii?Q?vp7rzfde7g5mgZHzuJ+PD7Vsl0vH0iJwAYNKoKbGGTp/bdiK2jh4I38yWui0?= =?us-ascii?Q?6g=3D=3D?= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 18qF7F3R3IDDRclRydaH1D+SUGCja49LpQrPX473dP831MsEYNlBEBQ+PsWB8p0DQ3iWBhZ/F+frtINDwoif6EsC7ghTUSFHpKVT6lHO/IlU/iNl/6CK/K7tiZxKc5ah7bgMPzIIZ0s5GMC9J2+OJasKl6JeNiHhhSdvlezKbAEEN3wVppoPJ0NuCxr4Ig8BTX+5lx9clskg6StrO7hqmBICitvCKTPIhqCP7Dr/OFKn3PAnRSoMRkl0nCK4LeY9I3Kp8b0R+fCz0pHfNZIDf1k6CaakvpeTocfCDs9NEHBABJBRnTewA3MHBxC/MoAkKWWIWg7sJz5oDRivGTV7iGz0n8UsYOs7o3XCpkGWJy3IUAGefhRHq0D+m3MSdnkzLwcFkh3b6NnDDJpuqodlIj2ytA9QJY1LK6twGpRpkZDs3XPj03nVFgLCNtvOEt5024J9JcOjICumorN3mBZrsTUnk0URhuRtcQejk6SsIAq9q8qAzkN/21BaaBffkOb//VXRf4UOEqrHXdpJj4E4ingIrbuyY++H0pJFFZB4RD1unTXTe5EJqBPDBVi2qcDphGfVcZ0BPmNDMDiJzB9NPc0kjGdBonqDKdagq8JkMjE= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3a348af2-c745-40a8-75e0-08dcb2476e38 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Aug 2024 16:31:44.2686 (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: 2kr8uVHQ+bcHFL2oCTCQRbMIQWmn/W6dh1kDdG1yTUSpB0pjXKIgn0QUG+us/+gObcF3Q2ag/hmbDAilpqqUBw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR10MB6081 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-08-01_15,2024-08-01_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 adultscore=0 mlxlogscore=999 mlxscore=0 suspectscore=0 malwarescore=0 bulkscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2407110000 definitions=main-2408010108 X-Proofpoint-GUID: Tk1_fTFvMMQ75znzE7jlZz_wk9IsJD73 X-Proofpoint-ORIG-GUID: Tk1_fTFvMMQ75znzE7jlZz_wk9IsJD73 Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: "Darrick J. Wong" [jpg: Set XFS_ALLOC_FORCEALIGN in xfs_bmap_alloc_userdata(), rather than xfs_bmap_compute_alignments()] Signed-off-by: John Garry --- fs/xfs/libxfs/xfs_alloc.h | 1 + fs/xfs/libxfs/xfs_bmap.c | 28 +++++++++++++++++++++++----- fs/xfs/xfs_inode.h | 5 +++++ 3 files changed, 29 insertions(+), 5 deletions(-) diff --git a/fs/xfs/libxfs/xfs_alloc.h b/fs/xfs/libxfs/xfs_alloc.h index 473822a5d4e9..17b062e8b925 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 */ =20 /* 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 42a75d257b35..602a5a50bcca 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 determin= ed by - * extent size hints and is carried by args->prod and args->mod. + * Extent start alignment is currently determined by forced inode alignmen= t or + * stripe configuration and is carried in args->alignment, whilst extent l= ength + * adjustment is determined by extent size hints and is carried by args->p= rod + * and args->mod. * * Low level allocation code is free to either ignore or override these va= lues * as required. @@ -3416,8 +3417,13 @@ xfs_bmap_compute_alignments( struct xfs_mount *mp =3D args->mp; xfs_extlen_t align =3D 0; /* minimum allocation alignment */ =20 - /* 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 =3D xfs_get_extsz_hint(ap->ip); + else if (mp->m_swidth && xfs_has_swalloc(mp)) args->alignment =3D mp->m_swidth; else if (mp->m_dalign) args->alignment =3D mp->m_dalign; @@ -3607,6 +3613,11 @@ xfs_bmap_btalloc_low_space( { int error; =20 + if (args->alignment > 1 && (args->datatype & XFS_ALLOC_FORCEALIGN)) { + args->fsbno =3D NULLFSBLOCK; + return 0; + } + args->alignment =3D 1; if (args->minlen > ap->minlen) { args->minlen =3D ap->minlen; @@ -3658,6 +3669,8 @@ xfs_bmap_btalloc_filestreams( =20 /* Attempt non-aligned allocation if we haven't already. */ if (!error && args->fsbno =3D=3D NULLFSBLOCK && args->alignment > 1) { + if (args->datatype & XFS_ALLOC_FORCEALIGN) + return error; args->alignment =3D 1; error =3D xfs_alloc_vextent_near_bno(args, ap->blkno); } @@ -3716,6 +3729,8 @@ xfs_bmap_btalloc_best_length( =20 /* Attempt non-aligned allocation if we haven't already. */ if (!error && args->fsbno =3D=3D NULLFSBLOCK && args->alignment > 1) { + if (args->datatype & XFS_ALLOC_FORCEALIGN) + return error; args->alignment =3D 1; error =3D xfs_alloc_vextent_start_ag(args, ap->blkno); } @@ -4151,6 +4166,9 @@ xfs_bmap_alloc_userdata( if (bma->offset =3D=3D 0) bma->datatype |=3D XFS_ALLOC_INITIAL_USER_DATA; =20 + if (xfs_inode_has_forcealign(bma->ip)) + bma->datatype |=3D XFS_ALLOC_FORCEALIGN; + if (mp->m_dalign && bma->length >=3D mp->m_dalign) { error =3D xfs_bmap_isaeof(bma, whichfork); if (error) diff --git a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h index 51defdebef30..bf0f4f8b9e64 100644 --- a/fs/xfs/xfs_inode.h +++ b/fs/xfs/xfs_inode.h @@ -310,6 +310,11 @@ static inline bool xfs_inode_has_large_extent_counts(s= truct xfs_inode *ip) return ip->i_diflags2 & XFS_DIFLAG2_NREXT64; } =20 +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 la= rger * than a single filesystem block. --=20 2.31.1 From nobody Wed Oct 30 22:13:17 2024 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 C8A821BB69D; Thu, 1 Aug 2024 16:32:05 +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=1722529927; cv=fail; b=GwReDFHpRCrlq9d8r3Vm/EGx4+egZjOFTJJHv7H64YvGBc14GlnpgCj1N5A9Wq8wqhpU9QvYPyqiiC3/vfWX2TVV5IqT7EJrsMhF+Jg+Zl2H8BX2ZCgyJYQqzKnN5gBZLDbzFjk9BCEPaN8DWw9qrDhTJIHvkvt1RcEUOWolN3o= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722529927; c=relaxed/simple; bh=9rAvIZkBqEMJF/OGzmC8x+TbIitZExhngqTTkGjs7wQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=TwnPB5CESr0L9SR8nlfE3K+ZwZYkfC3gLRz5SMczA0MFb8vi1+vnACKmLN/mG2D4wne2G2zRuyTlqBAwLk6yX28Ij7xutXmXPwKAPYOqov6dqRBkTGBRCUdENkVK92KD3EnWxmWWPhslKqe+X9Uhx4807wxX9yxtjEhD2/uvN5g= 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=EIk1vtB7; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=IhQGXGkw; 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="EIk1vtB7"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="IhQGXGkw" 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 471FtUA7002499; Thu, 1 Aug 2024 16:31:51 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=O/SjPFt2w3lZcOi2q8fMPdZvU7KFRVtFOTV0GecvV74=; b= EIk1vtB7mthWYNJSz7cWoOmnk6Gh88nO1TqbDa4cajzR1wDwNCWPgWkqfb4phL2J kN7z+anUc6bi3bpngGYEQlk6Ef5Kib6Ujd3kuNMgGl8/UtvOBB0PiEyOs9beMLB8 kTqByTXL6GmhFdPfW5j1zMcmARE5GzdPZrhMWIWBLRWRN99eaereFYRS3LbTSQCR bNiExW/1PPLeEXGv/v6mzDXTCAuEAeST8DkweqvVl0Jt2wqLD4yVTAKrkkJ95ee2 S9qkNz6jz/LcPd2gjGOm7+UcrUJGjbVhbMkHgj1z3dr9vq0nV2PVcxu6mE5LIcd4 iX4foH3+dnNmDVrf/i6k1w== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 40msest6sk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 01 Aug 2024 16:31:50 +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 471Fe9Hj036902; Thu, 1 Aug 2024 16:31:49 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2168.outbound.protection.outlook.com [104.47.57.168]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 40nvp0es54-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 01 Aug 2024 16:31:49 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Cw+BZDK9wVxiw3TSVPNzHiGlAORMDsnYXa10QEvROzDp7l1MU1xthip2A5sWhMXw8END6apMZJKjekMLua7P1J1T1mK9dcpvxgu1DrRt9HQ/J9wwqxZrweBuHJEjqFe1yBHR1xV2GUb2yl3o21k+55yQKf1Oxb0thJxpnPUGpKZ5h2Fi8Tpyo/KZkCcCQIvy6TAC8GDMbsgK9B+CmDniVNjTiBXwtvylMc5MKoil9BU6MOZEcLuhbZ6mstaEn9Uv5ObRUd9AH3u/zJgk1S/97i664DL0aDNtzMpn6/ckcfeFRvu/ZHUG6O2xYKKwJbGCIslzJGWLsvhUYeZFue8gxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=O/SjPFt2w3lZcOi2q8fMPdZvU7KFRVtFOTV0GecvV74=; b=o1uyryGoVVmF96XGSN0h1kaUadhlS8Vs+3AMunN70TwadkaFJd3kHRyIhOvjRQgoukAxBg+fzJplJepGp+ke0/vvOJt+5l22U2gpEhL+Fh3EvEygZpsH2+eUMbr2OhvjrOOAglM0lTxRn9/Ejws41EZKDj92EHrrALPzsizgJKOsYHhk+llYx7TtTKbdM0xp8ip7ZdfWR22QTGK6Eco2b9S2BHXQBsWdRThp7bKAi1LzBTQBEjrA6d1ntx1w08DNsj3iwVvwkoiVPbc1EVil2xb+DwQv7xLCtFolN/j18kucoYrxvUa5jjOhW5Fr3rpHAvSqnJGyzLONjnFOVVf6LQ== 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=O/SjPFt2w3lZcOi2q8fMPdZvU7KFRVtFOTV0GecvV74=; b=IhQGXGkwmMuUyt8Nra12Jno6vnuNmNjq7i0qWxAaG5WI7/DjhlhgyXxq9KNhDgRSb8lzbJDvHMU+2xmQympUJX6oDbELoqeSr4OWjeiaJLFHB0wYMVcTUrpArAIX/79GrBwA41mPdt/zVo27ZSRHswPNj7DC09qbykPguyT6EeY= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by PH7PR10MB6081.namprd10.prod.outlook.com (2603:10b6:510:1fb::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7828.22; Thu, 1 Aug 2024 16:31:46 +0000 Received: from DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088]) by DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088%7]) with mapi id 15.20.7828.021; Thu, 1 Aug 2024 16:31:46 +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 v3 06/14] xfs: align args->minlen for forced allocation alignment Date: Thu, 1 Aug 2024 16:30:49 +0000 Message-Id: <20240801163057.3981192-7-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20240801163057.3981192-1-john.g.garry@oracle.com> References: <20240801163057.3981192-1-john.g.garry@oracle.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: MN0P222CA0006.NAMP222.PROD.OUTLOOK.COM (2603:10b6:208:531::9) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|PH7PR10MB6081:EE_ X-MS-Office365-Filtering-Correlation-Id: 747159c1-9500-4581-7623-08dcb2476f31 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|366016; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?Bj1F3LA7zAXLf6J8o8dpvI0svLWUHfKuHHRvnCG9Q9Fazo+qW6J6rUkStSMq?= =?us-ascii?Q?EZXxUB9B33JurZALXNCm7N0MHkeIUWSS42sNMMye6AUrYgquRNG4dWs9vZcu?= =?us-ascii?Q?EjOFQArDC+/7sHPO8h1l/ugSsXYbrNz6/F4yRdqnLpXRKOKFcM8G/eN6Y1QE?= =?us-ascii?Q?a9fLfbPb+fEnMBJNI2rF9EaSDRYeVOjoiqofftl+bfdIjEUhK8tKcdsfq+8V?= =?us-ascii?Q?cQMIltMUskfTF080LbLWOaTgVAc3dEo7q2YV85wjuynA8Yn65dwmcvD88o9V?= =?us-ascii?Q?ICHhR4HlyY/tx9ezd//r6RLtU/Bmoc5vXBJPqYCoxVNkfQZhlgvtz0DyMP5G?= =?us-ascii?Q?d2d0ZTw7+Foo4uhu/Iw/Uv4RpZ3tCCwbzCAAgNmgdWxANje1i79BdTHNFHCd?= =?us-ascii?Q?78lvHeaWp+GoHaIeoQhfWKeqakx+NPCKbqufO1Z566wLDDQR/gY3lVPwA6oU?= =?us-ascii?Q?5zEXAMDSXTwly/btZPypA2I9RiCdAjD9dctMkikLjJe2v/UzwySaOcn/RByj?= =?us-ascii?Q?g93i0TtzNJKmUNGne4fgRQ6AgU4aF0ExUnkN/ifICdGb9XTXn6LuhSLBdwCS?= =?us-ascii?Q?KlnN04pd/vIUIDmWgRntn/srN5ir/hLmvYWOupHtgeDk5uTCylMuzNeDkdpd?= =?us-ascii?Q?nbhSXXvV4K4B+x6Ri4wg01u0dd9cDkm/I5GC21QWHv3zEiHneLHFrlchbO7s?= =?us-ascii?Q?99uFkAbFMjoDC/WLxrwPo/NxpDCaQm4z9/qKBLK187OEyrEqFsyCgpnwNQt7?= =?us-ascii?Q?QYwRxW15VlHPlfuAkO8psKBnsIlWKv/pDT/LFu0WRaK2eMtRgwbMsLGNVt1y?= =?us-ascii?Q?fx9/IN8n9v9LU/OKw0PPDGb62IOpidJNlhcX5HeaNh7tP8XULuK+SbP7Gi7o?= =?us-ascii?Q?MWjuM0y9fRu4GB64eH29CwLZ+5VX9PJV43iRjFG5PGh/wEMSUxnKQ0I6OmV2?= =?us-ascii?Q?Y9sKIy8Wpb8UMSkomAUbljeKhSscsidj/fpDMSDvHIKYcAE5gWbKzshETMQZ?= =?us-ascii?Q?q34n08sK0RpJL6jy6Y2rEkbFn1Hvs7M8Nm8wDycVEaNNEXw/AOIK72qS4aL0?= =?us-ascii?Q?4rgTHth43mL671FE2DMA48sKwMJWAf8LgXaVAaA6FUNzsrTfQ5jCSFJ5jre8?= =?us-ascii?Q?HydzFBNdTGt95WGObDtPkM8bQXtToetEag2XSpHuTIdP6OVcOdSXqnDk6K+Z?= =?us-ascii?Q?BNFV9saFt8kg7YgFsYOsPsb7x6A01sExqLU7d/PtxRSJYuawgXWtaNiIOMRN?= =?us-ascii?Q?2XWcD/Nrdv6USR2iFNJ265F9bXPH/u0mWrJETXWUfXW+odJbzXGaL/MMtuTX?= =?us-ascii?Q?FqgB3Q3HY1B/wwVVRK6GczUSAfEFgYRfiVdwQYphpUqkgw=3D=3D?= 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:(13230040)(1800799024)(376014)(366016);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?A5oP2ksMmAA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hwe+YtXcXpybc?= =?us-ascii?Q?hBvpW5a2INXgYkPO2s+nNDhnEDRK528BCA0LxKOj3WtSZpNrWGyWaDf5plBH?= =?us-ascii?Q?uaQp/hw2dBfN+t/04mePmovpTyVYVG4qEYkz+rfAsXDEe7oPp3Vzopor31Kf?= =?us-ascii?Q?FfvWi4pbA7xkCSRWTjbrCRXaUmjL8zhSptpAXWjWbo4W1tCcfn70Qjae6dkf?= =?us-ascii?Q?VedtCQhLbyn2M43RXGEvzVxK7n/Kg0jyiYOviBo/nVa90RhOVi8T0EnL0pEg?= =?us-ascii?Q?P1Tqxnauk/aQ8AoDkcNLkHgXBLeVP7CI7D3CsxYrVI1p4DvojXdpW2cEfOwg?= =?us-ascii?Q?KGdKaHTSsQbuj82rQUHXsC3DQGwNXF1SXAU6+lwJFFzcQlS+Mpf563Y08o8J?= =?us-ascii?Q?qmxNcYe++oBRpo8sLZJPWm45Jz5rgMFOxCCrMDh2yOtfodfQ9hBkcKifjH4V?= =?us-ascii?Q?9lf7s8g2XHhNRGkWFmr5Pj5+179iURSQ4RON70g449YM6Qp08sZOOI1F4jkh?= =?us-ascii?Q?msSuPsox+V0/m8/xg5HqdQAZ/pZTT5hAbBEB8YWRMtpEaGSrrw6UB10OZ2o2?= =?us-ascii?Q?QPJPeZ8OOX80VXGVVFPUUuQAtOAT2VVR3R7LauzvXSDHeK3hjH84Y6NMhWCi?= =?us-ascii?Q?2vluG8bb/5hHQYmmRhO00QjzQANBy3znZzgwScXKnxc2tzTkVVoQ2qIUB8cs?= =?us-ascii?Q?4VBdMhlWl9RLHD/nyDTeB/sk6vruV7qLugmgDM0OH9PaB05V9cXsRB6x/zss?= =?us-ascii?Q?2A=3D=3D?= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: Xfi/hI83hWbvujha0dTny/K0JCw6cf70tvlFwMQxH/kl/DAzpgcIifxga538Kb7SVirxEzb0lVPnEGLrXbHGl+Ax5nY5hdV6fcibigxduffKS9InWvtTF1QbJA0MYtbK/oRRuo79gehW42x9xXkRN2UFW/QzROyMEwHe4DXXKOoT4RG3wPE8Mm8E7cLbdIphOpYZDbi2CWjrUp4Qr2yZtX2/Ol2H+4dAjiyRZ09894XxPnFI+AUTtPUazJhLBpO3a7S1hxV3Y7aP0tli8XbVqjyxKX1lapP1pMDbxGDMhZHKVY6yIHPZ4rcjuKQ+T/mdgpU+wENkb6E2gOKY7fUlEeWD/hw4577ErQWdMHqBn/amy6pmmm6KRoE4QbDo03F8dlcFueClm/Va3n5FwAhrTff61UtJsWzZ5tatljvHVuMxvy96rG7KT5pgyUdEvBT9kxM+HmRBiyq/sw/7eA5qW/WomD4b8uZ0pTiG26Wt8hU/rvRXrjn7uRh4bzeywwtruazu1NdZ2hyfG3hI/7gVxzo922imUUqTsU2NkLeaiN2MpCFmU6GionM92YgAvuoOtDrwgBXGoVZJ3NrZmAbIgJib5gcq3R0yR+C2nphMsks= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 747159c1-9500-4581-7623-08dcb2476f31 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Aug 2024 16:31:45.9397 (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: C5N9s/RtR/7ESokTMd0Khj/gSg76idqssk6BkU81Oooj5mlSBJuPZ61MoguAO58bKnFcYeS3m9YZEJrBVtSshw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR10MB6081 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-08-01_15,2024-08-01_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 adultscore=0 mlxlogscore=999 mlxscore=0 suspectscore=0 malwarescore=0 bulkscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2407110000 definitions=main-2408010108 X-Proofpoint-ORIG-GUID: C3P-rQKk3V-7cUZlXVUVDnrkEwEKTcEk X-Proofpoint-GUID: C3P-rQKk3V-7cUZlXVUVDnrkEwEKTcEk Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: "Darrick J. Wong" Signed-off-by: John Garry --- fs/xfs/libxfs/xfs_bmap.c | 44 ++++++++++++++++++++++++++++------------ 1 file changed, 31 insertions(+), 13 deletions(-) diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c index 602a5a50bcca..0c3df8c71c6d 100644 --- a/fs/xfs/libxfs/xfs_bmap.c +++ b/fs/xfs/libxfs/xfs_bmap.c @@ -3279,32 +3279,48 @@ xfs_bmap_longest_free_extent( return 0; } =20 -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 -=3D args->alignment; =20 /* * 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 =3D ap->minlen; + else if (blen > args->maxlen) + blen =3D args->maxlen; =20 /* - * 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 =3D rounddown(blen, args->alignment); + if (blen < ap->minlen) { + if (args->datatype & XFS_ALLOC_FORCEALIGN) + return -ENOSPC; + blen =3D ap->minlen; + } + } + args->minlen =3D blen; + return 0; } =20 static int @@ -3340,8 +3356,7 @@ xfs_bmap_btalloc_select_lengths( if (pag) xfs_perag_rele(pag); =20 - args->minlen =3D xfs_bmap_select_minlen(ap, args, blen); - return error; + return xfs_bmap_select_minlen(ap, args, blen); } =20 /* Update all inode and quota accounting for the allocation we just did. */ @@ -3659,7 +3674,10 @@ xfs_bmap_btalloc_filestreams( goto out_low_space; } =20 - args->minlen =3D xfs_bmap_select_minlen(ap, args, blen); + error =3D xfs_bmap_select_minlen(ap, args, blen); + if (error) + goto out_low_space; + if (ap->aeof && ap->offset) error =3D xfs_bmap_btalloc_at_eof(ap, args); =20 --=20 2.31.1 From nobody Wed Oct 30 22:13:17 2024 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 979AF1B9B4E; Thu, 1 Aug 2024 16:33:06 +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=1722529988; cv=fail; b=d/xCaYOmsPSVkZsPth1Xt8IprqpQotqVlGwP8i7lJCsRjStGuLi0BtUUQxS0GXwvb+EPuApo3PTvB2otcE2/v/w/c+5FH37I4VeN2a0TzbW3DXk8kqEBoli5wM00Wba9NJFDWUdHocrfzR8vEuHgdnkjO97Y9cGhEX2R6UCdzHA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722529988; c=relaxed/simple; bh=a1jehRnMmuVsRrguzfau4mgpscPSWewfzNhtTSXK+y0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=XGmdy+z/dtLyTOWL13oholUBaKUEyW9+85eMGTFBwK+tvFZxbqOvDEtw9elxVGfOQmEhWadW23NE5Mc1GqQSnesCWo0SG/24uNVG3GG9vNPLnqtyKDnaAuAZryamnSRiGEGbcaloIT06Vif7+mzeXhzXCMVutYsmXhwrL7OiSZQ= 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=DpGzJ+4C; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=ZLkW838D; 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="DpGzJ+4C"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="ZLkW838D" 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 471FtY1W010833; Thu, 1 Aug 2024 16:31:52 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=8d0E1NCt/EKYL3wXt0IKGbAO3KgnRxvtKCwZkQZIxFY=; b= DpGzJ+4CshFse72ri4tZSVFumCbC42+4zboo8eXYUNiYbTDyLojxr+N4Ulur62pf e7sz0oKEre7kx1HY8LkCXujdk2bqVR+Z9usqHjRXwhWwdLG90MGOZk+nwZLnDsD9 jpjPFjcfsmSbqnG1YHm1oMtk+76B2s8juU1lVqNnKxzGF76Ww3jHffDMT6oPMHxy K9hStQBbhPZuIipCLbMc95hApgdVU5RT+zrrp5Z3JqsqVCSkAvPtnNzRv5dbJL9Q vgpWN7qnG6DDdXDOB0/B++vezVMk9IbJqmbmIVID/Awmt+DftVgWLgQFL49BwhJN f6k6oTWLPVTm/bqzn/+1ZQ== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 40mqtat9cc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 01 Aug 2024 16:31:51 +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 471FWhLM035584; Thu, 1 Aug 2024 16:31:50 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2168.outbound.protection.outlook.com [104.47.57.168]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 40nvp0es85-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 01 Aug 2024 16:31:50 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ct/QIVTdElfFs1Xnm7a5KBlz4atd/ixjh6kNChFaXjg/QOY7XUM681Fe5RDoUM7cI3h715BETivrGcsJGivqTTFVHCmAGeqfXjSAs57OA6spxL0CNwh7WiufY/pVnvamd7wB/8WI1c9Q6xItTNKd1fnlj7DdNj+6D6CuDdiF0JzpKld4z87ToWBaL+NRfVELeyVSqRD5N7HlgF95VB4rZ6WMz0lN0MPAH2cYuAdYNQML92uY4N894/DwUQ55ptiG0y0dZpkHVqyjM+1bynvC6umPb/NRorZLdW8PqN8HZRFxip8j3wpW/4ZWS9ca0cg6CawmvvY2xqkcmhn36oM+rg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=8d0E1NCt/EKYL3wXt0IKGbAO3KgnRxvtKCwZkQZIxFY=; b=Tae5Ekdu5+zRMsucftaVWKvb9Cbk8sFMdq8bjJzYa33cpm5GGcmbOJnPRv/GVwVt5ZWGK26pERVKbR4BFkIGHREgFYYRvOaAnuQJWTrU2nB2W5GSLQ2AScRJ/jD/u7V1ziQajthxTp4vgs3YE393Hh+cI1A1A2dXcWi3+iPy8XmwfwytwV3NiT42tf+UWmLYQ+81n0CfECKf9wGBGxL5hXordYols6NgaICw7vBB4111mDGGKVKA+lZug1ntTTv0FNSaFOiZnKNcytFGZgkTjx+HY4hCcuu4DCXp3g+Ws7P3MKh3kpxOUMc8KLvDo6l4/n0rOCGlYKfWMQG5NvprkA== 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=8d0E1NCt/EKYL3wXt0IKGbAO3KgnRxvtKCwZkQZIxFY=; b=ZLkW838DWVlLw0/c8JWSQVjum4a/aJmJUxnwd4zBVABDQ9PeChECUFMOMpLylJo6jSfXGiaautqc7T6Wd0CZ4WpXK0XOT3pMDRsO/7y8LvrVIJNROH4AyGKhPd9iZGmh/wkD8fDsPM840gc75B2io7SeMWPKfBwxdHsJ6BfvsJU= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by PH7PR10MB6081.namprd10.prod.outlook.com (2603:10b6:510:1fb::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7828.22; Thu, 1 Aug 2024 16:31:47 +0000 Received: from DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088]) by DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088%7]) with mapi id 15.20.7828.021; Thu, 1 Aug 2024 16:31:47 +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 v3 07/14] xfs: Introduce FORCEALIGN inode flag Date: Thu, 1 Aug 2024 16:30:50 +0000 Message-Id: <20240801163057.3981192-8-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20240801163057.3981192-1-john.g.garry@oracle.com> References: <20240801163057.3981192-1-john.g.garry@oracle.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: BL0PR03CA0010.namprd03.prod.outlook.com (2603:10b6:208:2d::23) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|PH7PR10MB6081:EE_ X-MS-Office365-Filtering-Correlation-Id: d47d9005-dd91-4354-c63e-08dcb2476fcf X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|366016; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?MJDTkozl4WcmA8g9WjNEYz/HRszQLb1ZsHT/n4YSUdRyKcFqUcp7sLV7b1+r?= =?us-ascii?Q?TxXL14Ke6PX+I+aY22gINC06VxSaFy83qvbrWfxUq26P3MnYhfAeNeOFC89W?= =?us-ascii?Q?iAjOt4jus0nrKjoVLvmrp5A6F+hlacnFZEd17oRiAUNQaa4YHW1DHOdXk6U9?= =?us-ascii?Q?etIVlOqoizPGKJG0tav3m5oUFzFtjBx3ASyNLXFKnupNfQj0SWOJoFeiSke+?= =?us-ascii?Q?zrHT5oo9vowphOSQ0GXk1EkmKwEZ6/e66nRSCv+Zj2smsFc9Pqs3KsC/pCYW?= =?us-ascii?Q?tbB9krQ+qfeiW37hnqXB7YJ8ySkfmsrEyB/zN8unsSpBuUFmZPZUqX8eWff9?= =?us-ascii?Q?0xORmeYMHN6YOQ5porZtW/VWTecQ60DgKx+s84WQ6K+RRAx+oi3Jk/eAq6NU?= =?us-ascii?Q?rK2sjNhxp7Hr6rJZRBVTfi6mGpZzO0SJVgOfDv1y5zy3kwZwKPpXVlHBqnzY?= =?us-ascii?Q?8mdXE6JEPLGZjA2esK1EJ4EhgxZAImKL+sYts75p8y3/bCpD5H+wf1NlUaLe?= =?us-ascii?Q?kaK0HG8OF30bU9pz050qlTNCqSGT9QaKs773F3aLNqNQRoYvC5C5Z9ZBG/yl?= =?us-ascii?Q?HZ1ZaNl97eGMDQfziJeEHmaQ8bOQMt4e05ceM8sP9kmB1uw+aV3yzYEakr+s?= =?us-ascii?Q?zMAIPd9worUCq1dABrJOsZigwdtYgISXBXOgAyZR3BcKhYBjyxoMAtFH1CtB?= =?us-ascii?Q?c5MSZMmiRI2zEg+qDoCQYkTtszYYTnInXk68FKVCOPkN2XDaIQgBiy3ejSB8?= =?us-ascii?Q?kqaN9/QHsKsUa9CLW8VwTeFBy2Ic/tJol3UPChCPilmAlOP/vmsk8dVjbP9H?= =?us-ascii?Q?f4BaWd2/FAFKtGrlj2Z8Crc5TosWxKoPGm0wIMfPiWa/sZSyytMO2GkGBAC7?= =?us-ascii?Q?DMVyMGJtKi80pccWkqEnpKUVQpgnr3l3SRFvR6qAzfMUK5JJhIJ9zjS4QX/x?= =?us-ascii?Q?YCBnFxp4G7VLaq3nsDtCNkmVrb7FNzgDo4/b9JLZOmF1XUUGrs+EHNhPVYt2?= =?us-ascii?Q?Wzj+ugV6vL+4D0I2+MoA8F/uyNOZFWUuUo3gSr9Gp6C2HvBnsiBqxdATm4it?= =?us-ascii?Q?TX5pLm9ML9UL3lVf1Ssq7BiAKD7KDAASh/tv7/qesWICcW3pSm89nkjTekkP?= =?us-ascii?Q?dnJEA4KdaOX+p4QAtMJnrxwkcXEwd6dg5yWYKNd2HdVMQVhlUjD+A6MYTEUP?= =?us-ascii?Q?aod7hW2Qe5lgaR/DynauVeayquGM+c+jXSAqHACJxp0a99/JqkKrRnQJsGcd?= =?us-ascii?Q?y260qKjf6j2ca4WGsdckWWIJRuE8ZzTawhnzkrJD2QB4V5XaIp+g9qo+39tt?= =?us-ascii?Q?SHP6OVWys1vEfMMN+V0SwJZxisoBNdnA+qC/Mifzh/JAkw=3D=3D?= 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:(13230040)(1800799024)(376014)(366016);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?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lM9spSaGT6Y8u4sXRoMIdbeE0X+?= =?us-ascii?Q?6DLZL31Ae0514UmkwqRjR8iXKBGLYWptKLY9XEezPrRopPPm7Nnubi2xAc3J?= =?us-ascii?Q?9nWxHeKI7GcQfg54okxWNcza1tQjk5SpLSVE0WIrNCztF30xwjJzRtmqYWz4?= =?us-ascii?Q?A3CziLlJEna1UgHuCQz2RiZu4hToN2WDaT1B5VfniUDi+mYHYGsZbaXKbCG7?= =?us-ascii?Q?aXIECYabQDAj8sa6va2opeLf7IwpZQyBrVDoqFomeLaq+hpgzkThHbMxY0yl?= =?us-ascii?Q?Aba5TIfEPiEfU4uMfaYuQzVH/og+bXoCsfchjLRldr2oTDLTMipk8pJd2gyZ?= =?us-ascii?Q?n45DaShtRoo/Z9Ng84ZdZLD8u4tuxy7jyPjPjhDWmptLi+NVgp8+ma6cGNgm?= =?us-ascii?Q?vjIMSPDHF8IyedpcOoV/mIj/9r9Q/Fr5PCpYEimX+vUcj4UUNwau+unO1Jh0?= =?us-ascii?Q?tcFEpOGRSWZ13XvHnYIdhttG7Z3RoTqwAc0nbSm5vBQjXTLPAxVQrtaPsdei?= =?us-ascii?Q?S64W62PH3kp8znRaqduo+ENumUATID66Xt3IJKxM1hK8dmMao0FbJr3VkOZw?= =?us-ascii?Q?r6d/2Nam1+M9E2utwMydiG/bADNW6gxKX7wX9hmWjtlB2SnuetKnf4Pi5VPD?= =?us-ascii?Q?gWA0dqhftJdwsTMBYjsglKR0D7iSwBaYbHIAZBF6BGLDxuYlVYtw+ZdoyB47?= =?us-ascii?Q?8iIT8ddSso3et5o6wntpIin+/JP7ZlsKdVKHPrDt5s7BwGRaq8ljRp98m7DZ?= =?us-ascii?Q?6Q=3D=3D?= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 5JCJnL/m4qxBFljXPIF4X+WWfC/i5nVU8Sdz6GZ2bHzuZzgIjaOcZjzvcwzaTlwmtN2zQnWJCf/4ydsKSLaPwz0GioujwrtaP8YN1olQfwLjB7vOCjI2ZuabOIrXWqastPYqbj60ETLR5ac3vn7y+LR8zL00ea4dt6ZUPZzOXdpR463ZEDydxsUDxIXnRKDX1SDkX0ALZID3FbdiX7Tq8LQ3iWxQwpZuEbm8VjAmi/R1hLL6Hx3t+12nWoAGqNeSe8zsKH2R+GNdWuu2b8lebFDxUdvwQdZwpASXoA91SzbgSebFqYJl3XHtcEtM3oVWan+td7fLtT0QnmgptQBJoSiPS86aQPiZL7mb+MPk+49dhpEwBfCs9CepF8eYi74EkPOh5wDHP1X2+rZQvc6t3XED5pn4d/GRPOplPsSr1j9XmY6vNgVMDG+ChKKIEhxpEdSC2IxpQddhWQcEEqkPyivnJ8o+HtOMyRbmRVl6glbp5kJ4r3VqWIIaWoxUaj5IiZHFszs9hLoJ1At3pIYbRIlHxgz0/FODS9gQl3yn6i+OOyS4xVsFCyAgRbhxYDKikOHErbKcvkXGIxDpQaQqr0kWrm1yaOKP3zW+peujLHM= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: d47d9005-dd91-4354-c63e-08dcb2476fcf X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Aug 2024 16:31:46.9239 (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: lFR5C6MKsM5Wqe4uHwlc25DpVzabYQ7Cgw55pyT01EJedpcAMnvtXZ6aVjI9dxpN7asLee60QtGski7Iho2jpg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR10MB6081 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-08-01_15,2024-08-01_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 adultscore=0 mlxlogscore=999 mlxscore=0 suspectscore=0 malwarescore=0 bulkscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2407110000 definitions=main-2408010108 X-Proofpoint-GUID: X1U9ClZb32VE4DpftoKkLxUYFVU5tm8u X-Proofpoint-ORIG-GUID: X1U9ClZb32VE4DpftoKkLxUYFVU5tm8u Content-Type: text/plain; charset="utf-8" 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. Allocated space will be aligned to start of the AG, and not necessarily aligned with disk blocks. The upcoming atomic writes feature will rely and forcealign and will also require allocated space will also be aligned to disk blocks. reflink will not be supported for forcealign yet, so disallow a mount under this condition. This is because we have the limitation of pageache writeback not knowing how to writeback an entire allocation unut, so reject a mount with relink. RT vol will not be supported for forcealign yet, so disallow a mount under this condition. It will be possible to support RT vol and forcealign in future. For this, the inode extsize must be a multiple of rtextsize - this is enforced already in xfs_ioctl_setattr_check_extsize() and xfs_inode_validate_extsize(). Signed-off-by: "Darrick J. Wong" Co-developed-by: John Garry [jpg: many changes from orig, including forcealign inode verification rework, ioctl setattr rework disallow reflink a forcealign inode, disallow mount for forcealign + reflink or rt] Signed-off-by: John Garry Reviewed-by: John Garry --- fs/xfs/libxfs/xfs_format.h | 6 ++++- fs/xfs/libxfs/xfs_inode_buf.c | 46 ++++++++++++++++++++++++++++++++++ fs/xfs/libxfs/xfs_inode_buf.h | 3 +++ fs/xfs/libxfs/xfs_inode_util.c | 14 +++++++++++ fs/xfs/libxfs/xfs_sb.c | 2 ++ fs/xfs/xfs_inode.h | 8 +++++- fs/xfs/xfs_ioctl.c | 46 ++++++++++++++++++++++++++++++++-- fs/xfs/xfs_mount.h | 2 ++ fs/xfs/xfs_reflink.c | 5 ++-- fs/xfs/xfs_super.c | 18 +++++++++++++ include/uapi/linux/fs.h | 2 ++ 11 files changed, 146 insertions(+), 6 deletions(-) diff --git a/fs/xfs/libxfs/xfs_format.h b/fs/xfs/libxfs/xfs_format.h index e1bfee0c3b1a..95f5259c4255 100644 --- a/fs/xfs/libxfs/xfs_format.h +++ b/fs/xfs/libxfs/xfs_format.h @@ -352,6 +352,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 ex= tents */ #define XFS_SB_FEAT_RO_COMPAT_ALL \ (XFS_SB_FEAT_RO_COMPAT_FINOBT | \ XFS_SB_FEAT_RO_COMPAT_RMAPBT | \ @@ -1093,16 +1094,19 @@ static inline void xfs_dinode_put_rdev(struct xfs_d= inode *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 h= int */ +#define XFS_DIFLAG2_FORCEALIGN_BIT 5 =20 #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) =20 #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) =20 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 513b50da6215..1c59891fa9e2 100644 --- a/fs/xfs/libxfs/xfs_inode_buf.c +++ b/fs/xfs/libxfs/xfs_inode_buf.c @@ -657,6 +657,15 @@ xfs_dinode_verify( !xfs_has_bigtime(mp)) return __this_address; =20 + if (flags2 & XFS_DIFLAG2_FORCEALIGN) { + fa =3D 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; } =20 @@ -824,3 +833,40 @@ xfs_inode_validate_cowextsize( =20 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; + + /* COW extsize disallowed */ + if (flags2 & XFS_DIFLAG2_COWEXTSIZE) + return __this_address; + + /* cowextsize must be zero */ + if (cowextsize) + 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_moun= t *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); =20 static inline uint64_t xfs_inode_encode_bigtime(struct timespec64 tv) { diff --git a/fs/xfs/libxfs/xfs_inode_util.c b/fs/xfs/libxfs/xfs_inode_util.c index 032333289113..b264939d8855 100644 --- a/fs/xfs/libxfs/xfs_inode_util.c +++ b/fs/xfs/libxfs/xfs_inode_util.c @@ -80,6 +80,8 @@ xfs_flags2diflags2( di_flags2 |=3D XFS_DIFLAG2_DAX; if (xflags & FS_XFLAG_COWEXTSIZE) di_flags2 |=3D XFS_DIFLAG2_COWEXTSIZE; + if (xflags & FS_XFLAG_FORCEALIGN) + di_flags2 |=3D XFS_DIFLAG2_FORCEALIGN; =20 return di_flags2; } @@ -126,6 +128,8 @@ xfs_ip2xflags( flags |=3D FS_XFLAG_DAX; if (ip->i_diflags2 & XFS_DIFLAG2_COWEXTSIZE) flags |=3D FS_XFLAG_COWEXTSIZE; + if (ip->i_diflags2 & XFS_DIFLAG2_FORCEALIGN) + flags |=3D FS_XFLAG_FORCEALIGN; } =20 if (xfs_inode_has_attr_fork(ip)) @@ -224,6 +228,8 @@ xfs_inode_inherit_flags2( } if (pip->i_diflags2 & XFS_DIFLAG2_DAX) ip->i_diflags2 |=3D XFS_DIFLAG2_DAX; + if (pip->i_diflags2 & XFS_DIFLAG2_FORCEALIGN) + ip->i_diflags2 |=3D XFS_DIFLAG2_FORCEALIGN; =20 /* Don't let invalid cowextsize hints propagate. */ failaddr =3D xfs_inode_validate_cowextsize(ip->i_mount, ip->i_cowextsize, @@ -232,6 +238,14 @@ xfs_inode_inherit_flags2( ip->i_diflags2 &=3D ~XFS_DIFLAG2_COWEXTSIZE; ip->i_cowextsize =3D 0; } + if (ip->i_diflags2 & XFS_DIFLAG2_FORCEALIGN) { + failaddr =3D 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 &=3D ~XFS_DIFLAG2_FORCEALIGN; + } } =20 /* 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 |=3D XFS_FEAT_REFLINK; if (sbp->sb_features_ro_compat & XFS_SB_FEAT_RO_COMPAT_INOBTCNT) features |=3D XFS_FEAT_INOBTCNT; + if (sbp->sb_features_ro_compat & XFS_SB_FEAT_RO_COMPAT_FORCEALIGN) + features |=3D XFS_FEAT_FORCEALIGN; if (sbp->sb_features_incompat & XFS_SB_FEAT_INCOMPAT_FTYPE) features |=3D XFS_FEAT_FTYPE; if (sbp->sb_features_incompat & XFS_SB_FEAT_INCOMPAT_SPINODES) diff --git a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h index bf0f4f8b9e64..3e7664ec4d6c 100644 --- a/fs/xfs/xfs_inode.h +++ b/fs/xfs/xfs_inode.h @@ -312,7 +312,13 @@ static inline bool xfs_inode_has_large_extent_counts(s= truct xfs_inode *ip) =20 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 <=3D 1) + return false; + if (xfs_is_cow_inode(ip)) + return false; + return ip->i_diflags2 & XFS_DIFLAG2_FORCEALIGN; } =20 /* diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c index 4e933db75b12..7a6757a4d2bd 100644 --- a/fs/xfs/xfs_ioctl.c +++ b/fs/xfs/xfs_ioctl.c @@ -469,6 +469,39 @@ xfs_fileattr_get( return 0; } =20 +/* + * Forcealign requires a non-zero extent size hint and a zero cow + * extent size hint. + */ +static int +xfs_ioctl_setattr_forcealign( + struct xfs_inode *ip, + struct fileattr *fa) +{ + struct xfs_mount *mp =3D 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; + + return 0; +} + static int xfs_ioctl_setattr_xflags( struct xfs_trans *tp, @@ -477,10 +510,13 @@ xfs_ioctl_setattr_xflags( { struct xfs_mount *mp =3D ip->i_mount; bool rtflag =3D (fa->fsx_xflags & FS_XFLAG_REALTIME); + bool forcealign =3D fa->fsx_xflags & FS_XFLAG_FORCEALIGN; uint64_t i_flags2; + int error; =20 - if (rtflag !=3D 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 !=3D XFS_IS_REALTIME_INODE(ip) || + forcealign !=3D xfs_inode_has_forcealign(ip)) { if (ip->i_df.if_nextents || ip->i_delayed_blks) return -EINVAL; } @@ -501,6 +537,12 @@ xfs_ioctl_setattr_xflags( if (i_flags2 && !xfs_has_v3inodes(mp)) return -EINVAL; =20 + if (forcealign) { + error =3D xfs_ioctl_setattr_forcealign(ip, fa); + if (error) + return error; + } + ip->i_diflags =3D xfs_flags2diflags(ip, fa->fsx_xflags); ip->i_diflags2 =3D i_flags2; =20 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 */ =20 /* 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) =20 /* * Mount features diff --git a/fs/xfs/xfs_reflink.c b/fs/xfs/xfs_reflink.c index 6fde6ec8092f..a836bfec7878 100644 --- a/fs/xfs/xfs_reflink.c +++ b/fs/xfs/xfs_reflink.c @@ -1467,8 +1467,9 @@ xfs_reflink_remap_prep( =20 /* Check file eligibility and prepare for block sharing. */ ret =3D -EINVAL; - /* Don't reflink realtime inodes */ - if (XFS_IS_REALTIME_INODE(src) || XFS_IS_REALTIME_INODE(dest)) + /* Don't reflink realtime or forcealign inodes */ + if (XFS_IS_REALTIME_INODE(src) || XFS_IS_REALTIME_INODE(dest) || + xfs_inode_has_forcealign(src) || xfs_inode_has_forcealign(dest)) goto out_unlock; =20 /* Don't share DAX file data with non-DAX file. */ diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c index 27e9f749c4c7..b52a01b50387 100644 --- a/fs/xfs/xfs_super.c +++ b/fs/xfs/xfs_super.c @@ -1729,12 +1729,30 @@ xfs_fs_fill_super( goto out_filestream_unmount; } =20 + if (xfs_has_forcealign(mp)) { + xfs_alert(mp, + "reflink not compatible with forcealign!"); + error =3D -EINVAL; + goto out_filestream_unmount; + } + if (xfs_globals.always_cow) { xfs_info(mp, "using DEBUG-only always_cow mode."); mp->m_always_cow =3D true; } } =20 + if (xfs_has_forcealign(mp)) { + if (xfs_has_realtime(mp)) { + xfs_alert(mp, + "forcealign not supported for realtime device!"); + error =3D -EINVAL; + goto out_filestream_unmount; + } + xfs_warn(mp, +"EXPERIMENTAL forced data extent alignment feature in use. Use at your own= risk!"); + } + if (xfs_has_rmapbt(mp) && mp->m_sb.sb_rblocks) { xfs_alert(mp, "reverse mapping btree not compatible with realtime device!"); diff --git a/include/uapi/linux/fs.h b/include/uapi/linux/fs.h index 753971770733..f55d650f904a 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 h= int */ +#define FS_XFLAG_FORCEALIGN 0x00020000 #define FS_XFLAG_HASATTR 0x80000000 /* no DIFLAG for this */ =20 /* the read-only stuff doesn't really belong here, but any other place is --=20 2.31.1 From nobody Wed Oct 30 22:13:17 2024 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 5E70D1B4C4D; Thu, 1 Aug 2024 16:32:07 +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=1722529929; cv=fail; b=NPLJ5M7u2BwtVxmKiLWOhNVrq6FDk59MQAQjUx47BCtHnHpmntEK4fxVZW2CvZnMDpX7sDhkdQJ9Ex7cEPZTfDxFRM9b0P1bfplR+zJHPq2TKkR/LAqadegZOhKfxFTiLLZdwqGsbuL+8L/4+S2MS5B4mwNcju9aBPgs0Uk6vNw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722529929; c=relaxed/simple; bh=F1lBOLtMgtfS00hl6XbX6lr3fK1+2gcVWOelAxGiE1k=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=lZ4l1KFUzXmbOy8f21ZZ18+rcq09nmz380a6cBbYd7OMQV5fl6spIsFAq3L5vtthd0+TSV5qcJurkju9NmBEUD691NJ7tZRo9cTl5s43QFAPkmYe+uIFeqTxb6mDFwIk+JNfyzGyBFWp2w4S/vMKk3ugMerIzWrC3yHwyVn0L1w= 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=FOEpW7L+; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=y/bVGEDT; 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="FOEpW7L+"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="y/bVGEDT" 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 471FtX23023392; Thu, 1 Aug 2024 16:31:52 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=UPNtKdqO6E7kq+F8wAx7MU/BC64nkfahgWoyy/EgeWc=; b= FOEpW7L+78jtlqLfIDbp5dETYn1Ccj5G+y7+NXam/fzyetBfvnOUod9OOyNFFG4p ap6ssuQwoUo1pOY6su5NSxk2QWpXbKobFW9puS96wzpo/kRAOym6eZzZeTa1UReq aYAQk3MmNsxfrA+iHMVw2TtIEq8vWOGEvdgt9GA47zR1cYjt5Gb+sX8spmwh/wJe knSYGzJjQ+g8qQhFehs78NPKcCZS94iN++2D2vcGNYhMTONvz4BR6mSo+scLR+j9 XjxMl8CCS4q56l+55tdZLrg8PoAb4cBgaVjuFp39k1CmUsyc/Ku8PzBgi/NYQWee mh+fYTigcVgHmdrpEhF97w== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 40mrs8t4c5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 01 Aug 2024 16:31:52 +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 471FWhLN035584; Thu, 1 Aug 2024 16:31:51 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2168.outbound.protection.outlook.com [104.47.57.168]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 40nvp0es85-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 01 Aug 2024 16:31:51 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=lMLhlYuBEOLXcezroTzgJ/ybSp0ultKbhrkCK4E+TDmoz7giH06s6DGO/Zd5SS5WK7Dbib+rxNJL36uaxyQpbEN4+5iyQ9769AXSbDfi2/jI7nLicV8MeJgFcydK5yLbrvywtBhpu1wOFLxDSa3TsTYyoq702qyKo95PeAWt42Mf94HkB9C1YKvyby/Z3ytBqQ3r1Btydk3gshQg7+kgsZ/gQq82Suc/5VtTH75kA+o2a5KUM5/gxFJuvoegfJxw5Ig9xw2zlarzv2jgGcqtmOXTgLeoq0JKbg95szULltMj2AP3+t+cNNYbEp6BDKr4UyFmWV0886OU/SOBGrTuvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=UPNtKdqO6E7kq+F8wAx7MU/BC64nkfahgWoyy/EgeWc=; b=Qi/PkuneVi18qAiP29A9GSMMnaHwurGykg8f7UCYZ8UNDtVJM+xksjhXDR5eD1enidDX7nAsgS6ICO5sASj0xICcwxbgHVepbg3kFaqaiWXAbqv9JsI2E/Bhk/3+5QhzEOk+GrAXVyKRnkBjpBHQuXeNgQto2kd+fcjRvW72kg7xr0tz1M/gk2BSo60oYbMeyhAXBKIZc/oqjRaiF3N6F1MSr3QWgPT94AhKnfSUiFr1N6X7nSkghaUpt0oNbfevsxWo4aeWDFaoa6jEjwaSANQz8fH8kjFgTdkmm2Dzz2xeXUvabfprLsB5gtToqFtHcg5cO9GDN0W1cZR6ie2PPQ== 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=UPNtKdqO6E7kq+F8wAx7MU/BC64nkfahgWoyy/EgeWc=; b=y/bVGEDTstZxS97pxEaLOzeM+zPnK/BFQM2q9Lk9oLa1HCOfD23CnVRudhJvzmRP1e/MjVkBwDEBMabEKxuYizPUksPAdgPfkYm76zotTBdiZHaAnZjQ1sv9rS+pw3Gcdc5b2f7TPkkme53O5fawDFBLMkbd1OICxttmdx7HW1Y= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by PH7PR10MB6081.namprd10.prod.outlook.com (2603:10b6:510:1fb::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7828.22; Thu, 1 Aug 2024 16:31:48 +0000 Received: from DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088]) by DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088%7]) with mapi id 15.20.7828.021; Thu, 1 Aug 2024 16:31:48 +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 v3 08/14] xfs: Update xfs_inode_alloc_unitsize() for forcealign Date: Thu, 1 Aug 2024 16:30:51 +0000 Message-Id: <20240801163057.3981192-9-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20240801163057.3981192-1-john.g.garry@oracle.com> References: <20240801163057.3981192-1-john.g.garry@oracle.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: MN2PR16CA0046.namprd16.prod.outlook.com (2603:10b6:208:234::15) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|PH7PR10MB6081:EE_ X-MS-Office365-Filtering-Correlation-Id: 06b95ba4-0cc6-4f00-bdb4-08dcb247708a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|366016; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?Lo2RX2RTidwL+9XlFL3H28TAQzeePAUWejoByFqAtRu2qG/yjWIvZlXnBGvq?= =?us-ascii?Q?gNvPcPx72wU2682Y/t6tNExzi4RTTOene5jIBEEohWWVGId2GD3h333lJB3q?= =?us-ascii?Q?0hqUdp1mMyjltIsc2qxLUY0/GKwU+YtZFe6l2kb/xFs9WB0Li586B7Q+oZBE?= =?us-ascii?Q?befj+RauJ+Jm2MwO7VXvQzzzBn8EWaIXHsLiHcMIQD3p0HCAXGafds3sGBxU?= =?us-ascii?Q?RPYNXSjezNRYKGUV0UOTbc0jeRkiutKu2swmJ+bKvH3gBhsN/SKgODYN6J0V?= =?us-ascii?Q?itBHjxsQMppi0m83ITxS5s85V4OR5fUfsiH9UnH+quh3jeD1fGvYgYY0g3Mw?= =?us-ascii?Q?cqDAcm2UtSyeAxsWAnP/ZoHspA3120XkFBkgUOJ8Fyb9icbA6t6X+U7uTicL?= =?us-ascii?Q?OfQRGjLvtorSHM7RUZrmhaSEvYRap3eJ6NpS+I22xjZPVME76HU+MyHOolQ0?= =?us-ascii?Q?DEGnsqd2uge4h1dK+9hYn0dBwmR/X+XKORk9Hx7OFr7y1ttJsbk7V9mDyLt+?= =?us-ascii?Q?cJiCeOUX/3uTl59WSHOCouLlK++v04cu5gJjKbo3F7k1yMwHTJbK0ZjH/bXv?= =?us-ascii?Q?0Gl12+UMvtMa5/o95gkGEoX1B418gie1PU1E5p+1cNEnqgAcw0EOmnzNeEnH?= =?us-ascii?Q?d6lcg0I6oZUIIGMUzIc6EbFtnIRKNd5aaFnvWdXwFiGKksITLHr19lIFNK8i?= =?us-ascii?Q?pC4SB4H32+psjvKc31z0dQeGF3uRySjPybMqS+3oXdO3kKkEQ7+CFOdaROMK?= =?us-ascii?Q?5uQXwiBi8uvSS9PN+Vb/DTT0tqy9hz9023ivrpasQZJ3M5QBpwnfJV5CbG08?= =?us-ascii?Q?McYxWGvHiXp/5qKt0ufz66UzmpfY70hth/n7Kkoa9cKvWuNRkNM6uKAwfoEi?= =?us-ascii?Q?4Y4g58+svzUUKPBH10O3TYm3l8i0V+jqLCNQR2kr5i6Fl0+4hPQH9/nzOlNX?= =?us-ascii?Q?Qw1IMxoJyz/SbfsDw3udHO02ghH38pxuJCIyHQnKMTz5qkuG4cJToloepIMw?= =?us-ascii?Q?5XB8+H1Jm9xNxvuNQzq+3xmq9iilWkDQcmHMLca7Z3lvveCBdSS35MjMGlTF?= =?us-ascii?Q?jheGC65mL59BvyvcAr/PLhfaG7a47KVEEXOQnI3n47gACkJL+rnvGXI/IspG?= =?us-ascii?Q?jkDFWAy4nRqt0WdrY875jG43P7UoSGv9FMm3AOQwhtyaCGtTYVqnPQ/aqRDA?= =?us-ascii?Q?n/VXUwhK53uc03Vx7Cl8w2Uv+6nU4HetLt4qXQ6STNVsOc+JGwKw6n4gxxFv?= =?us-ascii?Q?+fo+F6FV0PjILwa1SIKhpD0dSt0DztDR1D/QbgQdHbI79Q4RyLQxGrcIW1Nr?= =?us-ascii?Q?e8KEFWPtAB+OmFA+2AZ2P5AthC5SRRxuM5C+xKLuwr2hLw=3D=3D?= 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:(13230040)(1800799024)(376014)(366016);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?vMeHlzzVEaMmV9iQ4IEOf6Nj1zN/Fgh90BHlLNsRvaA40E2U7dbF2m4aEybG?= =?us-ascii?Q?RvxLe7dPDBXfD/tOE4haZZNx4zoIu9xRuOlo5rwqtt1EXphZ/FJb2irQQ8X6?= =?us-ascii?Q?Uip40Fyp7OkrSeKPUBgR8gLj8tw9YxO5+adO053pjLXg+a+dGJSPzcZW5bl1?= =?us-ascii?Q?u7e6oNTO/nQGPscR9LrBvHhc0/QtBqNcSvHIkGGJkAo2TNs2E3giNEvAHzpN?= =?us-ascii?Q?uUgvtNi5yQKE9i0ez93WZA20q4AzG4RHVlLxvc4GVATr/yWpwcpo0fh48jfP?= =?us-ascii?Q?TSZBvC/Nn3slISBzyP0JGxNV05EKEPz8FbTn/Rjc5w7rMWl7krEjea57Q6n6?= =?us-ascii?Q?NaLntFfLZcSSLMLXylcMsr6LC3P2PZLk6MpsgKN0MfD6rfdehn4LD0zstJZ3?= =?us-ascii?Q?aycalARuhWYxizO9RFVazU3NWxLTgbxCJ3Nqi1OyWDi/W2GQOCq6hlzYFmOw?= =?us-ascii?Q?8Z1UPWrF6lUjw1MNbmFZKqn9HA9TnC05C1nwm7ByYeUBg4OeI3DIVmAc4w8G?= =?us-ascii?Q?eppVZKu4AlmwVFbdyY6ktgK618JTgonbF5t065UZnfODcS0yp3WB2FcWw9oG?= =?us-ascii?Q?zqlT/3rZxHdVUeYTccf7ed/ykq8d9TQzTiiQMy6bx+qUutZQJTRn0Oc0q3sz?= =?us-ascii?Q?luQ2qlYh/xf1d0hoC9oGD51ui6B+324OiPoJNpIRitzm9vl+huuxTPHSnMoK?= =?us-ascii?Q?WXcu/1vxqh0o2TEd9nJWh9vmG2zbL4vR5IloR6lSPhCvyeMGdhgjG2eNr2tv?= =?us-ascii?Q?GCqNHPXbvU9h31b99v48Qr3XWI/Mgqp6rc+CPIeoJIMbbH6+1CKVfu+2DEOs?= =?us-ascii?Q?POtR7s+3MY+06gEBgvdJKtQAKsUSCWoSwRK29KkiMTxHl2j2OCA1F8VZV+s3?= =?us-ascii?Q?Taon+CmIVU/vSHuxVQ/OrN2GR5xrpUkqaz0lcImP34EPYRiYNYziOThUUTC4?= =?us-ascii?Q?+uoX+zt2IK6Pck8evcQELoCykZj4mPV95cO1TbOvcWg2PR7rPsKyYVzBgv8/?= =?us-ascii?Q?dXrN5+CPoSlhjGFuCWdJ471JPtxXPDIli8QdY4o32KrPuGIwdrHP8cPvbFYg?= =?us-ascii?Q?PtobcHx2oUfkb3/JHJtG5MfectiNNW98TOdDOQyPrVCG/FbttLJwt8aX7Fh/?= =?us-ascii?Q?2tD7+Bt8X1V/MNWf+kW1Ou1E45gIxDl38pta8eoAZWTmCmxTzNE7fByoUYmi?= =?us-ascii?Q?jpSI0FFHm+0SJGu1WpgKDwSaED9mv75q5gbINsZNyAH8HptpaHBxkhD609nx?= =?us-ascii?Q?xwmKpdEHCbjzxz+pU38pJrk15Xx1ivExAkGQhc6RGIfBkyXye5IdcjPdzSMT?= =?us-ascii?Q?DMum+fZwN2JPFfOFyyYNk0kYiNAur/2ccnJl5SeaLR9/0vEC/rTwBDOw0T+n?= =?us-ascii?Q?0jgm5Uw/oLTgCLVstk0cp9mavg4pCRpoaZPFg3OrXRTU4zULuD7RtTybovaj?= =?us-ascii?Q?SZkySeQq+q9RHLRb9JYqUy156zfUr+bmtnWtgk90fnaU9iZKpUk5K0IJ2Ewh?= =?us-ascii?Q?umwtzBceKPrQhd1ewMzhr+wpTpDbgWUNLhQ9Slndprw9528Qjk1UKZK45JNF?= =?us-ascii?Q?IhEIcQWQt8mNQsM7CujQ51DIrhF5FWKdXCG1tmA05mSvVeqJmK94WIO2XNQ4?= =?us-ascii?Q?vQ=3D=3D?= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: UrXj5ehz6n9EoiqMKrwiId+D1Kpbl+L8xHfMuruQR1uEtyh9itDnjgywmJtnoqH+yD4+QBeSyZhlJKddoC+mup8FjsxtzilwBv8afJogOVbrAtGM9bh03ZrifhJi7gEDR2JRP00HTHvinEkP6yMf+coIEmIrv+ONAM7fCm3BbuPVgkvuUWfbkQQ35xQf6sb2S60cZCODCYGiXzR09Az8CIQ4Vh/cF5PVkc7gT3l6j765vA/ml1UiPS1F0SjaN6yzve57Hej0thw/qb5CCk1+7vuUn4m2ezfZDcBkjz8RB2XMRUqCppSA0zBzyUiFTPyv4zL4c9HJ6+1L33/6T3JgmAV2y5LdjU+quvLLc98VsN71DodGFZ8MFjl/Z+f8OQ7g84iKj5lVQ93HaxmnAHUVkjwduJxXrLp0LvmdyxMFayNrTR+XbwdwkliMJKvobCMfWNK3bj7MHXquj3Mqy4oDJVhuUbfBncyxWsqSWXwR3np8T9kiQg/djCu3gCPGrEah+f5B83JQ8wiIkWahnt6mqtRZiB3y+QouBN6ay5tIDeYsGIg6ir3uV0dUQ9ROCGT/v1kVnoH3lY0I65Hkv6Lo57Vd+BSsHjtwCjc7CFTlZmw= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 06b95ba4-0cc6-4f00-bdb4-08dcb247708a X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Aug 2024 16:31:48.1513 (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: w3fJLURSqSx6Vo6sgkhL7IJs0Knr/6sVUY2aqGPsaqerBc7K1QgG5yZptzrTSrxXyFWKpi13V6m/FGWwzxCyPw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR10MB6081 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-08-01_15,2024-08-01_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 adultscore=0 mlxlogscore=999 mlxscore=0 suspectscore=0 malwarescore=0 bulkscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2407110000 definitions=main-2408010108 X-Proofpoint-GUID: l9RbobgXnC1Yjq4b195jowR6EP8wqxgy X-Proofpoint-ORIG-GUID: l9RbobgXnC1Yjq4b195jowR6EP8wqxgy Content-Type: text/plain; charset="utf-8" For forcealign enabled, the allocation unit size is in ip->i_extsize, and this must never be zero. Add helper xfs_inode_alloc_fsbsize() to return alloc unit in FSBs, and use it in xfs_inode_alloc_unitsize(). Signed-off-by: John Garry Reviewed-by: Darrick J. Wong --- fs/xfs/xfs_inode.c | 17 +++++++++++++---- fs/xfs/xfs_inode.h | 1 + 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index 7dc6f326936c..5af12f35062d 100644 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c @@ -3107,17 +3107,26 @@ xfs_break_layouts( return error; } =20 -/* Returns the size of fundamental allocation unit for a file, in bytes. */ unsigned int -xfs_inode_alloc_unitsize( +xfs_inode_alloc_fsbsize( struct xfs_inode *ip) { unsigned int blocks =3D 1; =20 - if (XFS_IS_REALTIME_INODE(ip)) + if (xfs_inode_has_forcealign(ip)) + blocks =3D ip->i_extsize; + else if (XFS_IS_REALTIME_INODE(ip)) blocks =3D ip->i_mount->m_sb.sb_rextsize; =20 - return XFS_FSB_TO_B(ip->i_mount, blocks); + return blocks; +} + +/* Returns the size of fundamental allocation unit for a file, in bytes. */ +unsigned int +xfs_inode_alloc_unitsize( + struct xfs_inode *ip) +{ + return XFS_FSB_TO_B(ip->i_mount, xfs_inode_alloc_fsbsize(ip)); } =20 /* Should we always be using copy on write for file writes? */ diff --git a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h index 3e7664ec4d6c..158afad8c7a4 100644 --- a/fs/xfs/xfs_inode.h +++ b/fs/xfs/xfs_inode.h @@ -641,6 +641,7 @@ int xfs_inode_reload_unlinked(struct xfs_inode *ip); bool xfs_ifork_zapped(const struct xfs_inode *ip, int whichfork); void xfs_inode_count_blocks(struct xfs_trans *tp, struct xfs_inode *ip, xfs_filblks_t *dblocks, xfs_filblks_t *rblocks); +unsigned int xfs_inode_alloc_fsbsize(struct xfs_inode *ip); unsigned int xfs_inode_alloc_unitsize(struct xfs_inode *ip); =20 int xfs_icreate_dqalloc(const struct xfs_icreate_args *args, --=20 2.31.1 From nobody Wed Oct 30 22:13:17 2024 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 062AB1BB685; Thu, 1 Aug 2024 16:32:03 +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=1722529925; cv=fail; b=FwF3BG3s4tgsx5XmikIzXjNefOdTnZkc//r3xiQoomt6P4vLRk8W6adutOxjWA1is+2LoXE//r/DxEEKu5zQ/N8YD+mMhbsTQT7Tno7WN23aOB3TD9k4uZZgfrAXpzdDnF/LIgiHUCsm7PkJL1xIcLQgQF90RVigUg1RhH8sO30= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722529925; c=relaxed/simple; bh=hsE5Cd/KIR7uZAjw48M8B1/Vb2rYE3lT8W+MoOPY3SQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=cbbqPBkQ+72eiSimpOpaZM/tYb0XWHJ8cjVYSMXbLaO7chel4sYdaFtc76O49fOSG+iQzLudLZMLAifYc6PRw3lVQVvH0WNxt426g32R3APtMkwkqU2/C2BmCP6b2h9QJVnEA5XGdRYdNgZE7QdwqRmILTyNXFD5MW3hjqYmvEo= 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=n1KXPles; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=mJrKFhAZ; 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="n1KXPles"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="mJrKFhAZ" 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 471FtXtx023400; Thu, 1 Aug 2024 16:31:54 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=/mokp+9iiGpAswmtDttU9r8YTdVzCW4mBm26v+Hil1o=; b= n1KXPlesBp5lwN4wy0tjnwjfXKuJDtAnudlrI4nuxxE4JB1GP9hh6jayad2o8kwm LpGOIInsb6SUjo2d77Gkk8JNJj5+u4y5Lo7Ue69RNw6seTW3eetvNEwz0rZfa9OE SDaZXRmcQen0UL2kwb1aPDlI2f++QIEYssUtsmK6Yd2mYpSp3umXlkBMKTM6HOud HT2EGfbdG//INq4IroTYmwq+MwVVWo86rYhTcZyQhZAmH9pZiPp0iRzQv/2oIB1K htYm7aPNf8zr11PD8vtpp414oyDG4YkYD0sNJpoKY9DPJrRpDk9/Hw1yFqTEpeeT I24dmHQ9q/w0Tf5gw+xfTw== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 40mrs8t4cb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 01 Aug 2024 16:31:54 +0000 (GMT) Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 471GKsKa019040; Thu, 1 Aug 2024 16:31:52 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2101.outbound.protection.outlook.com [104.47.58.101]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 40qjmtvqgk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 01 Aug 2024 16:31:52 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=qSvwczpDsNBWeCeg7OnMBfsuisERJ2ZxcvTAfDfXy4/W99zuQFqLumpoObz9dpIqUDZeqWcqwkUHP6Cq2xXtWaKxLduGM1CJhFt3dK3vOne3Tad6TZ7DLE84fr2KZMFx512WXrlK9/asq8YIxTMrMRPW8QUswbV6qEKdi4J1QoeYwvoOM1Ma1+JazMC2WlDRX0GN/i467q9uLl5/S/CyGXmOdrlaDz3MpAxQrnTDc4bPKk64Hc0WliEoXZo8k8GCZiRML6ZvVDu0Sl/G1/R1BPqyGrevTysxhKIP7m6DRbNnEkcoTfzxalIYqclMMym7wG2g9T5S17UdPOpy8dQ3Dg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=/mokp+9iiGpAswmtDttU9r8YTdVzCW4mBm26v+Hil1o=; b=iRxEtxunKhYyO57+ShAtQvdm2vc6zu1JZoExAZDHBXxuhS/Wx6EPYzCzVpSIDIXGZ+26J2fAeXewr28g7TvYRt9jkPmM4pJE67w8mmE/Pcx+S7m9BmVy6h67fkfZs5LWuVfbfNkJ/SDMwt1uRNbWWFgsccroTPJzTnwP/EU4JosjWTvNO30hz7ZMzds193PH9Y2qkgiA05Nck1cx4P9h/cAGwJcUlHcvJ27A+3gHsd4XcKOX1ozXMBXLDBzs+fUHk8s5AqfWAUEHZ7cTQp36oIg6jxBPi/zltE4Jwh7deyrHhXI7UfjnXcq1xqMfNz2r/05KyqHK0ce+c9Kj1CI0sQ== 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=/mokp+9iiGpAswmtDttU9r8YTdVzCW4mBm26v+Hil1o=; b=mJrKFhAZf5eiVFed2fFnlEXW2ncmgiPLkc6eAq14MD1FHwXJnGl4BP17bUhfpHUnJU0rgaGSrWJDq2FQztKoVC8Oh81WRJqJUvFQz6Hq5tsYUO3WSGe7iY10IaCoXX4vl9SwnuAZJautvWbhnuFEKQA050ngEBJhwAeBvW2CHWY= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by PH7PR10MB6081.namprd10.prod.outlook.com (2603:10b6:510:1fb::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7828.22; Thu, 1 Aug 2024 16:31:49 +0000 Received: from DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088]) by DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088%7]) with mapi id 15.20.7828.021; Thu, 1 Aug 2024 16:31:49 +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 v3 09/14] xfs: Update xfs_setattr_size() for forcealign Date: Thu, 1 Aug 2024 16:30:52 +0000 Message-Id: <20240801163057.3981192-10-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20240801163057.3981192-1-john.g.garry@oracle.com> References: <20240801163057.3981192-1-john.g.garry@oracle.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: MN2PR16CA0052.namprd16.prod.outlook.com (2603:10b6:208:234::21) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|PH7PR10MB6081:EE_ X-MS-Office365-Filtering-Correlation-Id: 4723f29f-6d09-4e5a-4e04-08dcb247715b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|366016; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?fBegi4Q3Zo5ac0pI9hRIi2BHVBT0e6AEhs3Q7sJFwGqKaE33o3zHSFJSjgF4?= =?us-ascii?Q?ZdeFE/7qHtYpS1GBAgXzQMtRvAVAd3N3aWYe66DnwbQOaxIqwRths9Xh4CGj?= =?us-ascii?Q?V7zDtAc2dfd4dB0IqY9TMi3FBS6qbo/5NFGeLUresYbW+nLerTVPvDP00Uiw?= =?us-ascii?Q?aAHe9MZpFRYEeh7hibAzM3r+ro1wVzlrFTVlvjoW+F3fM1R0RbGCEPReiLrq?= =?us-ascii?Q?JvyMMq6kvr8TUwqnnO2TdplMB2V7nAwRb5+Xzo1k58EgdqLjIMeWjd5QZu4F?= =?us-ascii?Q?ytOlRPeiVbz9dwqvs0/x0U6jjKXgZHDdrCcTAMHsEhl8yudKxustMvTAPVf7?= =?us-ascii?Q?LmPwKUjOhnhGlBMmxxHS70DzyFhwJu8CcjNOUXP1obIiaXOJFDPZqxR01plH?= =?us-ascii?Q?IHF5RdfULiiPaNJB+wMEBdJFB27DTCi8/6w5LswNgGlT0RYLsNRpxzgXpUMl?= =?us-ascii?Q?B+C+WJnMYDhUyuivRdS3N7Xhl1Tw9vMGyZ7AkT/sKnG16BtkUNFhN8wsghLw?= =?us-ascii?Q?RvP7HfszlUc3bO33UoTsmDi+YWAuvo3NfRnVDtPEKHLL2poj8D4bQMYeAX96?= =?us-ascii?Q?fBm+Ud26l1NXA+s3qKIAlCPKnUeTpUtf3lR6W8hKbYg1U/6josZcqxv33v6b?= =?us-ascii?Q?XiFqegkaoObXrJ7LhGQHNaiY97JxitK8w2EKtuF6xGdi5bcgu8/qKhLiAWIf?= =?us-ascii?Q?1gPUacOUJAfZt7dZ2GCqmW6sF4Sr2JBeMGZPlqa/cDjTX8k96xcS1DdZkIL8?= =?us-ascii?Q?2gmpBXwZLU4OVlUwHDYsWYdohLaxfxpycN1Va0dim9HcyaleRWBxzWTNhv/O?= =?us-ascii?Q?l7GtJzdfhufR5AbOQD7HLq28YmmUoocench3PqoklbmWlUMu48xCP+xhmZRO?= =?us-ascii?Q?T1ZISZrc3L5635xn4Skpmgd4X63tfOqQ3HkjEB9El3RBrqYOf/KwghIlkyZs?= =?us-ascii?Q?b6snSifcIh0jTjBJtdB2wrFAeODh/kbn8a6hPK48sNtiHCeG+AAjJIKRnB6J?= =?us-ascii?Q?u5T6drVgO7KrLZcsdohil3aKKGEbIBRCNa+PfY0mpHvvIl8z+w5HoIVM5SJk?= =?us-ascii?Q?eTcXDB3mSkqeokXrnRUruEb0ANk1neGg8DCoPo2E3cqV8MfxbSZMOE78Jzpw?= =?us-ascii?Q?99Gjs4wkDS72nx8+66qZ6mvHs9D3Pa9CRJqh5F9rs4lkNY1M8BtBcPSmgqkr?= =?us-ascii?Q?mRvA2Csrmqjx1wU6aifbXJH0c1mVt9G15jlu3DFJRBOvdY9ht+UnePGTSE3Z?= =?us-ascii?Q?96TRFiV9oNslJEuOZL1juMTw6ey84/9i18cJvVDRQDcQ80tngWSkQfpWk0to?= =?us-ascii?Q?MX56f6QtWudFgGA8ekuBgFxQUaDpO3aZfnDIKCQrmBUi+g=3D=3D?= 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:(13230040)(1800799024)(376014)(366016);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?ER2iG8z5Ny0PPfZc8kA81J68pNGLWTg+tUZga/gZq/iFhYHJmuJJmeh1lmZP?= =?us-ascii?Q?jQ7ewXhqPmqfVrolRV5fjXsJgZpqNoEDLHYWjwkpkYq9EBRh5tmhkq09DxT9?= =?us-ascii?Q?Qho3Nxy4W8bD9Ornj4XktP5FcAMhnH3RsNeJnenCm6ILKY0FrTP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wd46NNSg3Wz2eyhzXPG5/Qdmfzc1UBxOl?= =?us-ascii?Q?1M5miNjRbtR6YRVJ4VdkzA6p+9gc/tJP7KawpL+E18IWA9kWOac/iGNmMWbv?= =?us-ascii?Q?vXQ7HlY4J2jq5q8Jqx0RZZA5CpNxvR1pgNaykUVeGgA5SugeDR8F4MrF+wN6?= =?us-ascii?Q?5kpTUEfaqAarqQREVYbv01PY7kDCXSTQz3is/1JRadnu7ApagQqknAf5N4yP?= =?us-ascii?Q?LyRlfiBBivMEqmIhfJPnXAQ3JdCJY1RdNr/Fm5yTc1buhuZ7Nu/mn0wdjrmb?= =?us-ascii?Q?Y/0R/0cItbDcsBguI7vf5S8asCTkv/D3/3D3Hdtwc9QjWODjqmq2Eds1ahNc?= =?us-ascii?Q?DrwsseuvWVuZsQ5UeZQij0jjD9cGNZIs/vLs5a01yMiM7UD311I13zn/RLRG?= =?us-ascii?Q?b1b3Kp5/RjBhD+w3ttecxtIyrRxH2+Y/l6nAoomRc6qVb2lHuL0feplItz7Y?= =?us-ascii?Q?qDdsKHemCam76Bs7GNF0TWCB1+nSHJ4gjvLA8XPQuDazUnKo+3cXq8HVm0Sl?= =?us-ascii?Q?dHXG13B4xJ8irwzL7CcPOxghtrniHvnu+pzuyvcGikfdQExRBDdmMJ41krwP?= =?us-ascii?Q?ag=3D=3D?= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: m/ivzNPYA3EiiHUZ3oKZqYsKB8SPrcivzxT4TQL9+jDZytTM5SKYkv/KFUkVa52vUDaBR5YJXSTFNzp0JyfHTvanSEUn38Q9adBFEXwFsgwttE+JZp4A4IOAurONAcxU9icRsx+HFdzTBPSQggdlnRx15PVFJygePwGgSnvgL4gNI2JmGatWzZbov04LHUNFY6mL8DGooi3H82WOD+/66jq4gnjPvDvMT6eOcMKrBuyv7VAkafzN8V/p6M2EUI8LPXrnjdQfRZTsLJI/pxUvrL1A4KByG+Of6jed7wH44hkbEpdIRJG8by+rREaP7WZ3u4v6QH8KJwumVWHuJ8DQe1GtPeNe3C70q4i3gcZIIFTP9E8eH6GoEXIuhWpIXglgn4zi5gFmyuKebo2yCfKKT79gxf2yj7sQpNrWfC5s/b4ZAY8UoTkq+D8w4mR1VIF8dFFlsi15mFL7oQpTt41QQVRJvy5lmiBJb3bmNWDzC5zjXDLQxK2i+bZHv8pH3TtwQ3biehnyxpKdfSvmx3mvG2ajkCsQhrarg8HSZUS6eb3uHk0ebjUZz1X6wqJ80GDZ/b/Hxt7pIOcYb+hUDWnE7xcogqgOAwTr52TSGHchM4E= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4723f29f-6d09-4e5a-4e04-08dcb247715b X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Aug 2024 16:31:49.5438 (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: qISEzY2KRolmKZKhRpUdrPGkx/fUmqXQpvGRzGFoa2Ayct3/rIF5Q4+6y0BcT21fhiDXGh7B66kWdJrho01uNg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR10MB6081 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-08-01_15,2024-08-01_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 malwarescore=0 suspectscore=0 mlxlogscore=999 phishscore=0 spamscore=0 mlxscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2407110000 definitions=main-2408010108 X-Proofpoint-GUID: GCbFvC60IvfQNxoFA7obwlBlE8XmgnHb X-Proofpoint-ORIG-GUID: GCbFvC60IvfQNxoFA7obwlBlE8XmgnHb Content-Type: text/plain; charset="utf-8" For when an inode has forcealign, reserve blocks for same reason which we were doing for big RT alloc. Signed-off-by: John Garry Reviewed-by: Darrick J. Wong --- fs/xfs/xfs_iops.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c index 1cdc8034f54d..6e017aa6f61d 100644 --- a/fs/xfs/xfs_iops.c +++ b/fs/xfs/xfs_iops.c @@ -926,12 +926,12 @@ xfs_setattr_size( } =20 /* - * For realtime inode with more than one block rtextsize, we need the + * For inodes with more than one block alloc unitsize, we need the * block reservation for bmap btree block allocations/splits that can * happen since it could split the tail written extent and convert the * right beyond EOF one to unwritten. */ - if (xfs_inode_has_bigrtalloc(ip)) + if (xfs_inode_alloc_fsbsize(ip) > 1) resblks =3D XFS_DIOSTRAT_SPACE_RES(mp, 0); =20 error =3D xfs_trans_alloc(mp, &M_RES(mp)->tr_itruncate, resblks, --=20 2.31.1 From nobody Wed Oct 30 22:13:17 2024 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 2F8AD1BB68A; Thu, 1 Aug 2024 16:32:04 +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=1722529925; cv=fail; b=KwG0D6y/RsxT/1rPUq/wMRGv316hZZR/d7QcmhePgY8OI9L8jyjRgf1H1GlQi+OEzpEs3dslorqn+ZQt69HIoYjPcTe95P3ChBGq4SmXFzqE+bUu8zOFhirfyfWx7GKOLy7vd55qt45IBKmYSBiHkNwun7+dD0MILSq7Mpr4Hok= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722529925; c=relaxed/simple; bh=ALPxfIOW5h5ScSGEkqs19C6Fme34Aq3Q0vQRV90Oh9E=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=fOtnT5iaj+FUSz4EScTsqw9aMltdaKDtDGEsNm/fc9TDVSpKXNE7xOSLAlpAvvIUlaiolt7CjuvAhNL6nEiUiZ4URMyizsoRLQpULI3iwmeU+N8PL96wvRCpKYbKm9/CngxHHdTT2FJFbCm5P9RvIVsiDlVSGl6HePmcpeJgggY= 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=oOfDJpK+; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=Gnk0Ha6p; 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="oOfDJpK+"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="Gnk0Ha6p" 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 471FtXu0023400; Thu, 1 Aug 2024 16:31:55 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=IryypLhLwt2cksvS7FNZrwLvr17cR1QbQlsUhwsl8GU=; b= oOfDJpK+w79T33ZkuRuuyGYy3srlF9rfGivWdEheRweXn+g3sPoQPxaW80Sv9CAW bd50vsAT0PtcyAreIX6XIpGgNJggyfX+xTXsFXkWO46a3R3QSzUtsL3EaxC/cYpC 6BUAbKr78lNMHR1OnFVlWthtJCDpBgOcb5HUOSDP3LM6PTZliKo5wvFswjSbnAk/ Y2MXWGswWoaT/ILxF+Tnk8GChhSr2eZ7Th6ASNfZD+G+2oIVSIeTKkuthX+gJVt0 FfAYGte79UoaXwa9hZg+nct0zdpmtFh+Z3LRieXZEQD8wtjtregO+7hL3MWi/KFw ymPlpuV4pXiKP8zofqqXkQ== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 40mrs8t4cc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 01 Aug 2024 16:31:54 +0000 (GMT) Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 471GKsKc019040; Thu, 1 Aug 2024 16:31:53 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2101.outbound.protection.outlook.com [104.47.58.101]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 40qjmtvqgk-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 01 Aug 2024 16:31:53 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=aKN5M26kY32Ed2v0e2ZbiVMSTmGyvBTxVfsqq6bW+ifX8JBwjTlJ+qYNu3m8VZUj6CpF+7HTPGwT7WuwNQytL3BGDqTPc1ZMo6psjae2GSDJoRLoJW4VXqeD+aA/Q7l3OyN2i5m5q7W0yhCvFaaJjclk7q5zVmBrG+am5AfcadgTq77n7V0laV5rach/Sx11ZU0OieT4o/HC3UFOX3RBAwHjghDf3ZWV2wiiFDjZTV0Ft194Hz+5cMPib0Wwt4CbMBmkFBZcnVfm6i3i7JOL+nta/PHXdpMlotXG67AFQnEGcpkjgSzG+Wi3YxxwZd+MdIjNlFmaJCQlt/x7Aa6Ybg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=IryypLhLwt2cksvS7FNZrwLvr17cR1QbQlsUhwsl8GU=; b=M2UbD+ztVJ1gw0kmZCbkLDoLebiyVI+cYkIDVZnseJrk/b3F+DI237ewJfNN1ZrlPuocA7svaqFGg1waXud8Jse0FROGGTYku+Na0r3YqpI1cEVD3sea0h5bLH9f0bRvKkgZixawhxIpSFcToD4rPi9hOiY5N2u3al/m0k6yglguGc5DE3Pme8d7lg3F9IaGN2DO4kwvmLqDY4xbCTIiYDMTPvkCOiBWyErTkwuHjjAP/uDcRq4ozB0OhOxFZU2rTWQ9T2nZCztuM1SShDRDt0ZqAP2aPWOK1GoVhjdw6DFI4fl47pyGLH2l5UMtSKXbmR5R7FGGIZO3i8RoRE2hNA== 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=IryypLhLwt2cksvS7FNZrwLvr17cR1QbQlsUhwsl8GU=; b=Gnk0Ha6pbFDR5JoB9uBtU8yCSmfh+2HG8NAdSHIFIvpKhOLOGY9CmI7dBNgCdcNmptfiZ5vABtkGnI8qJK48FU+wSXPOX0wf5/uBnGs0Nf2f7VFsdI6w17zaglxPWkpgeib/9zuF4U2QPOfig9kqQxD4b3VRF+5yNM1QfzTr3h0= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by PH7PR10MB6081.namprd10.prod.outlook.com (2603:10b6:510:1fb::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7828.22; Thu, 1 Aug 2024 16:31:51 +0000 Received: from DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088]) by DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088%7]) with mapi id 15.20.7828.021; Thu, 1 Aug 2024 16:31:51 +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 v3 10/14] xfs: Do not free EOF blocks for forcealign Date: Thu, 1 Aug 2024 16:30:53 +0000 Message-Id: <20240801163057.3981192-11-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20240801163057.3981192-1-john.g.garry@oracle.com> References: <20240801163057.3981192-1-john.g.garry@oracle.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: MN2PR05CA0047.namprd05.prod.outlook.com (2603:10b6:208:236::16) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|PH7PR10MB6081:EE_ X-MS-Office365-Filtering-Correlation-Id: 64578665-7898-4e6f-b632-08dcb2477244 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|366016; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?6kvxrAqyoEqaL+3XhpIVKDhbRRtFit0EfGpyixfzJbB3nu/97FGJ4aZvQHDZ?= =?us-ascii?Q?lhlle37nOhqAJd/u61FH+rjk+jP56ozQuD4IPtOE7D9eYGyTGlxyAmZAZU6Y?= =?us-ascii?Q?06TXhT4UVfdskrgg2zCOODJgEzR3A6Pyk28KzQQmfqnSdY/umyim4evuMFJL?= =?us-ascii?Q?202GZobHRCHfv0r19lsNAEyws0yvhxPF6SGRb92A3MYS2orjpgkuciMYa7iQ?= =?us-ascii?Q?8Qjg82cHBKk+i+N+qqu4AVYeu5fj0MBWNMsqSAEu8vrSu00izoSzQZfCIqKT?= =?us-ascii?Q?cqjxSdf5ojgQ5XTaDYGpQvm5LzGE6DYAqwrPRJmilzqnXSbs8GA6bv+SIvwe?= =?us-ascii?Q?ciNNzUMn39CH7b/jzkQuSnK4Q08EwoEj3j6AVHYnb+bCSNGqihYCCNLGD90p?= =?us-ascii?Q?tei3sorqhUcOvHERTKX12ACyvnZ3BzvMRDXF7gX94ztEFnZyeBx2g30U0gV+?= =?us-ascii?Q?M/ghOZHuyxcKBF2JSfpxleGkQ7KVUfcyaUNyh7zanC6hEJCCW5quwSXyMZoY?= =?us-ascii?Q?adpIXoLuwesDeLrp9+No73m13fK60kpOdh+PlIyfCy0TppoixqefNXW/Tvo/?= =?us-ascii?Q?0YFfAxiXqdVzop/2MIowcWxVNQg1yasQjNdsiYWLQpBnkaQ2RYu6PJz0nnWD?= =?us-ascii?Q?dDLVCJO2mvGZfdCj/mFx3YOntQMDimIzmw4KaHSaXIGnMusNew56qABLyw6/?= =?us-ascii?Q?Bn4SfaBJ5WZ31dXAdh5TWrnesBjdXKpMaqEu6rJbBffrGXaYq4EwWiuFPbc4?= =?us-ascii?Q?ft+ToTpPuvvrt7pyiM6YgT4fAbPUZtNtYp5K7JzK3K5+inpEhi4q2AEKk0LA?= =?us-ascii?Q?H5mmxr97QHjm9R20LbUomn5wCW8xZxLn32vFZgqf316p22aSsDPpDbg/OWa8?= =?us-ascii?Q?EvQe0QoQvx6OIZrE8AHUP9KHdi5MMkhQa63l3/1BvsaNUwzuL7pIZcwsmRHp?= =?us-ascii?Q?m7xUxcJrGACiUGXL2MgpuHdgDIA97jUvPZNabV449yhYD/ltbkQDyJH8Z/Ix?= =?us-ascii?Q?xqhRNfaLTIsxVzDYaxpsVzkyT/PkwJ6JhOtayOOIZWnShuY1CzCOPel0PnHJ?= =?us-ascii?Q?OtuUd0W0I3S88n76+drQ8pd2y9Q1B/yUzDBCAHcIu9f3/rv4iQ5OTbEwrarj?= =?us-ascii?Q?euaO0dXQRyeoa8aeQz/IGuUHCPjAS+DXWsjn+mpCzlXCwyWuqj7PZTM5pf1y?= =?us-ascii?Q?SMmQgbazTsOVJzH9bSmXzXVycl2JiqDgbcpGnDQ5E8PD42nQxUVt8F4aKzJT?= =?us-ascii?Q?rce9C9Jis+c+tpilw7pBRc5L4y+C+MGKjXiew0lfAnM2id831/Yc6f8waiM+?= =?us-ascii?Q?nJI/OurEyjvRzRSiahkmkujs0rvtDJA1gBagx1aQodvysQ=3D=3D?= 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:(13230040)(1800799024)(376014)(366016);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?ghzZ5MyMUb0hGOgpFsq0wxi6OgmKY68ExnERrvgpH4DHUSGcs85/+7Et4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0mVFeHjrnongEfoLgkRu?= =?us-ascii?Q?2HuiFt0X7DAb419n3JuFeFtSPZHwMeULna3rsu6YXVVHb1VDCd2/g+9ofLja?= =?us-ascii?Q?P0YW9MpYiJSM3Yf82SRiFeFm1GqsnHR2AaQFk0nCLWNKc0ZfGwlzp+lSxc4p?= =?us-ascii?Q?5h7ZOF7VCWAiiokjaM5XqD195cznkGKDaFoGG2t+54L2ktzfGfDHCoXG8P5o?= =?us-ascii?Q?CXvwIBQYPZ2YVwVbajP5XeZz/gkHLD76GoKyB37EO4JP57UXoHSQLzsg2+4v?= =?us-ascii?Q?xHkxZASFjCSyZ+yt6BpdrbHAK+Ol+m9gj7mULrTaI9tp+OPATyiQdncwe1Zk?= =?us-ascii?Q?EVUgg2TyqzJvOz1qiFiv3ixmqj2wEiZHAM3oidTL025MYIbDgujJxx+RQgBy?= =?us-ascii?Q?Zfipnpe7XiiADWGVGmb1/Sgb6DB1of3Jxnzg4FkWEWTxPLpys4IdalteCaPd?= =?us-ascii?Q?fzrKbVUt0VVSr2cR7ejioD8d6UzMtMeeEbLoUWhll74vlrtiCYhKPU28E59B?= =?us-ascii?Q?O5FpbWx/HZbdi/dCzKTGSAhhOtpynM/J9t64qS6nkHtt05mRjtkfha6eMpiw?= =?us-ascii?Q?4WZtbmWFIGCDVxHqwtXK0MVKcQbLb2cf17Jo0ztWBqFmKeoPjfqZugFirPPF?= =?us-ascii?Q?+K63qIHxfztHoZVhRNjprdEYk7S/c+FEcW2+9oVN1wqY6F7m82eyIuCgplBL?= =?us-ascii?Q?bQ=3D=3D?= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: bRusGkrG6N8K5jY7UY+i5VEiGQLjhC3HHrYTbLSrWgu3kNANJaan6x6GWlnhThLzoqdNeeHGkEK/P2knu4HFNs1Q8IwPrz0ZOhi9/q8YaP03kcep+Y3OAheHLAnt8yGazz8EtmTTTw6scTNuxyO8aID7luejCmSL3A4JJIvMmhsvNC7wJEuYK4jtxrRrsVoB4ViPS9yS9Ma2sV7kx9OHdo4gSl2QjuK5klOKC3wY+MxyRtoVet1Yq8YMZ0abfa2ArWF2zGHEZJl08l2b2LAOh4ROuOuDW3BUQKdf0debs46ZPjMkg697Y2SCc6yAC2cEKXjZNQMyT46vIn2j2IMYGoA0+Gd8mCrOjNB9kljR8cPWP5XETvJFZx998cKrcaGsyDKq6IvWOvJ09q9NBzk13j0JA22V0Iy5NHSodQjLXiUbj8r27vBDtbR3pcoe0M6rEC4oH/FCqNAMjgMBOb+a0k613gjfegv+eAWnrIW0IVNUY3DwBY16Ws2+usgerecL6yE+PNe4f9Wc8qlAdDJA4Igyu92rLv6TWWuibkvreU7e0lUJ/2q3wY1keW7gsYNPBU592oM75TlxNG/gEvzcpxfGzgZjQnrh5VKRzdJqmuc= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 64578665-7898-4e6f-b632-08dcb2477244 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Aug 2024 16:31:51.0604 (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: sctp/MtCh/rgFhTIB8P0fzVLqnVZ0f7yd+LijaH0SJnMbk5y1noA+4VjXxHUMfczwodk6M7Lh5hzQw+OmuTREQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR10MB6081 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-08-01_15,2024-08-01_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 malwarescore=0 suspectscore=0 mlxlogscore=999 phishscore=0 spamscore=0 mlxscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2407110000 definitions=main-2408010108 X-Proofpoint-GUID: s_8WxhqaUvHJKosUaJgp5Cv4XriYZDEo X-Proofpoint-ORIG-GUID: s_8WxhqaUvHJKosUaJgp5Cv4XriYZDEo Content-Type: text/plain; charset="utf-8" For when forcealign is enabled, we want the EOF to be aligned as well, so do not free EOF blocks. Reviewed-by: "Darrick J. Wong" #earlier version Signed-off-by: John Garry --- fs/xfs/xfs_bmap_util.c | 7 +++++-- fs/xfs/xfs_inode.c | 14 ++++++++++++++ fs/xfs/xfs_inode.h | 2 ++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c index fe2e2c930975..60389ac8bd45 100644 --- a/fs/xfs/xfs_bmap_util.c +++ b/fs/xfs/xfs_bmap_util.c @@ -496,6 +496,7 @@ xfs_can_free_eofblocks( struct xfs_mount *mp =3D ip->i_mount; xfs_fileoff_t end_fsb; xfs_fileoff_t last_fsb; + xfs_fileoff_t dummy_fsb; int nimaps =3D 1; int error; =20 @@ -537,8 +538,10 @@ xfs_can_free_eofblocks( * forever. */ end_fsb =3D XFS_B_TO_FSB(mp, (xfs_ufsize_t)XFS_ISIZE(ip)); - if (xfs_inode_has_bigrtalloc(ip)) - end_fsb =3D xfs_rtb_roundup_rtx(mp, end_fsb); + + /* Only try to free beyond the allocation unit that crosses EOF */ + xfs_roundout_to_alloc_fsbsize(ip, &dummy_fsb, &end_fsb); + last_fsb =3D XFS_B_TO_FSB(mp, mp->m_super->s_maxbytes); if (last_fsb <=3D end_fsb) return false; diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index 5af12f35062d..d765dedebc15 100644 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c @@ -3129,6 +3129,20 @@ xfs_inode_alloc_unitsize( return XFS_FSB_TO_B(ip->i_mount, xfs_inode_alloc_fsbsize(ip)); } =20 +void +xfs_roundout_to_alloc_fsbsize( + struct xfs_inode *ip, + xfs_fileoff_t *start, + xfs_fileoff_t *end) +{ + unsigned int blocks =3D xfs_inode_alloc_fsbsize(ip); + + if (blocks =3D=3D 1) + return; + *start =3D rounddown_64(*start, blocks); + *end =3D roundup_64(*end, blocks); +} + /* Should we always be using copy on write for file writes? */ bool xfs_is_always_cow_inode( diff --git a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h index 158afad8c7a4..7f86c4781bd8 100644 --- a/fs/xfs/xfs_inode.h +++ b/fs/xfs/xfs_inode.h @@ -643,6 +643,8 @@ void xfs_inode_count_blocks(struct xfs_trans *tp, struc= t xfs_inode *ip, xfs_filblks_t *dblocks, xfs_filblks_t *rblocks); unsigned int xfs_inode_alloc_fsbsize(struct xfs_inode *ip); unsigned int xfs_inode_alloc_unitsize(struct xfs_inode *ip); +void xfs_roundout_to_alloc_fsbsize(struct xfs_inode *ip, + xfs_fileoff_t *start, xfs_fileoff_t *end); =20 int xfs_icreate_dqalloc(const struct xfs_icreate_args *args, struct xfs_dquot **udqpp, struct xfs_dquot **gdqpp, --=20 2.31.1 From nobody Wed Oct 30 22:13:17 2024 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 807DD1B9B3E; Thu, 1 Aug 2024 16:33:04 +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=1722529986; cv=fail; b=poexzoXv7pgQELwVyEQD6Fow85Z5+Bxp/xM+CNjIZHpMyGbbEYmyFRUzUY6Q8zjZhoRANFJXT30EpZUdyBz4vL1UETANZG9ZH2aNn95UNvVf2Y3Lb7AUy+pCQJhjUbvrcR2oFulnr8vcw2Nr91K0nx6D+fvwy7Un5bs+rfn7A3E= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722529986; c=relaxed/simple; bh=xhsvC9cidv9VYbCIeNPD2NCLY42NJYVfpiENnXzylNU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=Qa4U+ZkvlGkM9B94NAgQM3P8JI+lqKXgJ6fxBWOX0tZQ/hN7IafZFbroBG6o70WhasDozQu4+w5YgEhNjVT9XWUEC4Ijp7kyM/axhjK7aTNH6tJcM8UhbktVFl9EEn9zs6TKi6NBogadCsaYpiAjzTk96QViwtz7vOjHYZKIktQ= 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=VlmoDC7h; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=JMS7toY5; 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="VlmoDC7h"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="JMS7toY5" 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 471FtV8m028570; Thu, 1 Aug 2024 16:31:56 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=kq5rdor8Yi9FDOU95CCsz7JWSI8FSkRGonKqONH+dS0=; b= VlmoDC7hcm/asKF5XG/0/g9HLEyC203EPcBf5twFTv14y1igd6ObU9nr84ULhIq9 dB658sa6b13bxTFuxOQn6UPRbzgYMif+HeIjO1VaIqND1fOuFPOF62rtob1pOoic dpdXvEL+8L4D5a4jEcapJci8gBjta2ivyErNzDrInDgV1mC3bnu4zRq7X7X+4TkF LZ8tQZ9OXiMEqD6+jphvfzO1gFRVFxOnT0ZYMAdCzhiQXO6q42le66wyuZgmcicm 3lAq30kEHQKGJQyyjslnI+sz0EVwAKzsmZz9umtGhjSRkq3N9T+vyqx0tAnsbRcj WCjyH5KOwNea5Sd+6tmDHQ== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 40mqfyj77q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 01 Aug 2024 16:31:56 +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 471G2Pf5005795; Thu, 1 Aug 2024 16:31:55 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2168.outbound.protection.outlook.com [104.47.56.168]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 40p4c3404v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 01 Aug 2024 16:31:55 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Nlx9e4pgs3CiRg7o7WWYDolQAeb0R2GYRHAn5lGMRdVMJ/LUc7llRBTKb93rYSkb1p4JiBFLbXRwBgibovz37SQEGyv0RHs9LKZYSbmfsHlvBKgKEk9M6SsOjylBsHNLwzo3EPjEgg9ETLK++nrKoF8VAFsLyoA2muznzE3tLHP1uosd1o8QRrLC/afsJLp6qVyZ2a04ZzcfYi8UreSRv8Yk+lPeR/K8F9fDhsbbytm2ztq41FM3jauQWVadbMJaI1umxdvE1HR3C+RfYiY9zhM/YrNz/7vb1SD7bf3WD5+WQI0UHlni7B+iDX+dkpsQVFTZvLOL2J3BuX4+7u3okg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=kq5rdor8Yi9FDOU95CCsz7JWSI8FSkRGonKqONH+dS0=; b=hJrHqzfEyV3iDsB5bmA27ARDiIhv2ubhXH1vJBpcRNl041UMKt6hOmi7JpotL/VxmCBKVUoWMqWy11CLCzeyZkn1x+8+VlddtkEexZAXn5quV81jjVirIwXMz8PU1JGVHnxaRh+68mUDFawgcTfIGXLP8zAliGMO9wgF0UBWLsNguOCPlgOcN5HTMo6UoH+QHYVVUR/mp04XBMX8JOpDaH1kmJZRFRGIvGsSVFSCMgolLcN4fs8zdF2nKueFZoesIWhgrUOwB+8vOEsf0losUbF03XpPsJ3xJwX3dyV+ETohJ770ToagfZBPWPeXAE11Mkltv2kOs9RmwfVZ9vKIzQ== 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=kq5rdor8Yi9FDOU95CCsz7JWSI8FSkRGonKqONH+dS0=; b=JMS7toY5dSZC5pzqvQzEMMwKoRWB1KaXhPbYCxfGHQsx6O82I/iEYBL6dJSL/mwO+HISzdiuc3lPRuxp+bZlSDtzoX14t2uQXgjLIki1dXs8T7NLq94NZTS28gBekj2Btq1zu+a9NtQ2f99aoYU+zlH+NKoc6HAWQYu72d/xKws= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by PH7PR10MB6081.namprd10.prod.outlook.com (2603:10b6:510:1fb::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7828.22; Thu, 1 Aug 2024 16:31:52 +0000 Received: from DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088]) by DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088%7]) with mapi id 15.20.7828.021; Thu, 1 Aug 2024 16:31:52 +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 v3 11/14] xfs: Only free full extents for forcealign Date: Thu, 1 Aug 2024 16:30:54 +0000 Message-Id: <20240801163057.3981192-12-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20240801163057.3981192-1-john.g.garry@oracle.com> References: <20240801163057.3981192-1-john.g.garry@oracle.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: BLAPR03CA0028.namprd03.prod.outlook.com (2603:10b6:208:32b::33) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|PH7PR10MB6081:EE_ X-MS-Office365-Filtering-Correlation-Id: dd58defd-9cb3-47cf-e255-08dcb2477306 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|366016; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?GnQ+9w0PSCNaksz2ZpKw5RZn3pqjQ54a4EdT8EgNtKIxOkoK+2q2lGVkcyJS?= =?us-ascii?Q?qDdiHZWQKTPSy0laz5xHJaMTceci7ckaivA+OximRcxKEqEHxpH2MKDGYoHK?= =?us-ascii?Q?yfCgcJmRFc3xbC2S0huPi4PsflSIN7sfitchJoZqvHbtrouZA3rAOwDuIfaO?= =?us-ascii?Q?Eh9BUYB0wnZeTSdNfUX/RCBSi/tzwaHM21cpHfdy2L+aR2zTtSVRirMU7PPT?= =?us-ascii?Q?wF0RumkGw8n06OI/ZQOIP3zNYSwBUuVIg/fQdKtr3d7gUKEJvuLDcULKdIjE?= =?us-ascii?Q?psrMvE/iAhOP5J+gBo+W04LwY3n9omunK4qioebIIGImP8FehvSSSOzLEpjt?= =?us-ascii?Q?tRTURi0rWJtcP0AqZDkBPJRQ5rjK3gjApXttGbp9S+pIGvjKUqkIdXFF5y5w?= =?us-ascii?Q?a5bLsMYWbk4cFcqnus2S/kcuGUro1erEFyPs0jACAuxfxUYzunHOPfjuDdYC?= =?us-ascii?Q?lbQd2A2Vuf8gpO/UGl3IC5W9CBgHboYWL5Zmhdpakn85JlU6fM1sp7efTSvR?= =?us-ascii?Q?6vn2bHHj74Z3EmdE26MfcGIISsEkvbj8LB5ewme6PoYVckxGbUW+SXem2P/3?= =?us-ascii?Q?VM+1pdUUnFKV4Mipqylmn0PGxGoFjfuvXP783WQ2roblMWSkpyzwgAZGpVev?= =?us-ascii?Q?CpE/H0tnqT3VYTdNTdUa8o9wzLdKDSAkp+chRsvT09x6oBKt96ehnco9VQnL?= =?us-ascii?Q?uhGXdzvu6NUKU+W8w8uOcXmUUn3c8idg5HxByL1T5PWjxIF0zsIQjpGxGX4i?= =?us-ascii?Q?3ozc3YDhmEV0KuDj1V1KtducZJCOjsGnu1wB6mHeTPe8hBFrOcvp9rxF6Qxx?= =?us-ascii?Q?+MnY05CQoU/6C6KGXpzpXeLj0bCmzXhJxtPh9RHDiSDncu6ODauACaQQqO+1?= =?us-ascii?Q?oQvcP2I0yrzBpUB435EsuFi7ChyOh46K6UMgArf2rGufhME0f7r4+DoLJgB7?= =?us-ascii?Q?3Qhms0Ts37HT5FhykX9R/NQVqf8dghDmafhxmRL0VaDDgrGnVmgqwrSTCKUn?= =?us-ascii?Q?WXPKvDyVou9DA9Bjly8VCFzzSSjHNDfvA5Wd1qQoFkuy7rh255/O4R0bwToH?= =?us-ascii?Q?K25i1BmKrqu6olLCVFSzJquQZ8L4AhtRmVtMTU3kIUaS+09W0fCRzdrob+8V?= =?us-ascii?Q?ND9nWApU4RVvmqjrfzUDxJESDyQh7flc0bPfNkTclmlebnHlfKQphs1oj6Sn?= =?us-ascii?Q?6O4QAfISHrVHF/yj3vbsnCJD/iOBkWGWoWI8w0R7CQU2AZ5vCEwLvwzov709?= =?us-ascii?Q?Gty6lFdAifT4ubUEFc5ZbeCBLZkLo/cArgC0lhM6JEzLAL0SNV9Zxsi25GOp?= =?us-ascii?Q?tqNQPwfFcEBeb1ERVkw28Ie/E6RXfbr0ujbaLn/wIe51Tw=3D=3D?= 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:(13230040)(1800799024)(376014)(366016);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?myS035wHTs+U6DidAthEtgd3xLl7J9Hed25OsLKqETnd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DFMTYb9klCI18c9oDFIyTnTsYyv5VIYz82u42LwInt/qCENM?= =?us-ascii?Q?r+y6vpctHAp+4m4Mpo9aQF13APJVx3NTwv9JVgoJ5G6MicbtvCok+Iq+xfR0?= =?us-ascii?Q?3mLqCfE9aOSXRhDN10kwAGCnRJmnJF9UV9CU2wlyzMO+SRfNYSwVlnQr9b8w?= =?us-ascii?Q?0BGnZkkCoIEykgrxQelzTcnffS82ViJ2bmR9JKjSDbV4aVw/qdR6lxdma5NO?= =?us-ascii?Q?6SIWNbgcdbEF+nMwHcZuYIpw4LjIo876zkDV+U0t+6iG98LH5GVrA82+7kOq?= =?us-ascii?Q?nUWWPpdeMbGsoCqExAaK+GfzKQVQ+iTiBfTGH3kqxGk5SGkDhHedYcWiwjUg?= =?us-ascii?Q?dy9MFhTvqsFuM5fgUqKkL6ZtVSvq5uliI8aksbpAM68D3LbcBKj3U7Lbd5og?= =?us-ascii?Q?EjVzz6MAnnC2Y/k+4yKzPYADLsY+RoA+M7ls0h7o3cQ1qTAtgAG+fMk3CS3O?= =?us-ascii?Q?K2Ouhsct6PAl8JFUfoiNRg+g+imL6pBoML2Qpup2RjjVgiFaXpyqywfwAabZ?= =?us-ascii?Q?AwwcDNseVbYh6Z+m4womY4Bn7wJ4aOsW9P+lWxxh2nCGYrj69vi2ISdviYRN?= =?us-ascii?Q?/rryy87R7C8nkI5L4kSBNUrjjvzTPDPEVBpRLROeGXJ/ErApoWyce3xkdhWB?= =?us-ascii?Q?m2A1A3K0mpdX8kBsNi+L+tZyY6F3mgVTxJenTGUS7blUAcPe6t/OarATXqPW?= =?us-ascii?Q?1g=3D=3D?= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: H395D56k/4ck6gzKx88Mp2sYs4B825OCyXpvROMSGM9c5cOd6fRG2yqiMOEmKBowgFia4qaso1OER1e+h2c4jWohraFbEvEPl88R82anBr3KRJSSaS/cj3LOLIiHU0K704q4Vt/SDQs1KcH+NAo5CD1Fdqp9zR3E1q9/1oPZNyzzHW3UbdutyRPfooheTcr4cDL0zdGU3Otn+lMXdYUOnTuBkggkR1LF6VsaPwy3aoEOb8Ox9BLmjZ9wzoFEzMxOE4oylZuLe5advo4X8mSUMrVX68xz7/x5K9QE/CQlNO9E+nMxCBWUj8OTV+RNe41JfGmafBCA+vV/TtzPc3R2z7K9ZgELRxdhCD6N+pIa0lJLJiFP0KWAyoDXxUwVel2w6Rhh+sc6kDhiTpuw1tjpUG7zBqBgB9iSrKfYq+gFbaNN+ZpHwmUvL8ZK5FB713pij+qLvuE842gK/PAcg746VkQhxVVkR+1aVYu/i4Njj/i4VRcjjkpLOXlcJLUJ4dFvGOu8Aqdiq+cEhgzz4opHyQF9qrVj0fuSB0u355Y93FCALLH+6pT0Yrg0voupS7Vs8et94pPojeKzRj0lw1Q6VutEepGsAb632GKtifG1GYI= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: dd58defd-9cb3-47cf-e255-08dcb2477306 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Aug 2024 16:31:52.3610 (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: 03Xlq3jwc/72m7+/dlDGU7iMjuC5rW842t11Rc55tRywYkx99LmcIZxOSrVFnIm9N9jMNsAqo8T/5NDEyBtotQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR10MB6081 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-08-01_15,2024-08-01_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxscore=0 suspectscore=0 malwarescore=0 adultscore=0 bulkscore=0 spamscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2407110000 definitions=main-2408010108 X-Proofpoint-GUID: fnd7NPQpygYHB1Q4Xj812Zd7yJYO7zGc X-Proofpoint-ORIG-GUID: fnd7NPQpygYHB1Q4Xj812Zd7yJYO7zGc Content-Type: text/plain; charset="utf-8" Like we already do for rtvol, only free full extents for forcealign in xfs_free_file_space(). Reviewed-by: "Darrick J. Wong" #earlier version Signed-off-by: John Garry --- fs/xfs/xfs_bmap_util.c | 7 ++----- fs/xfs/xfs_inode.c | 14 ++++++++++++++ fs/xfs/xfs_inode.h | 2 ++ 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c index 60389ac8bd45..46eebecd7bba 100644 --- a/fs/xfs/xfs_bmap_util.c +++ b/fs/xfs/xfs_bmap_util.c @@ -854,11 +854,8 @@ xfs_free_file_space( startoffset_fsb =3D XFS_B_TO_FSB(mp, offset); endoffset_fsb =3D XFS_B_TO_FSBT(mp, offset + len); =20 - /* We can only free complete realtime extents. */ - if (xfs_inode_has_bigrtalloc(ip)) { - startoffset_fsb =3D xfs_rtb_roundup_rtx(mp, startoffset_fsb); - endoffset_fsb =3D xfs_rtb_rounddown_rtx(mp, endoffset_fsb); - } + /* Free only complete extents. */ + xfs_roundin_to_alloc_fsbsize(ip, &startoffset_fsb, &endoffset_fsb); =20 /* * Need to zero the stuff we're not freeing, on disk. diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index d765dedebc15..e7fa155fcbde 100644 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c @@ -3143,6 +3143,20 @@ xfs_roundout_to_alloc_fsbsize( *end =3D roundup_64(*end, blocks); } =20 +void +xfs_roundin_to_alloc_fsbsize( + struct xfs_inode *ip, + xfs_fileoff_t *start, + xfs_fileoff_t *end) +{ + unsigned int blocks =3D xfs_inode_alloc_fsbsize(ip); + + if (blocks =3D=3D 1) + return; + *start =3D roundup_64(*start, blocks); + *end =3D rounddown_64(*end, blocks); +} + /* Should we always be using copy on write for file writes? */ bool xfs_is_always_cow_inode( diff --git a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h index 7f86c4781bd8..6dd8055c98b3 100644 --- a/fs/xfs/xfs_inode.h +++ b/fs/xfs/xfs_inode.h @@ -645,6 +645,8 @@ unsigned int xfs_inode_alloc_fsbsize(struct xfs_inode *= ip); unsigned int xfs_inode_alloc_unitsize(struct xfs_inode *ip); void xfs_roundout_to_alloc_fsbsize(struct xfs_inode *ip, xfs_fileoff_t *start, xfs_fileoff_t *end); +void xfs_roundin_to_alloc_fsbsize(struct xfs_inode *ip, + xfs_fileoff_t *start, xfs_fileoff_t *end); =20 int xfs_icreate_dqalloc(const struct xfs_icreate_args *args, struct xfs_dquot **udqpp, struct xfs_dquot **gdqpp, --=20 2.31.1 From nobody Wed Oct 30 22:13:17 2024 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 F0A431B9B5D; Thu, 1 Aug 2024 16:33:07 +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=1722529989; cv=fail; b=fY8dhh+pDo6l2bG3uIg99qBfolcVHKIaTsJ00CoflH3Qa0CCTUOJXharO3StDat8CPg3Gawb3ZI12x/CRB4dJrTBcAiY1M+30gqQf5aX2fPoPneOcmRcuTED/cHD2L+VTaYnrbiNeoItCdIw1sMPSeeZNFbjD+Ef7PkWX4biq/8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722529989; c=relaxed/simple; bh=kKixtbCsgmYyWkkvplpexW1J1znwLLkmBFdC94PMiS8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=m/Lzzztku8Vghow6AtVveJF59YOA90ds6uNBeqGnXoHLrsC8y4V4E4S8NjJMR8cSBj7ce5xHX+hI/zatesczQPbWARsBQbejVlIZYE8A8wGObL4o494DaYnaZ3H2wHnA69H0RgL2Bwc2JY6UESVoCZ9LyeagPcAIOu3GU3sywGE= 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=eiZlTWRD; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=blpxOJrt; 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="eiZlTWRD"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="blpxOJrt" 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 471FtUOl002511; Thu, 1 Aug 2024 16:31:59 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=zGlHm0yX8TuYFKRUvbqZ8nfy0EEKrPkjhdyhgfCxWr0=; b= eiZlTWRDyIu7XUElQXctxV0iJP5o6b/TRAIkDt+47JGhtJ1Ueyo6LM36pGeorgbc Z5b78/FzECLdSD4Z+fJUA81L/8iwf1sjeoJPohZUGFlbxV2Ezdvn6s4iwp8xXrGn 21MqMh2EK78wq5dp7VHshXFCFW+KIC0MZ6xdAN/h8NeXvFNYJa6QV1ACDxceWdm7 8hooJNOFo/tnpTQuNbNTSpyNdVg9PCmx3x4YTqjeC15bt49QglFaLgRy5s340rcI X2N107yF2azELW/Tk5f34aq2JvVSTAeFnWSCHvW3Lvn3CO3Vs2Ol7XAxkAaYAsJy baQgcY2xswfUn3lCl3pthQ== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 40msest6t6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 01 Aug 2024 16:31:59 +0000 (GMT) Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 471FNu3A030932; Thu, 1 Aug 2024 16:31:58 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2169.outbound.protection.outlook.com [104.47.56.169]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 40nehw38jm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 01 Aug 2024 16:31:58 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=S6q8PteDra70te55zpYpAy2Z89otPSn4J1U2jqGC60v5MVID6hyXwjjVgSOUHy7YYPDGbTtkRvQ+y+JE6iCnqNSKx6//JBX/f1dTBpZbrGR3rEn23OlMAs6dKINVkPfpC5FfS8kLWjirRaEyta3gPyUtr+wdj5O8FEp+ukNzxqKAsXdNWRe9sI0cT3UMb1FF3VISFyCSSj95mCtDOGev9se+CmzJM9V9rcHV3+azdnMUWdHXxTOOn3ZZlybBrvW0FbQAak8jHQUEbtM5WE3A7ti7GXawP1M30kRjwI+Fe0G6IqB0F9xZmg+P6FQuu3Bc7CKfjqgLLk2LTLKBuBXmXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=zGlHm0yX8TuYFKRUvbqZ8nfy0EEKrPkjhdyhgfCxWr0=; b=ZApu/Jhx0UlslmDLUvUP/qquKHq+ijTUiw2dazL4lfp6V3FkF4QFNcR8ZcxiFaYtZgSw0nXwHhtVBK5jUU4RYGg8EIHK6igOyBRzoQJDOBQj7Y90HUwmxwRvlpkmWQLvjIKfUNuEeM3SZkrakon3HxYGMFpRj/oNZPJt7Si+u09SzZQgCXfEUgVIVNCu1YCr3SLWQkCf1O9L9BvdH/0g4H489stI1EbR7H5Rg5VpN/smw2Y1rWM2eokWHXAX1O3HiUWqr8ARfAb7YKRgxYZRK5+WezChmJRAqOuMA4/ZDBEeYFfj7RKPNM3WrWIfUGZ9ecgvVzcEADUvH/9b8LWPCQ== 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=zGlHm0yX8TuYFKRUvbqZ8nfy0EEKrPkjhdyhgfCxWr0=; b=blpxOJrts1yAfCg0nQBlfA7NrEqzsBVPurkzaZU1Tv/ZMMnfDqyAPgfgaFd+BNBdHL+5Isjx6PuocyqkIU98dCVyrJP3yaBvk8zealIxb1S2Td9wDpnRH75GSmKsyswtX4799SKKZ6DUEWJp4jFK7dWRLOnG4Mx94kldEs0FRA8= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by PH7PR10MB6081.namprd10.prod.outlook.com (2603:10b6:510:1fb::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7828.22; Thu, 1 Aug 2024 16:31:53 +0000 Received: from DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088]) by DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088%7]) with mapi id 15.20.7828.021; Thu, 1 Aug 2024 16:31:53 +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 v3 12/14] xfs: Unmap blocks according to forcealign Date: Thu, 1 Aug 2024 16:30:55 +0000 Message-Id: <20240801163057.3981192-13-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20240801163057.3981192-1-john.g.garry@oracle.com> References: <20240801163057.3981192-1-john.g.garry@oracle.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: MN2PR12CA0007.namprd12.prod.outlook.com (2603:10b6:208:a8::20) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|PH7PR10MB6081:EE_ X-MS-Office365-Filtering-Correlation-Id: 9cb0e3d2-ccfb-41b4-d42c-08dcb24773c3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|366016; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?QwrQbCcAzoh0zZgPph23ubWavg1OGDWacKiqo03/k0xKdiThN5swALgDRKuu?= =?us-ascii?Q?LxI8sJIApX2GkP0R0RiGMUN0nWIMHeNAVSTmZPcOvUk3c5P6YfocgiO7uGOJ?= =?us-ascii?Q?WU1q1bXY/lneJR/34lNzMkmgS71+3N/bQZvSOHkTZlEN48qRYZo+YTVEfUk4?= =?us-ascii?Q?xQaIWQTpo7eR35gVpWiMdbGEnfrCuiqVErIBV9EuBIc0Jc00Jam1wegh5Vdi?= =?us-ascii?Q?p+KjhKwYdkSyyR9lU9waBIfE5H+VV6O3tw7XeqlSUMlPFJsyW2JP91qzciPh?= =?us-ascii?Q?gxEyPwaoMZ5EWmjvvlGsg93RyVU0tSdMSwaKnN9XCAazTa1BF7f+m5plKaCY?= =?us-ascii?Q?jq9Jj1TRlPofI/2ugAiMEqkbDXQ8v6N/NALQS7nYky0hjtoME5cZOWE9PsO1?= =?us-ascii?Q?CSFly4P1pBY4GFfqbSph2bDuIJuTZEzGtnolI64b3mEKT9YX2DaJXus7Arw5?= =?us-ascii?Q?aXkdrVW2UdUPvwFxEu8iA3x188+b87TD7EgQC/NyX3OMLcbY/W0BoUceOELv?= =?us-ascii?Q?0U58twV30+8tKqLIkLH8RbMMRqp9vb1EvBhsGwnYSywN8YCADJu8O29wDAZr?= =?us-ascii?Q?aPocroG0N66Ngj11jdpde7ITkcg6cUeqFwh281VWNInxNko+rk7Y2u1O0i6B?= =?us-ascii?Q?wOSMgWMEESkjWKj5vgdyKWh3D/xtJK3lReMMMyHdbVCFApiItRAjAFBZJDfk?= =?us-ascii?Q?LXycbNDGFMYQF4zVUhglTdHQG68278x6L7mctxROda6L4sbZfuBe4OjD0Kv0?= =?us-ascii?Q?omvrugQ8R3AR/Libjl9uyH2W1VJICvHCata+dvewrQ8KxSJdy+hKhOCCb7WL?= =?us-ascii?Q?yifVTzv0PTcHMNMY2ZVZ2/TZm4IQ2BPW1vcMcWm0OxOg5IVRCGKqeag2CiAE?= =?us-ascii?Q?gAzfkcibt1QEOA081bAZIWclkLvxgozJhHuGL3J5XrT1hnmwsDj/LnrR6ztS?= =?us-ascii?Q?36eCVYHE86bCwzffT0qjAiRYd669VWMndRr8vrT49uOQ24khcozsMIClG6cU?= =?us-ascii?Q?CUoFTg9n56XbB4zRZq7+HMZaXXjAKJrtTRTNOGbfYQ7CUHSTKq4aCJ6KGaU+?= =?us-ascii?Q?nUaMuYtIu03OY+ednbK7qMOKGGE/QF1+bwMxudMfbaALoTbKTMXy0sbqIpJw?= =?us-ascii?Q?Ml2erpym/+QZ+vLzPWWGnKEKMG0AUOMRjwwJcIJy+o23Gg+VPRsdhHoeXSrD?= =?us-ascii?Q?JK2B1U0GtO6LVf2+wP+DcblAKNs92AH+wovA8Yuy4emu4dCFsKE5AzsqwnUO?= =?us-ascii?Q?b8ZoquZZfHp6ZLNEEWouK8cn3/erdwv7DysgFoQZn1lGpDn5NtsjcAQwl9Sy?= =?us-ascii?Q?B613YprRqkm91IOil77hoBaYbJexm2Kvf9RwaRtlwD8AsA=3D=3D?= 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:(13230040)(1800799024)(376014)(366016);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?YjqoQv5y8Upw2EYNIDIbe8IR8BwWg5PWLdZZh+3nE/o4+cIkhhGR/fKIrMWt?= =?us-ascii?Q?wwQV7wI2bYUzgxoqENGXu17hE692lxPCt89Eewvp3e/8v6AWZ2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AItzGczj/F4LcYeX2WbusIb3X7QO?= =?us-ascii?Q?N0nU9RtfPkzjxto9TTz1Mbx3P1LdYUF8kSPEWZwL6XBCBAsF4YZOrojySL6Z?= =?us-ascii?Q?Rw41jK8ezg7EkcdUvxSJ/1fxj6gVsOGzaXOJZPACR6dsQ0rHmk7L1Gu2YV0E?= =?us-ascii?Q?0z/cYxHtmjK89ppjz4qMDzcncVJEKmQaj5c8X9dQL/tsZ+yXxH4YHEF0h2uf?= =?us-ascii?Q?AfI5iYoEKi+hkDwnBiGvmKlAiye65+RjKoqqYCTtrUUwQxqZmY1LcHoZKVnQ?= =?us-ascii?Q?OIkoXCvw2OEj7Rwp+EbgBu+7y+PQfQHEai1Z9tVXeJXzy73P2BDVem3hqdfy?= =?us-ascii?Q?dT+JvOjokPbzwuWN3VaIdQKXbC+1MlUMvXVTSJ2MXS1srJFhNcManOEkL0j/?= =?us-ascii?Q?vhM760KBsfS4c15SulGSw41vOWly48Lny1X7KHKA44JiwBO2CIZFN4fxv7Zu?= =?us-ascii?Q?tQdZnWNN1ZaJTO9+Q/3TfCHDxrGmKTdJVJWloKrFoY0vNMjPeVBNDBm7gaCt?= =?us-ascii?Q?+up69Un4kee9A6dlOy5EcTOlMm1z3HPobJR+aIBXl86TUf4PB38fYYpXynww?= =?us-ascii?Q?lYKqZJmKQzk1vyoUKuSE88Bj6+D/JyNfH8FIc2EqLIPcCO4K7ykGjueJRnY6?= =?us-ascii?Q?rQ=3D=3D?= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: KM93j73Wtj0SCXRA3ZavxvMdy8P5enmqg3o6XDD4iCd8cOqcdbZHA5ZcxmvLTxLg6rqydcz3N41Rkgc1Jk8gr26fz5OInLI6jyqObmhP7KlTlkuIF/P6YbFPQpNljvvzHfzn5eZME6N+Bd5LO3FkXxdPk0SdCPx6UzqFmN2SByNDi/id4Uk0Ei1aOtOW73B+EdKB8lbGR27Ijk/ZYr+dr9EKtTHIvPIrh1FhlLth63yLDosva+m5AzwAVO0TcsaFCxtaRimwGZNcA//Ohip9GeQCaQJ6F91H0k/HuOGPgWFZwdcNrZ20HDJq1TBaZL6yhukasUaI3d/w0MU/xE0HCE4eOitrwZzwtXO6VJdywpBdOLOmQbALVN1iXeUVfB3E6DOhikg+ENw5568CR/+HnmdU/ftIOjKza+BhL3Jgrv3u+wq5qKYmDHIo6BWnFALxSJzVzkpc3g0t57xVuo3oa6rPDBlRwQN7W775B2wPsFCHSlTkUdI/Y3LrO1L6lEgmwN1CRpusgEb0bBUzAI4IB9EYBy7+aSVcrTlREFbfiFtju8Amsq+F+JwzyxbFLs1LyauewP8lFzoxiY76MsOx0Qig/UWc4mgZ91r5ne2t3g4= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9cb0e3d2-ccfb-41b4-d42c-08dcb24773c3 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Aug 2024 16:31:53.5564 (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: UDbgY60TVYfVKlOixOH6cStitSHBZl/A52uXgsm/S2ppR7a6qS8iK5PjUL+RIU2xBtpK/49A2L9ozlZcUHZtmw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR10MB6081 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-08-01_15,2024-08-01_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 malwarescore=0 spamscore=0 mlxlogscore=999 suspectscore=0 bulkscore=0 mlxscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2407110000 definitions=main-2408010108 X-Proofpoint-ORIG-GUID: ouyBfu0dReZsUXnGp2M8onDS5tHCfSKc X-Proofpoint-GUID: ouyBfu0dReZsUXnGp2M8onDS5tHCfSKc Content-Type: text/plain; charset="utf-8" For when forcealign is enabled, blocks in an inode need to be unmapped according to extent alignment, like what is already done for rtvol. Change variable isrt in __xfs_bunmapi() to a bool, as that is really what it is. Signed-off-by: John Garry --- fs/xfs/libxfs/xfs_bmap.c | 48 +++++++++++++++++++++++++++++----------- fs/xfs/xfs_inode.c | 16 ++++++++++++++ fs/xfs/xfs_inode.h | 2 ++ 3 files changed, 53 insertions(+), 13 deletions(-) diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c index 0c3df8c71c6d..d6ae344a17fc 100644 --- a/fs/xfs/libxfs/xfs_bmap.c +++ b/fs/xfs/libxfs/xfs_bmap.c @@ -5409,6 +5409,25 @@ xfs_bmap_del_extent_real( return 0; } =20 +static xfs_extlen_t +xfs_bunmapi_align( + struct xfs_inode *ip, + xfs_fsblock_t fsbno, + xfs_extlen_t *off) +{ + struct xfs_mount *mp =3D ip->i_mount; + + if (XFS_IS_REALTIME_INODE(ip)) + return xfs_inode_alloc_fsbsize_align(ip, fsbno, off); + /* + * The agbno for the fsbno is aligned to extsize, but the fsbno itself + * is not necessarily aligned (to extsize), so use agbno to determine + * mod+offset to the alloc unit boundary. + */ + return xfs_inode_alloc_fsbsize_align(ip, XFS_FSB_TO_AGBNO(mp, fsbno), + off); +} + /* * Unmap (remove) blocks from a file. * If nexts is nonzero then the number of extents to remove is limited to @@ -5430,7 +5449,8 @@ __xfs_bunmapi( xfs_extnum_t extno; /* extent number in list */ struct xfs_bmbt_irec got; /* current extent record */ struct xfs_ifork *ifp; /* inode fork pointer */ - int isrt; /* freeing in rt area */ + bool isrt; /* freeing in rt area */ + bool isforcealign; /* forcealign inode */ int logflags; /* transaction logging flags */ xfs_extlen_t mod; /* rt extent offset */ struct xfs_mount *mp =3D ip->i_mount; @@ -5468,6 +5488,8 @@ __xfs_bunmapi( } XFS_STATS_INC(mp, xs_blk_unmap); isrt =3D xfs_ifork_is_realtime(ip, whichfork); + isforcealign =3D (whichfork !=3D XFS_ATTR_FORK) && + xfs_inode_has_forcealign(ip); end =3D start + len; =20 if (!xfs_iext_lookup_extent_before(ip, ifp, &end, &icur, &got)) { @@ -5486,6 +5508,8 @@ __xfs_bunmapi( extno =3D 0; while (end !=3D (xfs_fileoff_t)-1 && end >=3D start && (nexts =3D=3D 0 || extno < nexts)) { + xfs_extlen_t off; + /* * Is the found extent after a hole in which end lives? * Just back up to the previous extent, if so. @@ -5519,18 +5543,18 @@ __xfs_bunmapi( if (del.br_startoff + del.br_blockcount > end + 1) del.br_blockcount =3D end + 1 - del.br_startoff; =20 - if (!isrt || (flags & XFS_BMAPI_REMAP)) + if ((!isrt && !isforcealign) || (flags & XFS_BMAPI_REMAP)) goto delete; =20 - mod =3D xfs_rtb_to_rtxoff(mp, - del.br_startblock + del.br_blockcount); + mod =3D xfs_bunmapi_align(ip, + del.br_startblock + del.br_blockcount, &off); if (mod) { /* - * Realtime extent not lined up at the end. + * Not aligned to allocation unit on the end. * The extent could have been split into written * and unwritten pieces, or we could just be * unmapping part of it. But we can't really - * get rid of part of a realtime extent. + * get rid of part of an extent. */ if (del.br_state =3D=3D XFS_EXT_UNWRITTEN) { /* @@ -5554,7 +5578,7 @@ __xfs_bunmapi( ASSERT(del.br_state =3D=3D XFS_EXT_NORM); ASSERT(tp->t_blk_res > 0); /* - * If this spans a realtime extent boundary, + * If this spans an extent boundary, * chop it back to the start of the one we end at. */ if (del.br_blockcount > mod) { @@ -5571,14 +5595,12 @@ __xfs_bunmapi( goto nodelete; } =20 - mod =3D xfs_rtb_to_rtxoff(mp, del.br_startblock); + mod =3D xfs_bunmapi_align(ip, del.br_startblock, &off); if (mod) { - xfs_extlen_t off =3D mp->m_sb.sb_rextsize - mod; - /* - * Realtime extent is lined up at the end but not - * at the front. We'll get rid of full extents if - * we can. + * Extent is lined up to the allocation unit at the + * end but not at the front. We'll get rid of full + * extents if we can. */ if (del.br_blockcount > off) { del.br_blockcount -=3D off; diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index e7fa155fcbde..bb8abf990186 100644 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c @@ -3164,3 +3164,19 @@ xfs_is_always_cow_inode( { return ip->i_mount->m_always_cow && xfs_has_reflink(ip->i_mount); } + +/* Return mod+offset for a blkno to an extent boundary */ +xfs_extlen_t +xfs_inode_alloc_fsbsize_align( + struct xfs_inode *ip, + xfs_fileoff_t blkno, + xfs_extlen_t *off) +{ + xfs_fileoff_t blkno_start =3D blkno; + xfs_fileoff_t blkno_end =3D blkno; + + xfs_roundout_to_alloc_fsbsize(ip, &blkno_start, &blkno_end); + + *off =3D blkno_end - blkno; + return blkno - blkno_start; +} diff --git a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h index 6dd8055c98b3..7b77797c3943 100644 --- a/fs/xfs/xfs_inode.h +++ b/fs/xfs/xfs_inode.h @@ -647,6 +647,8 @@ void xfs_roundout_to_alloc_fsbsize(struct xfs_inode *ip, xfs_fileoff_t *start, xfs_fileoff_t *end); void xfs_roundin_to_alloc_fsbsize(struct xfs_inode *ip, xfs_fileoff_t *start, xfs_fileoff_t *end); +xfs_extlen_t xfs_inode_alloc_fsbsize_align(struct xfs_inode *ip, + xfs_fileoff_t blkno, xfs_extlen_t *off); =20 int xfs_icreate_dqalloc(const struct xfs_icreate_args *args, struct xfs_dquot **udqpp, struct xfs_dquot **gdqpp, --=20 2.31.1 From nobody Wed Oct 30 22:13:17 2024 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 8DF1C1BD01C; Thu, 1 Aug 2024 16:32:10 +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=1722529932; cv=fail; b=S4EO3LZsL4NboNEPNJzWVIv5HFH9c5ICz6RuiYFpZjjTPu2PXivei8bjC5RTpB88IR17uUEAKr4ST4kLTIjuGB3jsKavSbnRFAkSdE0CiwcrUOp5hxiBuYEVexE81TH7IOlikAAw9qjK5zVKl7vOhs2K9qTH8d//bOVGpChg2f0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722529932; c=relaxed/simple; bh=2xJob8bM8FuDhmNTv5sPBNhkIAuRf+6gpXfoewv+evg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=TA6pMd7QtJXFh4uc6aquJcAUrZIozaPFoqd25ASyINwNg7DzQyGEzcQXNQQDtm63UpxtP43Qm+QgJTzFwewEXzvhcj9E4ld5x3Zvc3xilZsCygBSU0IkYAyyS3M90iPeMsLh98fXrw5KN3OTM1ZWjlMCvS5ErpoB1j4gCEObO1Q= 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=l9mb+mA2; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=PTFTltvI; 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="l9mb+mA2"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="PTFTltvI" 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 471FtTJR002486; Thu, 1 Aug 2024 16:32:01 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=PQCgj/fTtiN7ZwNNirfsdVvWimv2TbWwYg7gvzOqD1s=; b= l9mb+mA2r5AX1wMXHacf0Df09V7cetVFF74qrhl4WVR7pjl5gUc+u3LOb8aNTRww ii/6kWGhHDPj8MPDe+2FHCorpJVTIdKvO34ri0R3OqwDhOKEt09iEd57s5yzURMc MrovlD7lUfnH/R8eEtLFZQXD6vn2RV4dvfCewHuGy/0Y9SgYlDr0G6Kr5ac2sylF pVYJghwLfAad2yRdCH5P6BMxlj7WatyU4iHi0qd+Dc9HMtgbUCMuMn7ILREellac wG/QLpjPbclWL1J0lNLbK73PAqjiWJ+fUorO8HiIIE//1Pm0pcGsxInqIHC7U3Ev KXsomOlfyC4KDJkig6ZYvA== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 40msest6t8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 01 Aug 2024 16:32:00 +0000 (GMT) Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 471FNu3B030932; Thu, 1 Aug 2024 16:31:58 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2169.outbound.protection.outlook.com [104.47.56.169]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 40nehw38jm-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 01 Aug 2024 16:31:58 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=glC7teV5587rCTAF3SEC9Fd9T+CnMgfkP2ZWsCVQPzRR0ew4VNqqUyWYxOkztD+vNzCJjPnpkIJJhmfI9HhxSpdY9w3sqvyLfKpKpQQZK/HF6inmUlyRwMeZqkypoNU/V8OW9y6M5aJyvY+caX2vi1NzTbqfAs2HYET/PmKhzrsg2vMWuu3KpMEElsjLV9JWwDyD5pS6tryoAK7M+14cv9alc2NDYw1unvg8Bz7/iwxRXnkw9rtAG6FI/s2y8haEZL7byO8qeYicZZx1eyl2WLQXmD9vN1T+eiSq6xsLUeeYr9gXFkm4MtJ34RjbiB8Qx0rxNt8Rztb+CzFhqLgDRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=PQCgj/fTtiN7ZwNNirfsdVvWimv2TbWwYg7gvzOqD1s=; b=mwNsd8qfcal3kp/LBWfruGd/Tr+QbKJm11fxA6d1tdO1Gplpy3MZW5BD1h05Kn1i83pHzwamga6assm6EcpXD6SmL96wKOrrGGJKBX2W6BnCiGnM5BhjksONIFQJxiyPbPMQuDirqhAup1qmnTrFWjpuHY7Bqk/tD4LlIeZUjKdcpej62BWKOJR0IMpP1SFPhfGJNToe33/cJCBgdfFebwUKYgzWkk8Sb0oHZH+2tmNOCLtHuZml3SHa6tx6WXFmnGdXPPFdeCbIz68BBsz4U/YG7rpCsIhbdmEw0arMgQ441XBRgdvMHloxzg9SWlr5OD6/ist7rMG9C6W9DcjPsg== 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=PQCgj/fTtiN7ZwNNirfsdVvWimv2TbWwYg7gvzOqD1s=; b=PTFTltvIMNuGDzQIvgCiWsRBCd/EFVIva8XQwYlDctQyymGV8TFFZBcRF5TPil9ZjntwEgqE4j4h4onNeLBwOSh1Y7A3GARhznEyXkF0r8mkI14EGr2cj/SZU1fbvKDHpsejxEUytJzcDYoggT8HczsAraLh0ga/L1hwjbaVUVc= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by PH7PR10MB6081.namprd10.prod.outlook.com (2603:10b6:510:1fb::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7828.22; Thu, 1 Aug 2024 16:31:55 +0000 Received: from DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088]) by DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088%7]) with mapi id 15.20.7828.021; Thu, 1 Aug 2024 16:31:54 +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 v3 13/14] xfs: Don't revert allocated offset for forcealign Date: Thu, 1 Aug 2024 16:30:56 +0000 Message-Id: <20240801163057.3981192-14-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20240801163057.3981192-1-john.g.garry@oracle.com> References: <20240801163057.3981192-1-john.g.garry@oracle.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: MN2PR16CA0038.namprd16.prod.outlook.com (2603:10b6:208:234::7) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|PH7PR10MB6081:EE_ X-MS-Office365-Filtering-Correlation-Id: f3abb9d8-aa2b-4d16-1a7b-08dcb247748d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|366016; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?Q3FOzpBrkp+EXJ5GRjar3oPdqYofl/AyVBkCR0w2Ih8geioGsjJUJQxD4HwO?= =?us-ascii?Q?PV56LHgCZQrG0CoWTWcsGIvPA0wHs9XX2eYt+/KtnvfGsBZA64XEBqwV2g7+?= =?us-ascii?Q?p2ylmVvo792rq/vceHvrEyfJMc2LBi6dlJYh8Ysq7F3PYN8zJkYFSOY8/x4y?= =?us-ascii?Q?I6XG1+506Uvp6w7RC2nOleckD6D3ARy106z984vIbyzEgj0/1FQKja+NhV5o?= =?us-ascii?Q?DVYy5wwYHfvh/+s6pEdvIdLqdhAbHvMWGMR4orfnIqz0370UvB+Hrf1zlWeF?= =?us-ascii?Q?br9Jd3A3VkmnTqkjXxo6a/eCIIeL/R74PPQbVUpyvH5sKpQPoa3mGAKJA2Kd?= =?us-ascii?Q?zTxtGicT9KvO2YsUhkuYi9mzQ0cTTwrhO/MUxLSfXzXYP/ybyEm4ZVZ+RneS?= =?us-ascii?Q?UCO/V34Nh4BqtL7z0dZjfLKvzm7KYTpjy3eSNzHnEpP8icVmB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R4AAsa/aWKFGfWESBMFA8RBLWQCVtGdqL8g=3D=3D?= 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:(13230040)(1800799024)(376014)(366016);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?5ocMbiLP+ASMcpI+jCDHVqrh/UrLyDUl0tuEYkSpMkoHx2+EaArnE2TOOfEc?= =?us-ascii?Q?/3DmbFY2g4dbsv/SgWyzsWuHIbYIVovZ58Iosqy/VEMlTy1LZqgA30jie9c6?= =?us-ascii?Q?1bTskw9EYGs0XsikkA1wgIgLGsoOsPWyiEJQFPH+d13OOtACMByRxgXC5GZ3?= =?us-ascii?Q?f8T6nm2VkQZ/ZuIPpNG6898c7mqQZ+FRfrjMaH6fl2mLJZSFnhjCr6nVAq/m?= =?us-ascii?Q?gsRLr++T6K0rZQAmjNa02B3Ro69KZGgSk/GbL2e2XzOFEHWFrgtONWf8p7J+?= =?us-ascii?Q?sxspVfYywIHM347KbIF0Ld1XL85ThQk1tYjtjUZ7KuGjMvv5GjXC2pMkx+B/?= =?us-ascii?Q?OapzkMvS5jxja4z1mnkOpJAG+qJY3aMRaD2tPAsvUnRnIyK6EXt+L4zw2Af1?= =?us-ascii?Q?sNMTUSQ7pUfuM+FDrabWCakagv3GY7sU+TPuX+3NNSaQmfbyX577uY2ia4tn?= =?us-ascii?Q?UZ7vrNKq+elEyxxj8BCH0jO2LPd0g03+1crWbDMgVPVepUc0dXE2oMsZaX28?= =?us-ascii?Q?ZkOQFmQky2VzEW5dl6gctag/4Bz+mGCmSRxLx1eBCesuU8WY/7b5mW0wqoIi?= =?us-ascii?Q?B5u5sPG6ucT9vbyTq6+FAo8wX6xu403OQirBo2VbGBdbI7R0nmXLIbBPp+qW?= =?us-asc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aUgzR?= =?us-ascii?Q?bNqX+d3/nRAFNgk/BLUXZstLeEf3zaX2TPh5z/gL0PrV/klXmIAiFbOenYy1?= =?us-ascii?Q?vw=3D=3D?= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 7FUWX71pzFEk68SxTYqYjMzB0ZBuUjhO8ZDGvaj74UUhcEqsNVTLuDV+4C7NIN4sAFFn3pF/hLps0JfNGuH6zykUSkIiMXsUbiozxBbXGxfzOqGYMm2PFjZ38bDfsXcL8Ov/AVuvSfm9b5dyadQ58Lu61zkJi3V4IThr4a3LMIVOmnFaf1oF3pXw2JAjASc5VYeo2nt+Di0Cn3/VEuGvffXbAqdduwABREYB9HFwmgE/d9Chpdqza/hZYR5hgWw1DUNjf022FS6y2dSsb7A1vfMHuK6TnK0l/SnG9yYngh2hHrBs2SWE4iez3qYG84Gm9VwRS3uRtFuvPhvlyD1hs5AAw03efXaxJb7pqMx/Vtzs2bZxEDGrziqMR1svUOFQrW3dpnrC90FUXaYrIUDoOOpKKthsVcmcwCKKALJNhgCxkwHjAwY/BOY1EPBakZ7mwXSYuIKj7a+v/ZC3bIOKAp6urzMmctHmly0UD41Y0VWH7idiPU5+sxaP23103y4ANwJCBrl6x7nIV4npEbzo2VDn8gV2hZ6UGBmAEv2rP4AVG7iYTWvISMkCwqz8E7ciyGH5MhfaEkLchAvnU5bxQNYvpzmuJ12BunkntE+EUA0= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: f3abb9d8-aa2b-4d16-1a7b-08dcb247748d X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Aug 2024 16:31:54.8711 (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: 0C4OqGCiLdSQApem4PylC+qWr7pSTq3sgtdVs7Hm3Hb/8Fyy4/O3/ys71v5ZwzVqvDsdJWzWK/M0hlr1TCV9sA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR10MB6081 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-08-01_15,2024-08-01_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 malwarescore=0 spamscore=0 mlxlogscore=999 suspectscore=0 bulkscore=0 mlxscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2407110000 definitions=main-2408010108 X-Proofpoint-ORIG-GUID: qJ0WyqSyhTAGzsqbdLZzCwftgqDAqkdh X-Proofpoint-GUID: qJ0WyqSyhTAGzsqbdLZzCwftgqDAqkdh Content-Type: text/plain; charset="utf-8" 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. Reviewed-by: "Darrick J. Wong" Signed-off-by: John Garry --- 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 d6ae344a17fc..d246b15160ac 100644 --- a/fs/xfs/libxfs/xfs_bmap.c +++ b/fs/xfs/libxfs/xfs_bmap.c @@ -3491,11 +3491,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 <=3D orig_length) - ap->offset =3D orig_offset; - else if (ap->offset + ap->length < orig_offset + orig_length) - ap->offset =3D orig_offset + orig_length - ap->length; + if (!xfs_inode_has_forcealign(ap->ip)) { + if (ap->length <=3D orig_length) + ap->offset =3D orig_offset; + else if (ap->offset + ap->length < orig_offset + orig_length) + ap->offset =3D orig_offset + orig_length - ap->length; + } xfs_bmap_alloc_account(ap); } =20 --=20 2.31.1 From nobody Wed Oct 30 22:13:17 2024 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 8DF8F1BD01D; Thu, 1 Aug 2024 16:32:10 +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=1722529932; cv=fail; b=GRuE1SacT8CO6sJqVfJWHySz3Yb10GnqWyWkxGzoR/lx8fgH9QIeEWuQfHy35OKtioT94L4hzk/Dlbj9mDTOvdWkqq4XYMBV81WFTOk4wMil5J25OSr6CXs+ycTg6Ukf/CFZS7MMv8vnlVU3n1FMk+0xlS00Ew012WLF9knbpQA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722529932; c=relaxed/simple; bh=iP5VgZqMMKyaNN872Wec5brnrEankUaD624CQGWv5AM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=iR+ZA5h3iQlDQLJkMQJxlyDTEFwX5pcWsjR78MKBtnBYUyKSEo8t1Z2F03pWWOeLBwkrHJcmMRPlTqcDeXb25EfCNDGXNyXra6W6vDhT/o11LWE55TRZivL53m7Ej/zgvPG7ld8yXjbjJk5PxvNAlNBZgv2iYryHNFD8TnFVr/I= 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=VbFY8rA1; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=gaXcytoI; 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="VbFY8rA1"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="gaXcytoI" 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 471FtY6w010856; Thu, 1 Aug 2024 16:32:01 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=COlt0/hvCG/XtFt/RIQWXv0u+rGaER/I+75DfoqfNIE=; b= VbFY8rA16orSk1ZzWYDBpDqQqjdJ2aJ//La4pEf29gM0gkOoEtFV8RczuDVHmJov Et1ew6bd6gjLAyGF8LnqQzmU+3E/Ejwd+h3i1mQo2Hv5CDytrRhEhaUmjTNywAiy xlz4n0lQineLXYg71xaiZyQ/SJoKaqHLm4d4o+v6QqEKBmC7nfJVdQg5EtvvTMiz PGzg52IVcekMjULnhTl2j7NqgUQmaT5vaRuLFG6x0WMgHtW+xAP2GDCbFtfw92Wr OvJjxssSTbIXcJptTfbkNZNwSfMrg/veHdw5Y4HNZU1SdVCevC2XrXYi7oT0bkhQ f2qXKW2R0IVVRasHDfCzMQ== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 40mqtat9d6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 01 Aug 2024 16:32:01 +0000 (GMT) Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 471FNu3C030932; Thu, 1 Aug 2024 16:31:59 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2169.outbound.protection.outlook.com [104.47.56.169]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 40nehw38jm-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 01 Aug 2024 16:31:59 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=BoOPgasDsor08ZE4B2cQsdJPQrJubSi7+Cmz+yu/FcabwpD1Qdr2cDkeGVYfLZZIlLIlJyrJQiZc6LFxZzWv6rohCpSwtrX3DXMagFCRxOPAP7tX/BEXqFCBLKZKhGrk2+FhK7dYKH/SOlHePF8aj7XDxj+HpchZIi1LughaQO25uMDd8/Zp6yNdTwG0shJlCJdtMELyzZe3+vfQlwFA4MjS8w/CF3BY0jcV4sQ8rUTKHkjnTvIT1JZ0wphwC21lNUcFw3b4055LCP0aB8DirdmS6qGXCTqHkEejn2tHqqqTKugvZpV9j5ks9bhTSfqQ7IfVu0Xfwm8wgdOhGDGUbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=COlt0/hvCG/XtFt/RIQWXv0u+rGaER/I+75DfoqfNIE=; b=o8t33JdzU5iwGJN133gn5UvmQ2XlnScLJbSmRJ+2d+eNSxB+l5ZnX4paPVClwEmlMMo3W+ZdoJbmfYoS/uej5/jqk5YCxj0A+c8tL+GTl5ko/VlW2Slgsp9KfhxLrC3N3ZUHsc4R24KIUUORFOTM1tAlAaTtbZIz5dtuC5AYWQ3mKaMqIkMuB2DJigs3K8kMf4FG0nl2u90RMdMAVc29trpEXwp7YnBphKKh8bByu0gQ07DEXmEGxUQo+7izcCw2TjUGUt3hpKxYqbQMPBNhgFqlEVHW9OLuF9A6C4rW+nUtEKDcMS4Rbm8DZBqqyfHZ4hcFegTt2wWabELgJ7IFsA== 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=COlt0/hvCG/XtFt/RIQWXv0u+rGaER/I+75DfoqfNIE=; b=gaXcytoI1ax++elXk/I5GuSWFnMJiWv0kXLaVWeYzQ0qAPV6xiRptzbKM1f/UEnOlMAQe2w2lWxbVAKGCdfo8Q6Yey8XdTVuXGcYI8Q0AD+Yr4aABFnbkprM+oZ4fMZHSGcN+asvMz/c7bdf/42ciKjYqrYr41WK3+xNkshRW0c= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by PH7PR10MB6081.namprd10.prod.outlook.com (2603:10b6:510:1fb::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7828.22; Thu, 1 Aug 2024 16:31:56 +0000 Received: from DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088]) by DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088%7]) with mapi id 15.20.7828.021; Thu, 1 Aug 2024 16:31:56 +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 v3 14/14] xfs: Enable file data forcealign feature Date: Thu, 1 Aug 2024 16:30:57 +0000 Message-Id: <20240801163057.3981192-15-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20240801163057.3981192-1-john.g.garry@oracle.com> References: <20240801163057.3981192-1-john.g.garry@oracle.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: MN2PR14CA0010.namprd14.prod.outlook.com (2603:10b6:208:23e::15) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|PH7PR10MB6081:EE_ X-MS-Office365-Filtering-Correlation-Id: 3028ee8f-1132-41a9-04f3-08dcb2477567 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|366016; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?eJHy/ckZWo7UIlOQ1Yqz+KWHSV7WNMTuipzSVMkHydXO/uYdmz8LEw/8ij1Z?= =?us-ascii?Q?buGeQDtMrKJYpOyPmL7pcXTCfqz5mdTY+UTTfW66aLra7URKsrOYv+cfNIWC?= =?us-ascii?Q?jM1Bj28Uhgv2nt2SJAfe0oZvU7zcfUVSnqvuTKeV/cydKM4VA4aATsbP1vKT?= =?us-ascii?Q?wqkVeT2WH3y/zNZIin7K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Vjxz1K?= =?us-ascii?Q?tTmHRr/hT5S0ObjZowT2FGcxpyVYBq/8x5ZKzbTmPKecY08eRhXYk1P1jf7g?= =?us-ascii?Q?ZNWds4T8SVcEpm0giHYKLZaQVX8lJo6Z1yLdIPQmoCrifu1ZT09aPCgSnINX?= =?us-ascii?Q?HNQGf4FuDhBYSKqwmBzS4Fw6s4G1HDHKrfg3ktEnMszH6UCtBnrTq8zTUB6X?= =?us-ascii?Q?+9zbCwQzcxnct74FPgYbsHhNeUDQuZCnPQ/2ltGuvAf1W5Ko1Gn4MVLVY878?= =?us-ascii?Q?3efanPtiHM96h6e5gcMNgxzsO0xmBgKR91xbnmtXxjP9Og=3D=3D?= 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:(13230040)(1800799024)(376014)(366016);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?olTnFb/x1nGdblZiyjlyTuKAnrDfpes9Ch1a/h8z8fCSihSpV7WNh8KiRkwm?= =?us-ascii?Q?BOTn7AcrkNVGL8VPmf+kLsJurGiT9pA7LDSEYZl6h0J67bvoOAYAYTDbM9t0?= =?us-ascii?Q?9ujTNjveyxwV+kt3snwj5Xobb3P2vnvS7+Pp1JGKbMiK339lE3AC/EcM96eS?= =?us-ascii?Q?qA7mkJNhrfVfS2x+0L6JKoDXTIBOiKZX/KsmAOjHFlIIp7FKP+/KSsD3H3Xq?= =?us-ascii?Q?GXxkM9h8QOLKYmeENU9HeGianScljH3ZQeFiZWdAWwyi+s1UtGUZhslTUTAj?= =?us-ascii?Q?eC0IX8W5j4XQCz3M6L3B7D/T4PHEpZoTPfsAhe7WVm5CXkugBJhBvlvsfuiT?= =?us-ascii?Q?A9zfVTEt5rNlu5YlJ1+bFnmepQ6RmuG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N+NpyBbMt9DKZ6sWLS3kvSEXNzAKQuikUcuCcGCNOpvr25V+YqXouLQTdbWd1jdwa5h5igSigx4l5+mjA= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3028ee8f-1132-41a9-04f3-08dcb2477567 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Aug 2024 16:31:56.3102 (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: A2OM6LUYSV48G7pJigOS78+qIlZa3cfbeLTrC7F6Gubd9ykA7lf9BhQnhCTgoxkBl6Q+83vlOzXNAfGYEK4gMQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR10MB6081 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-08-01_15,2024-08-01_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 malwarescore=0 spamscore=0 mlxlogscore=999 suspectscore=0 bulkscore=0 mlxscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2407110000 definitions=main-2408010108 X-Proofpoint-GUID: h0oZ7c8XTMyxfeG_w67kqMdVyh__eyRs X-Proofpoint-ORIG-GUID: h0oZ7c8XTMyxfeG_w67kqMdVyh__eyRs Content-Type: text/plain; charset="utf-8" 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 95f5259c4255..04c6cbc943c2 100644 --- a/fs/xfs/libxfs/xfs_format.h +++ b/fs/xfs/libxfs/xfs_format.h @@ -357,7 +357,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( --=20 2.31.1