Re: [RFC][PATCH 2/4] xfs: support RENAME_VFS_DTYPE flag

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Mar 21, 2017 at 04:14:49PM -0400, Amir Goldstein wrote:
> On Thu, Dec 22, 2016 at 12:25 PM, Amir Goldstein <amir73il@xxxxxxxxx> wrote:
> > If caller provided the target dtype to use and indicated that with
> > rename() flag RENAME_VFS_DTYPE, use RENAME_DT_MODE(flags) instead
> > of inode->i_mode to determine the value of dtype to store in the
> > directory entry.
> >
> > Adding this functionality to official xfs code will require to add
> > a new feature flag to xfs directry naming on-disk format.
> >
> > Without that new feature flag, xfs_repair will report that custom
> > dtype as a warning and set it back to the dtype value according to mode.
> >
> > Signed-off-by: Amir Goldstein <amir73il@xxxxxxxxx>
> 
> Ted/Darrick,
> 
> That's the XFS POC implementation of the proposed API.
> I am not re-posting the entire series that uses this for optimizing
> overlay readdir.
> It can be found here:
> https://www.spinics.net/lists/linux-unionfs/msg01401.html

Welll.... at a bare minimum you ought to post this to the XFS list if
you're serious about trying to merge this.  I suspect there will be
pushback against allowing in-kernel(?) clients to set ftype arbitrarily,
since the details of that field weren't designed to be directly
accessible outside XFS.

Next, if you're only setting FT_WHT or FT_UNKNOWN (both of which at
least already exist as code points) then you'll have to supply a fix to
xfs_repair.  If you want to do more than that (i.e. use the unused ftype
bits) you'd have to implement kernel and userland patches to add an
incompat feature flag so that unaware kernels don't trip over the extra
bits.  You'll also have to send updates to the disk format documentation
to reflect the changes you're making, and some test cases to ensure that
it all actually works.

While I think I understand what you're trying to accomplish, you'll have
to argue for it on the XFS list. :)

--D

> 
> > ---
> >  fs/xfs/libxfs/xfs_dir2.c |  1 +
> >  fs/xfs/xfs_iops.c        | 11 ++++++++---
> >  2 files changed, 9 insertions(+), 3 deletions(-)
> >
> > diff --git a/fs/xfs/libxfs/xfs_dir2.c b/fs/xfs/libxfs/xfs_dir2.c
> > index 984530e..71c6b2b 100644
> > --- a/fs/xfs/libxfs/xfs_dir2.c
> > +++ b/fs/xfs/libxfs/xfs_dir2.c
> > @@ -49,6 +49,7 @@ const unsigned char xfs_dtype_to_ftype[DT_MAX] = {
> >         [DT_FIFO]   = XFS_DIR3_FT_FIFO,
> >         [DT_SOCK]   = XFS_DIR3_FT_SOCK,
> >         [DT_LNK]    = XFS_DIR3_FT_SYMLINK,
> > +       [DT_WHT]    = XFS_DIR3_FT_WHT,
> >  };
> >
> >  /*
> > diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c
> > index d2da9ca..8574155 100644
> > --- a/fs/xfs/xfs_iops.c
> > +++ b/fs/xfs/xfs_iops.c
> > @@ -394,19 +394,24 @@ xfs_vn_rename(
> >         unsigned int    flags)
> >  {
> >         struct inode    *new_inode = d_inode(ndentry);
> > -       int             omode = 0;
> > +       int             omode = 0, nmode = 0;
> >         struct xfs_name oname;
> >         struct xfs_name nname;
> >
> > -       if (flags & ~(RENAME_NOREPLACE | RENAME_EXCHANGE | RENAME_WHITEOUT))
> > +       if (flags & ~RENAME_VFS_MASK)
> >                 return -EINVAL;
> >
> >         /* if we are exchanging files, we need to set i_mode of both files */
> >         if (flags & RENAME_EXCHANGE)
> >                 omode = d_inode(ndentry)->i_mode;
> > +       /* if requested, use provided dtype for target */
> > +       if (flags & RENAME_VFS_DTYPE)
> > +               nmode = RENAME_DT_MODE(flags);
> > +       else
> > +               nmode = d_inode(odentry)->i_mode;
> >
> >         xfs_dentry_to_name(&oname, odentry, omode);
> > -       xfs_dentry_to_name(&nname, ndentry, d_inode(odentry)->i_mode);
> > +       xfs_dentry_to_name(&nname, ndentry, nmode);
> >
> >         return xfs_rename(XFS_I(odir), &oname, XFS_I(d_inode(odentry)),
> >                           XFS_I(ndir), &nname,
> > --
> > 2.7.4
> >



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux