Re: [PATCH v14 23/31] ovl: Set redirect on metacopy files upon rename

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

 



On Thu, Apr 26, 2018 at 12:10 PM, Vivek Goyal <vgoyal@xxxxxxxxxx> wrote:
> Set redirect on metacopy files upon rename. This will help find data dentry
> in lower dirs.
>
> Signed-off-by: Vivek Goyal <vgoyal@xxxxxxxxxx>

Reviewed-by: Amir Goldstein <amir73il@xxxxxxxxx>

Minus some nits below..

> ---
>  fs/overlayfs/dir.c | 54 ++++++++++++++++++++++++++++++++++++++----------------
>  1 file changed, 38 insertions(+), 16 deletions(-)
>
> diff --git a/fs/overlayfs/dir.c b/fs/overlayfs/dir.c
> index 34745ccea682..1acea6887b05 100644
> --- a/fs/overlayfs/dir.c
> +++ b/fs/overlayfs/dir.c
> @@ -890,6 +890,30 @@ static int ovl_set_redirect(struct dentry *dentry, bool samedir)
>         return err;
>  }
>
> +static bool ovl_rel_redirect(struct dentry *dentry, bool samedir)

If this needs to be a helper at all it should be called from within
ovl_sel_redirect() instead of all call sites and name should be
something like ovl_need_absolute_redirect()

> +{
> +       struct dentry *lowerdentry;
> +
> +       if (d_is_dir(dentry) || !samedir)
> +               return samedir;
> +
> +       /*
> +        * For non-dir hardlinked files, we need absolute redirects
> +        * in general as two upper hardlinks could be in different
> +        * dirs. We could put a relative redirect now and convert
> +        * it to absolute redirect later. But when nlink > 1 and
> +        * indexing is on, that means relative redirect needs to be
> +        * converted to absolute during copy up of another lower
> +        * hardllink as well.
> +        *
> +        * So without optimizing too much, just check if lower is
> +        * a hard link or not. If lower is hard link, put absolute
> +        * redirect.
> +        */
> +       lowerdentry = ovl_dentry_lower(dentry);
> +       return (d_inode(lowerdentry)->i_nlink > 1 ? false : true);

return d_inode(lowerdentry)->i_nlink == 1

Thanks,
Amir.
--
To unsubscribe from this list: send the line "unsubscribe linux-unionfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Filesystems Devel]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux