On Thu, Apr 26, 2018 at 12:09 PM, Vivek Goyal <vgoyal@xxxxxxxxxx> wrote: > ovl_dentry_real() returns the real dentry. (Either upper or lower). We > also need an helper to ignore metacopy dentries and return "real data" > dentry. This helper returns an upper/lower dentry which contains data. > > Signed-off-by: Vivek Goyal <vgoyal@xxxxxxxxxx> Reviewed-by: Amir Goldstein <amir73il@xxxxxxxxx> +suggestion > --- > fs/overlayfs/overlayfs.h | 1 + > fs/overlayfs/util.c | 12 ++++++++++++ > 2 files changed, 13 insertions(+) > > diff --git a/fs/overlayfs/overlayfs.h b/fs/overlayfs/overlayfs.h > index 08df75f473fe..5077d2992d07 100644 > --- a/fs/overlayfs/overlayfs.h > +++ b/fs/overlayfs/overlayfs.h > @@ -230,6 +230,7 @@ struct dentry *ovl_dentry_lower(struct dentry *dentry); > struct dentry *ovl_dentry_lowerdata(struct dentry *dentry); > struct ovl_layer *ovl_layer_lower(struct dentry *dentry); > struct dentry *ovl_dentry_real(struct dentry *dentry); > +struct dentry *ovl_dentry_real_data(struct dentry *dentry); > struct dentry *ovl_i_dentry_upper(struct inode *inode); > struct inode *ovl_inode_upper(struct inode *inode); > struct inode *ovl_inode_lower(struct inode *inode); > diff --git a/fs/overlayfs/util.c b/fs/overlayfs/util.c > index 7029036b9aa3..2bef013ca432 100644 > --- a/fs/overlayfs/util.c > +++ b/fs/overlayfs/util.c > @@ -228,6 +228,18 @@ struct dentry *ovl_dentry_real(struct dentry *dentry) > return ovl_dentry_upper(dentry) ?: ovl_dentry_lower(dentry); > } > > +/* Return real dentry which contains data. Skip metacopy dentries */ > +struct dentry *ovl_dentry_real_data(struct dentry *dentry) The name real_data is a bit inconsistent with _upperdata and _lowerdata. Don't you think _realdata would be more coherent. > +{ > + struct dentry *upperdentry; > + > + upperdentry = ovl_dentry_upper(dentry); > + if (upperdentry && ovl_has_upperdata(d_inode(dentry))) > + return upperdentry; > + > + return ovl_dentry_lowerdata(dentry); > +} > + > struct dentry *ovl_i_dentry_upper(struct inode *inode) > { > return ovl_upperdentry_dereference(OVL_I(inode)); > -- > 2.13.6 > -- 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