Received: by 2002:ab2:3319:0:b0:1ef:7a0f:c32d with SMTP id i25csp379272lqc; Thu, 7 Mar 2024 23:20:09 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUELmWXL3L5fr+H+t42Fh8EWOCughWTkjAh3jRnfXOyuVN9yZP2hmF8bNmelUiDu9zqVrCbSZNHeAxtZfmRBKjaB1K+88LO5iYylH5q1Q== X-Google-Smtp-Source: AGHT+IGHQMBlhPgB5EIK4uqw03Q5n81IslCC3MgI5MWgDYUatUPZwoLIAklmvGLzky0lHmabV/V2 X-Received: by 2002:a05:6808:1291:b0:3c1:f5e7:2c8e with SMTP id a17-20020a056808129100b003c1f5e72c8emr13395469oiw.42.1709882409322; Thu, 07 Mar 2024 23:20:09 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709882409; cv=pass; d=google.com; s=arc-20160816; b=PuWSV6TTNC7lAiZJT1q5WRucRBRWdl/EOcyQNlnSl3Ar+oPhrGppXJVpAFc+l61k2l gjG0l20TW5jH49tblcRPtnczshyGPdYwg2/cq0Hp1Dm/BA9PY1zdRjweVxx0Td5j4PcV f+IZZDJ8bX30luxvrVC+jnfmN0Dfn9JL4Ko324k10EJ/I25jgUbwjRE5IqpdXs19iS5L UgaHMqhFNfEwjGrBYee32v9cUWh6/vfbJrV5RSFlrqetWOQDsuU1DLs/+QvnZmRuDZW1 izIxeRW1vKU7P3C7OLFda12n97wB/mL3g532bs3GowrPw7by/9mxICHP1aGTtZLVJHhv sV9w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=DacinbEWQALdubakrIQd7g1cRfgEMG5/c5O61RBr34s=; fh=sTPb8sxeyLOAuwDCVTU33FigbKwi9la0+jrS6FOA7jI=; b=X2NhB8ABIkQZ0p+d7ly7gRtfjNcf+RJRvTc52GCCBYcTyqBa/KoZH2G02+5vZ7Ib36 1EmGaeZVXzvTL6DOCGwvAbIz4FXKe25nPAOXKqy72hYp4zQE3F1sJR2AP0BVl5gAF0gJ AL3z2UovLDfcF0sgtbsATVCXbLg8JuAaEWoNiCmFsdynf2q9WcbNe4CtPGWbjpv/nEF3 weHwNGfsV4CJZT/718k0PU2fARYLXNQtQ8S9p9OCUs2viL7guKfoP12s1JuR+s45FDGH 5pL/l7hWBDEqOVlm5Yxz72S6VE9rPn36dmGcNfMTtPZMoqWaipzh8VA3gpx4oYmrCfuI kGGg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=L+rBuwGM; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-ext4+bounces-1567-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-ext4+bounces-1567-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id bx36-20020a056a02052400b005dccf9b1656si16624029pgb.414.2024.03.07.23.20.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Mar 2024 23:20:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4+bounces-1567-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=L+rBuwGM; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-ext4+bounces-1567-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-ext4+bounces-1567-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id EF19A283ED7 for ; Fri, 8 Mar 2024 07:20:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3F6944EB50; Fri, 8 Mar 2024 07:20:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="L+rBuwGM" X-Original-To: linux-ext4@vger.kernel.org Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (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 12E8C4E1DC; Fri, 8 Mar 2024 07:19:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.156.1 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709882399; cv=none; b=k4cCYouyAFkGy1AhBPnSSUFJ+7YAEwx7EfG8ZOCqrluKOlwkcpsf6Xe+kMTxE8utWwXJeaRzkLIJBNNn5rz7CwswAWdJxYYs05qynIJfcdmkH/yxUCKwmWopbOTxI954XS/iz3k7njFPo6qGnBmpZgSkjTHL5jNuXoc866S1n2E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709882399; c=relaxed/simple; bh=357MfJ9e26p5+MssqPfVRuHaEyIQzNN1PO/smLcqBAw=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Zq9EubZfkKpt9ek/UWNQVpiActjsFq6BBsOB8DQSNczspl/IxP+Spmpe38nE1QozcApiY4IoCeApLv3v6hpHf7xX8xxW751bSsXWYgwvouyWGfpiZREW2uumJKwkk1Q//UTyGfYwu9PSuli4RZrkCAxHykK+SrnYQ+5dnJvkMc8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=L+rBuwGM; arc=none smtp.client-ip=148.163.156.1 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Received: from pps.filterd (m0353728.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 4286vg73030867; Fri, 8 Mar 2024 07:19:28 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=pp1; bh=DacinbEWQALdubakrIQd7g1cRfgEMG5/c5O61RBr34s=; b=L+rBuwGMcclW1MZj0Wo7aqYNQNaChMOlKYgEna3ROYhPw104ND/41SN6X/omwsh02T8l i4WEwfUp2VZCI1UFQO6ijfL+Mt9eWmG/m0d7lLTMVrmiC/NkIC2PkCKNOCEEHscSK+M5 bXfKqwUqi3X11itNPjFQYRu+PlyhPRchzh7f45Z6jPIGjGFj5rAiuWe2bsPTdGzMUr3e S8kzHvF9b387/yglX/pefHE6lijXv6Mg6pfhzSxvRekZaaCZK/wTlXCVKO2QS7i+3DGE RJc+t/ROryg8denVCbS0C0hdW+MczvCmMZWyhIlXSSVmatNfUS/bzPH8234xlcXoCbnp hg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3wqwv0g96d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 08 Mar 2024 07:19:27 +0000 Received: from m0353728.ppops.net (m0353728.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 4287CX5S002226; Fri, 8 Mar 2024 07:19:27 GMT Received: from ppma11.dal12v.mail.ibm.com (db.9e.1632.ip4.static.sl-reverse.com [50.22.158.219]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3wqwv0g965-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 08 Mar 2024 07:19:27 +0000 Received: from pps.filterd (ppma11.dal12v.mail.ibm.com [127.0.0.1]) by ppma11.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 4287F6vs010913; Fri, 8 Mar 2024 07:19:26 GMT Received: from smtprelay07.fra02v.mail.ibm.com ([9.218.2.229]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 3wmh52tf7w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 08 Mar 2024 07:19:26 +0000 Received: from smtpav03.fra02v.mail.ibm.com (smtpav03.fra02v.mail.ibm.com [10.20.54.102]) by smtprelay07.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 4287JM4S35651974 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 8 Mar 2024 07:19:24 GMT Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5E5CB2004B; Fri, 8 Mar 2024 07:19:22 +0000 (GMT) Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 89AF92004D; Fri, 8 Mar 2024 07:19:17 +0000 (GMT) Received: from li-bb2b2a4c-3307-11b2-a85c-8fa5c3a69313.ibm.com (unknown [9.109.253.82]) by smtpav03.fra02v.mail.ibm.com (Postfix) with ESMTPS; Fri, 8 Mar 2024 07:19:17 +0000 (GMT) Date: Fri, 8 Mar 2024 12:49:13 +0530 From: Ojaswin Mujoo To: Dave Chinner Cc: "Ritesh Harjani (IBM)" , linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org, Jan Kara , "Theodore Ts'o" , Matthew Wilcox , "Darrick J . Wong" , Luis Chamberlain , John Garry , linux-kernel@vger.kernel.org Subject: Re: [RFC 2/8] fs: Reserve inode flag FS_ATOMICWRITES_FL for atomic writes Message-ID: References: <555cc3e262efa77ee5648196362f415a1efc018d.1709361537.git.ritesh.list@gmail.com> <4c687c1c5322b4eaf0bb173f0b5d58b38fdaa847.1709361537.git.ritesh.list@gmail.com> Precedence: bulk X-Mailing-List: linux-ext4@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-TM-AS-GCONF: 00 X-Proofpoint-GUID: QB3bg-oUgrbEE8YWM7dsSu48CL-Cpwms X-Proofpoint-ORIG-GUID: fayCa-oKvr-9Tqy4-stvhPAL3Ce9ibt- X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-03-08_05,2024-03-06_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 clxscore=1011 lowpriorityscore=0 suspectscore=0 priorityscore=1501 malwarescore=0 adultscore=0 mlxlogscore=999 phishscore=0 impostorscore=0 mlxscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2403080056 On Mon, Mar 04, 2024 at 11:59:02AM +1100, Dave Chinner wrote: > On Sat, Mar 02, 2024 at 01:11:59PM +0530, Ritesh Harjani (IBM) wrote: > > This reserves FS_ATOMICWRITES_FL for flags and adds support in > > fileattr to support atomic writes flag & xflag needed for ext4 > > and xfs. > > > > Co-developed-by: Ojaswin Mujoo > > Signed-off-by: Ojaswin Mujoo > > Signed-off-by: Ritesh Harjani (IBM) > > --- > > fs/ioctl.c | 4 ++++ > > include/linux/fileattr.h | 4 ++-- > > include/uapi/linux/fs.h | 1 + > > 3 files changed, 7 insertions(+), 2 deletions(-) > > > > diff --git a/fs/ioctl.c b/fs/ioctl.c > > index 76cf22ac97d7..e0f7fae4777e 100644 > > --- a/fs/ioctl.c > > +++ b/fs/ioctl.c > > @@ -481,6 +481,8 @@ void fileattr_fill_xflags(struct fileattr *fa, u32 xflags) > > fa->flags |= FS_DAX_FL; > > if (fa->fsx_xflags & FS_XFLAG_PROJINHERIT) > > fa->flags |= FS_PROJINHERIT_FL; > > + if (fa->fsx_xflags & FS_XFLAG_ATOMICWRITES) > > + fa->flags |= FS_ATOMICWRITES_FL; > > } > > EXPORT_SYMBOL(fileattr_fill_xflags); > > > > @@ -511,6 +513,8 @@ void fileattr_fill_flags(struct fileattr *fa, u32 flags) > > fa->fsx_xflags |= FS_XFLAG_DAX; > > if (fa->flags & FS_PROJINHERIT_FL) > > fa->fsx_xflags |= FS_XFLAG_PROJINHERIT; > > + if (fa->flags & FS_ATOMICWRITES_FL) > > + fa->fsx_xflags |= FS_XFLAG_ATOMICWRITES; > > } > > EXPORT_SYMBOL(fileattr_fill_flags); > > > > diff --git a/include/linux/fileattr.h b/include/linux/fileattr.h > > index 47c05a9851d0..ae9329afa46b 100644 > > --- a/include/linux/fileattr.h > > +++ b/include/linux/fileattr.h > > @@ -7,12 +7,12 @@ > > #define FS_COMMON_FL \ > > (FS_SYNC_FL | FS_IMMUTABLE_FL | FS_APPEND_FL | \ > > FS_NODUMP_FL | FS_NOATIME_FL | FS_DAX_FL | \ > > - FS_PROJINHERIT_FL) > > + FS_PROJINHERIT_FL | FS_ATOMICWRITES_FL) > > > > #define FS_XFLAG_COMMON \ > > (FS_XFLAG_SYNC | FS_XFLAG_IMMUTABLE | FS_XFLAG_APPEND | \ > > FS_XFLAG_NODUMP | FS_XFLAG_NOATIME | FS_XFLAG_DAX | \ > > - FS_XFLAG_PROJINHERIT) > > + FS_XFLAG_PROJINHERIT | FS_XFLAG_ATOMICWRITES) > > I'd much prefer that we only use a single user API to set/clear this > flag. Hi Dave, So right now we have 2 ways to mark this flag in ext4: 1. SETFLAGS ioctl() w/ FS_ATOMICWRITES_FL -> set EXT4_ATOMICWRITES_FL on inode 2. SETXFLAGS ioctl() w/ FS_XFLAG_ATOMICWRITES -> translate to FS_ATOMICWRITES_FL -> set EXT4_ATOMICWRITES_FL on inode IIUC you want to only keep 2. and not support 1. so the user space only has a single ioctl to use, correct? One thing I see is that the ext4_fileattr_set() is not XFLAGS aware at all and right now it expects the XFLAGS to already be translated to SETFLAG equivalent before setting it in the inode. Maybe we'll need to add that logic however it'll be more of an exception than the usual pattern. > > This functionality is going to be tied to using extent size hints on > XFS to indicate preferred atomic IO alignment/size, so applications > are going to have to use the FS_IOC_FS{G,S}ETXATTR APIs regardless > of whether it's added to the FS_IOC_{G,S}ETFLAGS API. Hmm that's right, I'm not sure how we'll handle it in ext4 yet since we don't have a per file extent size hint, the closest we have is bigalloc that is more of an mkfs time, FS wide feature. Regards, ojasw > > Also, there are relatively few flags left in the SETFLAGS 32-bit > space, so this duplication seems like a waste of the few flags > that are remaining. > > -Dave. > -- > Dave Chinner > david@fromorbit.com