From patchwork Wed Dec 4 15:43:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 13893969 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 CCBB320C03E; Wed, 4 Dec 2024 15:46:28 +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=1733327190; cv=fail; b=narRhpyOXc8cGPdwDXXSIhvyom3cTorZtfb9BhC7wqiZj6ulef8VEwg17TaUJ3cg+stvQo4S0gTPqdc7HgDJJtykHZsM2RxPHH1ukYIbqo0OkTe+BLKIT6KD3LHDPX27V70yHiLPcxek1SODRZf/7hoYZFjcFv1cTWF5xJyv7m0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733327190; c=relaxed/simple; bh=T/H0MQl6+6wQP89dXD/1cxALDZ5syofyLVpY8AZVQvc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=eOUsmuzXk5Q/+3yz/LAWCaT2dFelBHOHC+cuHy80dUrZiCUSdoN+llCqcDAsCFZjA0ZX6ssBRN2Mmbd3v+ouwF+czpH+uJNXecNaFSQRx5u5o2z1rg1oBPqS+Iu0/RGxP+2W5hHHiMSpGW1XVORuV0ItEF5/iKsXCzsNCeTFwhc= 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=F0/oY3sX; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=i/3/y9Ba; 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="F0/oY3sX"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="i/3/y9Ba" Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4B4D0j9i028121; Wed, 4 Dec 2024 15:44:02 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s= corp-2023-11-20; bh=FJa2FYn+l3JgVXkyj+HzJHLUFWBrqtA+vCZJkGiC1zk=; b= F0/oY3sX5hWYqWUrlj7Fn2wyxfLaOjrgiT3Jktn4Lyw3vjZArirwXITR8CLCGz9l MGao/8CjWykxj+SKcQFsSAIJtvTmjAkfWAf5NAuxFRQYpo5m+JradrXtqF8RqZo/ dEphaBFszHe+x9OGu+kLGgGSj/Z4VZwAZ8B0KthKTUa8+tYhn5LDwqIuKsrVqb6u dAB24kICtLHzXXm3YEpA7s0WAeR1snUfyiz8ZuDWirsZx/XX+HcdMi3hJleip+FU K/eSlp31io/0mI81epPeLL528C5isQ+Wi1rxka5da1a74d311OPQrn0uV1kcT1Nh c45sCogz2D8vt2QZX1zCKg== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 437trbrv4g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 04 Dec 2024 15:44:01 +0000 (GMT) Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 4B4EgUcb020166; Wed, 4 Dec 2024 15:44:01 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2046.outbound.protection.outlook.com [104.47.70.46]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 437wje6u82-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 04 Dec 2024 15:44:01 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=r5PRz1UYqLXZ9lEtl7+u2KXaWTeBagWB0oclURCXYe3he1K9PtYmDO2z1s74BXQlnffR/3ARPhLtUzYWKNOXGLpfIACCDv2P1IKC16/yUlQ2/mogXOb234t6stKcwqleJqYbV0I4leHiUJhpoiuPMn5W54rYKscCFFbch3ifEWi8lmpKgeWq3wrlBW/C/LJXI9NnG/aeQu+4jzTecAl6kzfj5i+FSRArLPTiAkHqlfar7v/ojghC8g0gGnsAR/np1iqIFaxwuOul4xVmdylQen4Hndpr1935rD8NIIZ2oHc6zxvYFYHkEtzOUplsrr21TUBmV7Gf95vHGzpUr44mAQ== 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=FJa2FYn+l3JgVXkyj+HzJHLUFWBrqtA+vCZJkGiC1zk=; b=uFNjJNgucaFdhTx0nMRpUtSCiwD/kpAgyxULZSs02tTAytSqUC31N8rme2Udb4ckA2rIpxhdC1T72aUYYofgSaT1UkZXIsl5Ts6OipmrjpKxXxjulKqNkUzvbdqF7PZfPhNlGQWHVf1tfo76qlALoI87DycZ3uHKzH9HvfMqWyI5JkBqYOlwJ7h5y3lK7CdA837ra39TYdWq9HDZPfzrJEM+qSqnlCx57qd6pnAdYfa5qXDXg9S3inwJL/QVqDCgRXfwj+lzk+xTlYH5hT7VrF+p+fOXb16GUdrazBv+RM+EHaci+tL+DDVjiu7/kdlSB8NBBRkvRFwqVMNetq2QCQ== 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=FJa2FYn+l3JgVXkyj+HzJHLUFWBrqtA+vCZJkGiC1zk=; b=i/3/y9BaNOF5hlEZJKndRcYAJcCPiyY7uDeqOMmQqhPjDd4ZAN9C2nJWGYvNC35vHvrNdXBU6AFHOHjwEjF5d24warZ3I9G3ojH5D6C8c+sNgWBwNSs047RYOJVvPUcjDhyCRvoHKtw4zixO1GbBZnxbKI9pjJN0oawEzqCGryE= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by IA3PR10MB7995.namprd10.prod.outlook.com (2603:10b6:208:50d::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8230.11; Wed, 4 Dec 2024 15:43:59 +0000 Received: from DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088]) by DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088%4]) with mapi id 15.20.8207.017; Wed, 4 Dec 2024 15:43:59 +0000 From: John Garry To: brauner@kernel.org, djwong@kernel.org, cem@kernel.org, dchinner@redhat.com, hch@lst.de, ritesh.list@gmail.com Cc: linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, martin.petersen@oracle.com, John Garry Subject: [PATCH 4/4] xfs: Update xfs_get_atomic_write_attr() for large atomic writes Date: Wed, 4 Dec 2024 15:43:44 +0000 Message-Id: <20241204154344.3034362-5-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20241204154344.3034362-1-john.g.garry@oracle.com> References: <20241204154344.3034362-1-john.g.garry@oracle.com> X-ClientProxiedBy: BL6PEPF0001641A.NAMP222.PROD.OUTLOOK.COM (2603:10b6:22e:400:0:1004:0:6) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) Precedence: bulk X-Mailing-List: linux-xfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|IA3PR10MB7995:EE_ X-MS-Office365-Filtering-Correlation-Id: c7204be3-cd4d-4fd7-207c-08dd147a7811 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|1800799024|366016; X-Microsoft-Antispam-Message-Info: cZNDAYkwdFXJr2F/r92k363L6YIkVvj3znHgYo8vd7G2eQwR62auAS3XfPEqcyokJhzLizhzvyhdSVwmyDxt5nvunFri3fIlKHW/vEo0Fu80w4D/FkCljy94XShR6G/APXaYITaJ/bTQEZVPeu4t2Bbyl3h8/xSlbzbqCClB7eOscgHIAr5zFriE1S8i/t8+Ao3Tq0KB2Rr7lKJjy7QVal4PT8LF/icW0PTrxjNxqGqupjtdMfkL45xXZsedwvYEBMnMc2L9CXFlb3p4D+RKunC8HEk2hEihl/+1vC2W+qBMjeRsMbnsQ+RBg7/fEaiIBNOJN2jBGhwjIgPIW2fB+tESYwUb+Rq1ndq/WwkP++Wt2UZw+a13hi9FAk5QI0zHjGqeLWE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JyWxKnHaBuxhHHX5EMT4Ra9X8hLlFHCXsm7GAvBQiHcfMiGAKdXI5BiyR8a3mgBB752TIk3xILiqTidyfYot3FD1kKjuvkh8fkRu7jIndPQGwwzO7O6F79i28xlp16d3VqVdQ59+zVyban0Tew1PuAvVfU33JfxSrB3UhWyQExwi4ARMXPAEZWvtpOYZA/L3rl5VH0P3V0adiVoC9xweP/46p6a8fVJuqcT0hJ/UYC6MWGwhDfGmO0yRaXvyZOcLFlX0BQrJdZLs7e8Rs0iVA= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: c7204be3-cd4d-4fd7-207c-08dd147a7811 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Dec 2024 15:43:59.1391 (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: FiRb5zq2yfAPvaEOmoZrruDAsEsKo0l6YrtHDWwqf8ZzIhDWYrDt4iV9plspVnKBQminJkh5FqtGqM2cgPsrcw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA3PR10MB7995 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2024-12-04_12,2024-12-04_02,2024-11-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxscore=0 adultscore=0 malwarescore=0 bulkscore=0 suspectscore=0 spamscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2411120000 definitions=main-2412040120 X-Proofpoint-GUID: G9SlntbuIxrtUYQYTSlqnXQSKO92lXtf X-Proofpoint-ORIG-GUID: G9SlntbuIxrtUYQYTSlqnXQSKO92lXtf Update xfs_get_atomic_write_attr() to take into account that rtvol can support atomic writes spanning multiple FS blocks. For non-rtvol, we are still limited in min and max by the blocksize. Signed-off-by: John Garry --- fs/xfs/xfs_iops.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c index 883ec45ae708..75fb3738cb76 100644 --- a/fs/xfs/xfs_iops.c +++ b/fs/xfs/xfs_iops.c @@ -572,18 +572,35 @@ xfs_stat_blksize( return max_t(uint32_t, PAGE_SIZE, mp->m_sb.sb_blocksize); } +/* Returns max atomic write unit for a file, in bytes. */ +static unsigned int +xfs_inode_atomicwrite_max( + struct xfs_inode *ip) +{ + struct xfs_mount *mp = ip->i_mount; + + if (XFS_IS_REALTIME_INODE(ip)) + return mp->m_rt_awu_max; + + return mp->m_sb.sb_blocksize; +} + void xfs_get_atomic_write_attr( struct xfs_inode *ip, unsigned int *unit_min, unsigned int *unit_max) { + struct xfs_buftarg *target = xfs_inode_buftarg(ip); + unsigned int awu_max = xfs_inode_atomicwrite_max(ip); + if (!xfs_inode_can_atomicwrite(ip)) { *unit_min = *unit_max = 0; return; } - *unit_min = *unit_max = ip->i_mount->m_sb.sb_blocksize; + *unit_min = ip->i_mount->m_sb.sb_blocksize; + *unit_max = min(target->bt_bdev_awu_max, awu_max); } STATIC int