On Tue, Apr 18, 2023 at 11:10 AM Alexander Larsson <alexl@xxxxxxxxxx> wrote: > > On Sat, 2023-04-08 at 19:43 +0300, Amir Goldstein wrote: > > For the common case of single lower layer, embed ovl_entry with a > > single lower path in ovl_inode, so no stack allocation is needed. > > > > For directory with more than single lower layer and for regular file > > with lowerdata, the lower stack is stored in an external allocation. > > > > Use accessor ovl_lowerstack() to get the embedded or external stack. > > > > Signed-off-by: Amir Goldstein <amir73il@xxxxxxxxx> > > Reviewed-by: Alexander Larsson <alexl@xxxxxxxxxx> > > > --- > > fs/overlayfs/dir.c | 2 ++ > > fs/overlayfs/export.c | 18 +++++---------- > > fs/overlayfs/inode.c | 12 ++++------ > > fs/overlayfs/namei.c | 15 +++++-------- > > fs/overlayfs/overlayfs.h | 10 +++++---- > > fs/overlayfs/ovl_entry.h | 14 +++++++----- > > fs/overlayfs/super.c | 41 +++++++++++++--------------------- > > fs/overlayfs/util.c | 48 +++++++++++++++++++++++++++++--------- > > -- > > 8 files changed, 81 insertions(+), 79 deletions(-) > > > > diff --git a/fs/overlayfs/dir.c b/fs/overlayfs/dir.c > > index 92bdcedfaaec..aa0465c61064 100644 > > --- a/fs/overlayfs/dir.c > > +++ b/fs/overlayfs/dir.c > > @@ -262,9 +262,11 @@ static int ovl_set_opaque(struct dentry *dentry, > > struct dentry *upperdentry) > > static int ovl_instantiate(struct dentry *dentry, struct inode > > *inode, > > struct dentry *newdentry, bool hardlink) > > { > > + struct ovl_entry oe = {}; > > struct ovl_inode_params oip = { > > .upperdentry = newdentry, > > .newinode = inode, > > + .oe = &oe, > > }; > > > > ovl_dir_modified(dentry->d_parent, false); > > diff --git a/fs/overlayfs/export.c b/fs/overlayfs/export.c > > index d4caf57c8e17..9951c504fb8d 100644 > > --- a/fs/overlayfs/export.c > > +++ b/fs/overlayfs/export.c > > @@ -287,30 +287,22 @@ static struct dentry *ovl_obtain_alias(struct > > super_block *sb, > > struct dentry *upper = upper_alias ?: index; > > struct dentry *dentry; > > struct inode *inode = NULL; > > - struct ovl_entry *oe; > > + struct ovl_entry oe; > > struct ovl_inode_params oip = { > > - .lowerpath = lowerpath, > > + .oe = &oe, > > .index = index, > > - .numlower = !!lower > > }; > > > > /* We get overlay directory dentries with ovl_lookup_real() > > */ > > if (d_is_dir(upper ?: lower)) > > return ERR_PTR(-EIO); > > > > - oe = ovl_alloc_entry(!!lower); > > - if (!oe) > > - goto nomem; > > - > > Ah, I see that the goto nomem goes away here, so I guess ignore my > comment on previous patch. > > No need to ignore, we do not leave mid series bugs. It is bad for bisection. Thanks, Amir.