From: Alexander Morozov <alexandr.morozov@docker.com>
To: Miklos Szeredi <miklos@szeredi.hu>
Cc: LKML <linux-kernel@vger.kernel.org>,
Alexander Morozov <lk4d4@docker.com>
Subject: [PATCH 1/2] fs/overlay: move update and instantiate dentry code to function
Date: Fri, 9 Oct 2015 12:34:56 -0700 [thread overview]
Message-ID: <1444419297-16232-2-git-send-email-lk4d4@docker.com> (raw)
In-Reply-To: <1444419297-16232-1-git-send-email-lk4d4@docker.com>
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
next prev parent reply other threads:[~2015-10-09 19:35 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-09 19:34 [PATCH 0/2] Fix hardlinks in overlay Alexander Morozov
2015-10-09 19:34 ` Alexander Morozov [this message]
2015-10-09 19:34 ` [PATCH 2/2] fs/overlay: use same inodes for hardlinks Alexander Morozov
2015-11-23 23:23 ` Alexander Morozov
2016-03-07 10:49 ` [PATCH 0/2] Fix hardlinks in overlay Miklos Szeredi
2016-03-07 17:33 ` Alexander Morozov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1444419297-16232-2-git-send-email-lk4d4@docker.com \
--to=alexandr.morozov@docker.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lk4d4@docker.com \
--cc=miklos@szeredi.hu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®