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 <ojaswin@xxxxxxxxxxxxx> > Signed-off-by: Ojaswin Mujoo <ojaswin@xxxxxxxxxxxxx> > Signed-off-by: Ritesh Harjani (IBM) <ritesh.list@xxxxxxxxx> > --- > 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. 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. 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@xxxxxxxxxxxxx