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

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

 



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

> ---
>  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