]> Pileus Git - ~andy/linux/blobdiff - fs/dcache.c
[O_TMPFILE] it's still short a few helpers, but infrastructure should be OK now...
[~andy/linux] / fs / dcache.c
index f09b9085f7d849e235a2b8d77c079de71c96f5d2..b7f049c315269cb9161991a04b38606745f3e625 100644 (file)
@@ -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