aboutsummaryrefslogtreecommitdiff
path: root/fs/dcache.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2013-06-07 01:20:27 -0400
committerMoyster <oysterized@gmail.com>2019-05-02 15:45:06 +0200
commit59ea0dff75365932014b736b58afd3b425e2a9b5 (patch)
tree3257f5646554995554458ef672d45bd73d4633b4 /fs/dcache.c
parent5f26faf60ffc3a433b62b2dc5393039a35e21bf9 (diff)
it's still short a few helpers, but infrastructure should be OK now...
Change-Id: I0adb8fe9c5029bad3ac52629003c3b78e9442936 Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/dcache.c')
-rw-r--r--fs/dcache.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/fs/dcache.c b/fs/dcache.c
index 13ff1c648..3c1b77e92 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -3052,6 +3052,22 @@ rename_retry:
goto again;
}
+void d_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));
+ spin_lock(&dentry->d_parent->d_lock);
+ spin_lock_nested(&dentry->d_lock, DENTRY_D_LOCK_NESTED);
+ dentry->d_name.len = sprintf(dentry->d_iname, "#%llu",
+ (unsigned long long)inode->i_ino);
+ spin_unlock(&dentry->d_lock);
+ spin_unlock(&dentry->d_parent->d_lock);
+ d_instantiate(dentry, inode);
+}
+EXPORT_SYMBOL(d_tmpfile);
+
/**
* find_inode_number - check for dentry with name
* @dir: directory to check