Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1243624
| From | Alexander Morozov <alexandr.morozov@docker.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 1/2] fs/overlay: move update and instantiate dentry code to function |
| Date | 2015-10-09 21:40 +0200 |
| Message-ID | <qhLGh-3cM-9@gated-at.bofh.it> (permalink) |
| References | <qhLGh-3cM-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
ovl_create_upper and ovl_create_over_whiteout shared same code about
updating and instantiating dentry. Move that code to
ovl_dentry_update_instantiate function, so it'll be easier to bring new
changes there.
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
---
fs/overlayfs/dir.c | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
diff --git a/fs/overlayfs/dir.c b/fs/overlayfs/dir.c
index 692ceda..487a157 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,
return 0;
}
+static void ovl_dentry_update_instantiate(struct dentry *dentry,
+ struct dentry *newdentry,
+ struct inode *inode)
+{
+ ovl_dentry_version_inc(dentry->d_parent);
+ ovl_dentry_update(dentry, newdentry);
+ ovl_copyattr(newdentry->d_inode, inode);
+ d_instantiate(dentry, inode);
+}
+
static int ovl_create_upper(struct dentry *dentry, struct inode *inode,
struct kstat *stat, const char *link,
struct dentry *hardlink)
@@ -177,10 +187,7 @@ static int ovl_create_upper(struct dentry *dentry, struct inode *inode,
if (err)
goto out_dput;
- ovl_dentry_version_inc(dentry->d_parent);
- ovl_dentry_update(dentry, newdentry);
- ovl_copyattr(newdentry->d_inode, inode);
- d_instantiate(dentry, inode);
+ ovl_dentry_update_instantiate(dentry, newdentry, inode);
newdentry = NULL;
out_dput:
dput(newdentry);
@@ -363,10 +370,7 @@ static int ovl_create_over_whiteout(struct dentry *dentry, struct inode *inode,
if (err)
goto out_cleanup;
}
- ovl_dentry_version_inc(dentry->d_parent);
- ovl_dentry_update(dentry, newdentry);
- ovl_copyattr(newdentry->d_inode, inode);
- d_instantiate(dentry, inode);
+ ovl_dentry_update_instantiate(dentry, newdentry, inode);
newdentry = NULL;
out_dput2:
dput(upper);
--
2.6.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH 0/2] Fix hardlinks in overlay Alexander Morozov <alexandr.morozov@docker.com> - 2015-10-09 21:40 +0200 [PATCH 2/2] fs/overlay: use same inodes for hardlinks Alexander Morozov <alexandr.morozov@docker.com> - 2015-10-09 21:40 +0200 [PATCH 1/2] fs/overlay: move update and instantiate dentry code to function Alexander Morozov <alexandr.morozov@docker.com> - 2015-10-09 21:40 +0200
csiph-web