]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blobdiff - fs/dcache.c
powerpc/perf: Avoid spurious PMU interrupts after idle
[mirror_ubuntu-zesty-kernel.git] / fs / dcache.c
index 95d71eda81420a506c5a1f4a4f5283b31310d5e4..8e50c73458593f0f68da88cf05cfe67ea7285052 100644 (file)
@@ -277,6 +277,33 @@ static inline int dname_external(const struct dentry *dentry)
        return dentry->d_name.name != dentry->d_iname;
 }
 
+void take_dentry_name_snapshot(struct name_snapshot *name, struct dentry *dentry)
+{
+       spin_lock(&dentry->d_lock);
+       if (unlikely(dname_external(dentry))) {
+               struct external_name *p = external_name(dentry);
+               atomic_inc(&p->u.count);
+               spin_unlock(&dentry->d_lock);
+               name->name = p->name;
+       } else {
+               memcpy(name->inline_name, dentry->d_iname, DNAME_INLINE_LEN);
+               spin_unlock(&dentry->d_lock);
+               name->name = name->inline_name;
+       }
+}
+EXPORT_SYMBOL(take_dentry_name_snapshot);
+
+void release_dentry_name_snapshot(struct name_snapshot *name)
+{
+       if (unlikely(name->name != name->inline_name)) {
+               struct external_name *p;
+               p = container_of(name->name, struct external_name, name[0]);
+               if (unlikely(atomic_dec_and_test(&p->u.count)))
+                       kfree_rcu(p, u.head);
+       }
+}
+EXPORT_SYMBOL(release_dentry_name_snapshot);
+
 static inline void __d_set_inode_and_type(struct dentry *dentry,
                                          struct inode *inode,
                                          unsigned type_flags)
@@ -1164,7 +1191,7 @@ enum d_walk_ret {
  *
  * The @enter() and @finish() callbacks are called with d_lock held.
  */
-static void d_walk(struct dentry *parent, void *data,
+void d_walk(struct dentry *parent, void *data,
                   enum d_walk_ret (*enter)(void *, struct dentry *),
                   void (*finish)(void *))
 {
@@ -1272,6 +1299,7 @@ rename_retry:
        seq = 1;
        goto again;
 }
+EXPORT_SYMBOL_GPL(d_walk);
 
 struct check_mount {
        struct vfsmount *mnt;
@@ -2864,6 +2892,7 @@ void d_exchange(struct dentry *dentry1, struct dentry *dentry2)
 
        write_sequnlock(&rename_lock);
 }
+EXPORT_SYMBOL_GPL(d_exchange);
 
 /**
  * d_ancestor - search for an ancestor