summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2018-07-09 23:27:33 -0400
committerKent Overstreet <kent.overstreet@gmail.com>2018-07-16 03:57:02 -0400
commit4e1e2a18b97fd705199851a243491b8974c7f75a (patch)
tree9b652c24012cf12a5dc4173d0f4fa2c1f435aebf
parent3a9173fe1743552a9e864bda62fbe48953ffdea4 (diff)
fs: factor out d_mark_tmpfile()
New helper for bcachefs - bcachefs doesn't want the inode_dec_link_count() call that d_tmpfile does, it handles i_nlink on its own atomically with other btree updates Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
-rw-r--r--fs/dcache.c10
-rw-r--r--include/linux/dcache.h1
2 files changed, 9 insertions, 2 deletions
diff --git a/fs/dcache.c b/fs/dcache.c
index 8945e6cabd93..4705a464bc0a 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -3585,9 +3585,8 @@ void d_genocide(struct dentry *parent)
d_walk(parent, parent, d_genocide_kill, NULL);
}
-void d_tmpfile(struct dentry *dentry, struct inode *inode)
+void d_mark_tmpfile(struct dentry *dentry, struct inode *inode)
{
- inode_dec_link_count(inode);
BUG_ON(dentry->d_name.name != dentry->d_iname ||
!hlist_unhashed(&dentry->d_u.d_alias) ||
!d_unlinked(dentry));
@@ -3597,6 +3596,13 @@ void d_tmpfile(struct dentry *dentry, struct inode *inode)
(unsigned long long)inode->i_ino);
spin_unlock(&dentry->d_lock);
spin_unlock(&dentry->d_parent->d_lock);
+}
+EXPORT_SYMBOL(d_mark_tmpfile);
+
+void d_tmpfile(struct dentry *dentry, struct inode *inode)
+{
+ inode_dec_link_count(inode);
+ d_mark_tmpfile(dentry, inode);
d_instantiate(dentry, inode);
}
EXPORT_SYMBOL(d_tmpfile);
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index 82a99d366aec..ad646b5f4906 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -257,6 +257,7 @@ extern struct dentry * d_make_root(struct inode *);
/* <clickety>-<click> the ramfs-type tree */
extern void d_genocide(struct dentry *);
+extern void d_mark_tmpfile(struct dentry *, struct inode *);
extern void d_tmpfile(struct dentry *, struct inode *);
extern struct dentry *d_find_alias(struct inode *);