aboutsummaryrefslogtreecommitdiffstats
path: root/fs/overlayfs
diff options
context:
space:
mode:
authorVivek Goyal <vgoyal@redhat.com>2016-06-16 10:09:14 -0400
committerMiklos Szeredi <mszeredi@redhat.com>2016-07-29 06:05:23 -0400
commit72e48481815eeca72fc886b3be91301ad87d6aeb (patch)
tree1ee7b64d9bab4ee00d5d42b9abeafdb56a586372 /fs/overlayfs
parent58ed4e70f253d80ed72faba7873dc11603b398bc (diff)
ovl: move some common code in a function
ovl_create_upper() and ovl_create_over_whiteout() seem to be sharing some common code which can be moved into a separate function. No functionality change. Signed-off-by: Vivek Goyal <vgoyal@redhat.com> Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Diffstat (limited to 'fs/overlayfs')
-rw-r--r--fs/overlayfs/dir.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/fs/overlayfs/dir.c b/fs/overlayfs/dir.c
index 5c9d2d80ff70..d9cdb4747f68 100644
--- a/fs/overlayfs/dir.c
+++ b/fs/overlayfs/dir.c
@@ -158,6 +158,16 @@ static int ovl_dir_getattr(struct vfsmount *mnt, struct dentry *dentry,
158 return 0; 158 return 0;
159} 159}
160 160
161/* Common operations required to be done after creation of file on upper */
162static void ovl_instantiate(struct dentry *dentry, struct inode *inode,
163 struct dentry *newdentry)
164{
165 ovl_dentry_version_inc(dentry->d_parent);
166 ovl_dentry_update(dentry, newdentry);
167 ovl_copyattr(newdentry->d_inode, inode);
168 d_instantiate(dentry, inode);
169}
170
161static int ovl_create_upper(struct dentry *dentry, struct inode *inode, 171static int ovl_create_upper(struct dentry *dentry, struct inode *inode,
162 struct kstat *stat, const char *link, 172 struct kstat *stat, const char *link,
163 struct dentry *hardlink) 173 struct dentry *hardlink)
@@ -177,10 +187,7 @@ static int ovl_create_upper(struct dentry *dentry, struct inode *inode,
177 if (err) 187 if (err)
178 goto out_dput; 188 goto out_dput;
179 189
180 ovl_dentry_version_inc(dentry->d_parent); 190 ovl_instantiate(dentry, inode, newdentry);
181 ovl_dentry_update(dentry, newdentry);
182 ovl_copyattr(newdentry->d_inode, inode);
183 d_instantiate(dentry, inode);
184 newdentry = NULL; 191 newdentry = NULL;
185out_dput: 192out_dput:
186 dput(newdentry); 193 dput(newdentry);
@@ -363,10 +370,7 @@ static int ovl_create_over_whiteout(struct dentry *dentry, struct inode *inode,
363 if (err) 370 if (err)
364 goto out_cleanup; 371 goto out_cleanup;
365 } 372 }
366 ovl_dentry_version_inc(dentry->d_parent); 373 ovl_instantiate(dentry, inode, newdentry);
367 ovl_dentry_update(dentry, newdentry);
368 ovl_copyattr(newdentry->d_inode, inode);
369 d_instantiate(dentry, inode);
370 newdentry = NULL; 374 newdentry = NULL;
371out_dput2: 375out_dput2:
372 dput(upper); 376 dput(upper);