Re: [PATCH V6 4/8] fs/xfs: Make DAX mount option a tri-state

Ira Weiny
2020-04-09T15:03:34Z

On Wed, Apr 08, 2020 at 10:48:01AM +1000, Dave Chinner wrote:
> On Tue, Apr 07, 2020 at 05:09:04PM -0700, Ira Weiny wrote:
> > On Wed, Apr 08, 2020 at 09:59:09AM +1000, Dave Chinner wrote:
> > >
> > > This is overly complex. Just use 2 flags:
> >
> > LOL... I was afraid someone would say that. At first I used 2 flags with
> > fsparam_string, but then I realized Darrick suggested fsparam_enum:
>
> Well, I'm not concerned about the fsparam enum, it's just that
> encoding an integer into a flags bit field is just ... messy.
> Especially when encoding that state can be done with just 2 flags.
>
> If you want to keep the xfs_mount_dax_mode() wrapper, then:
>
> static inline uint32_t xfs_mount_dax_mode(struct xfs_mount *mp)
> {
> if (mp->m_flags & XFS_MOUNT_DAX_NEVER)
> return XFS_DAX_NEVER;
> if (mp->m_flags & XFS_MOUNT_DAX_ALWAYS)
> return XFS_DAX_ALWAYS;
> return XFS_DAX_IFLAG;
> }
>
> but once it's encoded in flags like this, the wrapper really isn't
> necessary...

Done for v7

>
> Also, while I think of it, can we change "iflag" to "inode". i.e.
> the DAX state is held on the inode. Saying it comes from an "inode
> flag" encodes the implementation into the user interface. i.e. it
> could well be held in an xattr on the inode on another filesystem,
> so we shouldn't mention "flag" in the user API....

Sure "inode" is fine with me. Easy change, done for v7

Ira