Re: [PATCH V4 6/8] fs/ext4: Make DAX mount option a tri-state

From: Jan Kara
Date: Thu May 28 2020 - 05:41:49 EST


On Thu 28-05-20 16:56:51, Xiao Yang wrote:
> On 2020/5/28 7:50, Ira Weiny wrote:
> > On Wed, May 27, 2020 at 01:54:54PM +0800, Xiao Yang wrote:
> > > On 2020/5/22 3:13, ira.weiny@xxxxxxxxx wrote:
> > > > From: Ira Weiny<ira.weiny@xxxxxxxxx>
> > > >
> > > > We add 'always', 'never', and 'inode' (default). '-o dax' continues to
> > > > operate the same which is equivalent to 'always'. This new
> > > > functionality is limited to ext4 only.
> > > >
> > > > Specifically we introduce a 2nd DAX mount flag EXT4_MOUNT2_DAX_NEVER and set
> > > > it and EXT4_MOUNT_DAX_ALWAYS appropriately for the mode.
> > > >
> > > > We also force EXT4_MOUNT2_DAX_NEVER if !CONFIG_FS_DAX.
> > > >
> > > > Finally, EXT4_MOUNT2_DAX_INODE is used solely to detect if the user
> > > > specified that option for printing.
> > > Hi Ira,
> > >
> > > I have two questions when reviewing this patch:
> > > 1) After doing mount with the same dax=inode option, ext4/xfs shows
> > > differnt output(i.e. xfs doesn't print 'dax=inode'):
> > > ---------------------------------------------------
> > > # mount -o dax=inode /dev/pmem0 /mnt/xfstests/test/
> > > # mount | grep pmem0
> > > /dev/pmem0 on /mnt/xfstests/test type ext4 (rw,relatime,seclabel,dax=inode)
> > >
> > > # mount -odax=inode /dev/pmem1 /mnt/xfstests/scratch/
> > > # mount | grep pmem1
> > > /dev/pmem1 on /mnt/xfstests/scratch type xfs
> > > (rw,relatime,seclabel,attr2,inode64,logbufs=8,logbsize=32k,noquota)
> > > ----------------------------------------------------
> > > Is this expected output? why don't unify the output?
> >
> > Correct. dax=inode is the default. xfs treats that default the same whether
> > you specify it on the command line or not.
> >
> > For ext4 Jan specifically asked that if the user specified dax=inode on the
> > command line that it be printed on the mount options. If you don't specify
> > anything then dax=inode is in effect but ext4 will not print anything.
> >
> > I had the behavior the same as XFS originally but Jan wanted it this way. The
> > XFS behavior is IMO better and is what the new mount infrastructure gives by
> > default.
>
> Could we unify the output? It is strange for me to use differnt output on
> ext4 and xfs.

If we'd unify the output with XFS, it would be inconsistent with all the
other ext4 mount options. So I disagree with that. I agree it is not ideal
to have different behavior between xfs and ext4 but such is the historical
behavior. If we want to change that, we need to change the handling for all
the ext4 mount options. I'm open for that discussion but it is a problem
unrelated to this patch set.

Honza
--
Jan Kara <jack@xxxxxxxx>
SUSE Labs, CR