On Fri, Nov 17, 2017 at 12:03 AM, Vivek Goyal <vgoyal@xxxxxxxxxx> wrote: > Right now two copy up related functions are part of inode.c. Amir suggested > it might be better to move these to copy_up.c. Hence this patch does that. IMO it is better to phrase simply "Move the copy up helpers to copy_up.c." > There will one more related function which will come in later patch. > > Signed-off-by: Vivek Goyal <vgoyal@xxxxxxxxxx> > --- > fs/overlayfs/copy_up.c | 30 ++++++++++++++++++++++++++++++ > fs/overlayfs/inode.c | 30 ------------------------------ > 2 files changed, 30 insertions(+), 30 deletions(-) > > diff --git a/fs/overlayfs/copy_up.c b/fs/overlayfs/copy_up.c > index 303794bb9127..f84ba12c9b05 100644 > --- a/fs/overlayfs/copy_up.c > +++ b/fs/overlayfs/copy_up.c > @@ -232,6 +232,36 @@ int ovl_set_attr(struct dentry *upperdentry, struct kstat *stat) > return err; > } > > +static bool ovl_open_need_copy_up(struct dentry *dentry, int flags) > +{ > + if (ovl_dentry_upper(dentry) && > + ovl_dentry_has_upper_alias(dentry)) > + return false; > + > + if (special_file(d_inode(dentry)->i_mode)) > + return false; > + > + if (!(OPEN_FMODE(flags) & FMODE_WRITE) && !(flags & O_TRUNC)) > + return false; > + > + return true; > +} > + > +int ovl_open_maybe_copy_up(struct dentry *dentry, unsigned int file_flags) > +{ > + int err = 0; > + > + if (ovl_open_need_copy_up(dentry, file_flags)) { > + err = ovl_want_write(dentry); > + if (!err) { > + err = ovl_copy_up_flags(dentry, file_flags); > + ovl_drop_write(dentry); > + } > + } > + > + return err; > +} > + I would put there at the bottom ,below ovl_copy_up_flags, where they belong logically (this file is sorted bottom up. And also need to move the declaration of ovl_open_maybe_copy_up() in overlayfs.h to the respective location. 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