diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2013-06-07 05:20:27 (GMT) |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2013-06-29 08:57:10 (GMT) |
commit | 60545d0d4610b02e55f65d141c95b18ccf855b6e (patch) | |
tree | 252111eed41e5f54a7bd13b054420f750cb5e069 /fs/dcache.c | |
parent | f9652e10c12b43d9bb957269745cf2fa5682fa92 (diff) | |
download | linux-60545d0d4610b02e55f65d141c95b18ccf855b6e.tar.xz |
[O_TMPFILE] it's still short a few helpers, but infrastructure should be OK now...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/dcache.c')
-rw-r--r-- | fs/dcache.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/fs/dcache.c b/fs/dcache.c index f09b908..b7f049c 100644 --- a/fs/dcache.c +++ b/fs/dcache.c @@ -2968,6 +2968,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_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 |