From patchwork Tue Oct 15 09:01:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 13835932 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 DFD911DD54B; Tue, 15 Oct 2024 09:02:16 +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=1728982938; cv=fail; b=SJeu/A7Y32cYo9uIoMvgGy/KYqHLM/ouS9mNX9rlNPNn0UgKN0+uWvdpuBbomvLODab71+2WIvCPcOf9nNza41hrgMqQFOY0vtKi+qbTdUvUf+1zEk0qqGRN5bxp4UKjsnZay573duzqZgZp0JDIu2b0/6be4tBnP+1G3UOMo6s= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728982938; c=relaxed/simple; bh=DyEQh7TJksNDFD5Q6ZoydjOuWIB7+nKug/iMT6X/Bmw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=ex07aJqkLzuXnTOx932ru6DMyvNKWMh6oagXOKGtIRf3cb+571ImNsuci4YAIa4lhKyN7/9Oj6sCzR2/QSTorkEyyzUeee8wiasuPmpjQZ3yo+w8wTSqzwqLjX4ZGQEJv3B0M+GMHHAOmPVm3qPFvuEV1bxv6aI3F/bQiw5MRsc= 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=XofeCrBu; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=WTiJXtUs; 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="XofeCrBu"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="WTiJXtUs" 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 49F6F3HB010191; Tue, 15 Oct 2024 09:02:05 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=0/Dp0FpxB/g12r+FsHa6wK6cib685ZOsysK1B1ETDNg=; b= XofeCrBuDe/jSLATHzZRAgEzqGZRg8xCV1+5/ljHy8/kVX4o58T0634jZaBUCjt4 h28iTrT7+KfbKJwtupotT/nSb1mjhT5QeyQBwI+FlsYZXkW0p1oTUso3pMisAre4 wtUrmMLuvqQrnZawLCmHYYvvuE9X0GpvzCha5HjcrRMzoWaSro0OR+oKOiE/FDZb QF8JEauAHXtiPRCW58DgG0f3jsKZNVZZ4CT6tCNcKkI4FuV8z1KKoHNOEFKG+ezc KsWnYksKCzXo6GcAhxELZwj/BFN8u9BeyHyTqo7vkSXC4mCHrv22zGjBx1bJzomt SMa7n4JffDuufUHSkNGBiw== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 427gqt05g1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 15 Oct 2024 09:02:05 +0000 (GMT) Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 49F7XxY0026388; Tue, 15 Oct 2024 09:02:04 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2171.outbound.protection.outlook.com [104.47.57.171]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 427fj754ms-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 15 Oct 2024 09:02:04 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=AC9+7wndVr8+Up9RG/W59vkT1kCYrTmP0fy/mAOZDg5EP/N5L6uyf3s7oxalHzDWa8ycMHoXfHIBHaOLUApZ5ZInaUftiiCuXk9tMSb4U25LHg5T5HrTqFoGm6QJ4pES1C21DGblQHDYofbTM2OUI3u5MWhUmhwmDhAtUZ5lMd7eLlOp2U4ew9rbVySwm+eKak1uifXvbtlaUzaxqA0iFxPWHh7A1CXfr1WqFWjUep1xuK50pOBteUUvGynX+1EQO0d+uY/4Djf6em0D0uLl3oAwq6Owx7sILYFM+7M999/O04/mlimtboXP5zt12VExQG4xBweZDMxCWcgbCsEnJQ== 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=0/Dp0FpxB/g12r+FsHa6wK6cib685ZOsysK1B1ETDNg=; b=uqD5H/AcSjMMXVpUmqAKmAOJvUfVF8VD6dzyUQIElZzvn3sZW4CGG60wk0RHDN2Q8zBtTlNsy5jC18NO6+G2t181A0oTM2tQMU38UC0C/3d60LFE9/PI0aw5EHIGnu1Jhej9OBeJVilIGA/lkn66rwYLHgy722d9CfZOajy7CeTQ70pNvfHDrlQBhpOKFILoNFspAa1IuFBBCvbk5HCCLoK3VHT/E3Wwy9wyFtm9JiUbMk4Nw0qdcEbuD8plCKffCQsHHEVxfBmUHpFPWuPDxjYNGfi071E5ENTxvEAVVDGz8j/wDpeQQteyKDJTpk3v43LaayopE72Sfprlua4ZuA== 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=0/Dp0FpxB/g12r+FsHa6wK6cib685ZOsysK1B1ETDNg=; b=WTiJXtUs41lVBdkpv7YMdGAjvAPQ5EzfuzSUAzCJ+77+RvA4n2u2oELD1c8WUOlc+T5IHtff98Im4GJM7vdcZJnYucn6NDAA/Oz5VxSppydda0Wzm7YT5t1EbsZPZSAe14iNDrApsX83dRuzdQ6mLY1Rmr7y77gGiVir12OsToo= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by CH0PR10MB7439.namprd10.prod.outlook.com (2603:10b6:610:189::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.26; Tue, 15 Oct 2024 09:02:02 +0000 Received: from DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088]) by DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088%4]) with mapi id 15.20.8048.020; Tue, 15 Oct 2024 09:02:02 +0000 From: John Garry To: axboe@kernel.dk, brauner@kernel.org, djwong@kernel.org, viro@zeniv.linux.org.uk, jack@suse.cz, dchinner@redhat.com, hch@lst.de, cem@kernel.org Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, hare@suse.de, martin.petersen@oracle.com, catherine.hoang@oracle.com, mcgrof@kernel.org, ritesh.list@gmail.com, ojaswin@linux.ibm.com, John Garry Subject: [PATCH v8 7/7] xfs: Support setting FMODE_CAN_ATOMIC_WRITE Date: Tue, 15 Oct 2024 09:01:42 +0000 Message-Id: <20241015090142.3189518-8-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20241015090142.3189518-1-john.g.garry@oracle.com> References: <20241015090142.3189518-1-john.g.garry@oracle.com> X-ClientProxiedBy: BN8PR16CA0012.namprd16.prod.outlook.com (2603:10b6:408:4c::25) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) Precedence: bulk X-Mailing-List: linux-xfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|CH0PR10MB7439:EE_ X-MS-Office365-Filtering-Correlation-Id: bd82e121-cb40-409a-a0b4-08dcecf808e0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|1800799024|366016; X-Microsoft-Antispam-Message-Info: fYSjUomuDFGMKXFn5M7k1MIBtminB6CEhilhOCvEYe6opCJY8KMeV1Ge9tXZECj4owRPS1WFNwB8v1Tb9564JO+zYSRXt1RYmwowu7ym+v1TP+bdZSDzytt2JgFLyYCZ6+N5X1Qbkofbt6o1otSMgGOYEss2ApavO4eIF5Yn+wS0XJ3BwzXDPnYaC5YTaEdtM1ODazdeD4l0o43cB8TQIaPp0XOZT9oDcuEaZK6jlD15EzVHrBEjVYnkD1amRHCACEri988rFJMN1xsPkUNCaOiBFq8H3e7pJF1pvFKMUz+wXtqkLjwMUeK1awV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T9fls5rBUVOuF2nipoBprLrVhbPicmmh5R1bxtB79Ks6flqLyXYbnb8PVvtgpQ3lMt47WlFw6DXPEldvqzQpwPs/QnEGN/x4Jjp3Htedye2jyMML4Ki5c7BzZLmLknQb8c1YSa/LJWAhgEUec2ag6FVCqgl6zT3EHi6vfNJIONlyQk7ThkO7oFPvdIhhW0Nm1BAD2xuBB4IxKL28tuqNOWI5RbvY/wb2+tM+Nr8PnZR9jYDCO85rEzFvs+2YWUL4vxY9mHWnLjv96T7PnpXHtrZqIKGSDa32+I+3R2DLl4cYOO5J+Ifk= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: bd82e121-cb40-409a-a0b4-08dcecf808e0 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Oct 2024 09:02:02.5739 (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: ifLDX2t5t25izRp8P0+RDoRHwsXs4yKtm+FHGpW0fi4Pk6kNV/qpniGIqIV1+/VaVylKtYIjdGChZq7UrhfmJQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR10MB7439 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-10-15_05,2024-10-11_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 malwarescore=0 adultscore=0 bulkscore=0 spamscore=0 mlxlogscore=999 phishscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2410150060 X-Proofpoint-GUID: KN1EVtYJJ_bJYYj3DyB2GIXQyeGWWsCK X-Proofpoint-ORIG-GUID: KN1EVtYJJ_bJYYj3DyB2GIXQyeGWWsCK Set FMODE_CAN_ATOMIC_WRITE flag if we can atomic write for that inode. Signed-off-by: John Garry Reviewed-by: Christoph Hellwig --- fs/xfs/xfs_file.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c index 3a0a35e7826a..e4a3a9882b0a 100644 --- a/fs/xfs/xfs_file.c +++ b/fs/xfs/xfs_file.c @@ -1217,6 +1217,8 @@ xfs_file_open( if (xfs_is_shutdown(XFS_M(inode->i_sb))) return -EIO; file->f_mode |= FMODE_NOWAIT | FMODE_CAN_ODIRECT; + if (xfs_inode_can_atomicwrite(XFS_I(inode))) + file->f_mode |= FMODE_CAN_ATOMIC_WRITE; return generic_file_open(inode, file); }