* dcookie user still being registered (namely, the reader
* of the event buffer).
*/
-static inline unsigned long fast_get_dcookie(struct dentry *dentry,
- struct vfsmount *vfsmnt)
+static inline unsigned long fast_get_dcookie(struct path *path)
{
unsigned long cookie;
- if (dentry->d_cookie)
- return (unsigned long)dentry;
- get_dcookie(dentry, vfsmnt, &cookie);
+ if (path->dentry->d_cookie)
+ return (unsigned long)path->dentry;
+ get_dcookie(path, &cookie);
return cookie;
}
continue;
if (!(vma->vm_flags & VM_EXECUTABLE))
continue;
- app_cookie = fast_get_dcookie(vma->vm_file->f_dentry,
- vma->vm_file->f_vfsmnt);
+ app_cookie = fast_get_dcookie(&vma->vm_file->f_path);
pr_debug("got dcookie for %s\n",
vma->vm_file->f_dentry->d_name.name);
app = vma->vm_file;
break;
}
- *spu_bin_dcookie = fast_get_dcookie(vma->vm_file->f_dentry,
- vma->vm_file->f_vfsmnt);
+ *spu_bin_dcookie = fast_get_dcookie(&vma->vm_file->f_path);
pr_debug("got dcookie for %s\n", vma->vm_file->f_dentry->d_name.name);
up_read(&mm->mmap_sem);
end_sync();
}
-
+
/* Optimisation. We can manage without taking the dcookie sem
* because we cannot reach this code without at least one
* dcookie user still being registered (namely, the reader
* of the event buffer). */
-static inline unsigned long fast_get_dcookie(struct dentry * dentry,
- struct vfsmount * vfsmnt)
+static inline unsigned long fast_get_dcookie(struct path *path)
{
unsigned long cookie;
-
- if (dentry->d_cookie)
- return (unsigned long)dentry;
- get_dcookie(dentry, vfsmnt, &cookie);
+
+ if (path->dentry->d_cookie)
+ return (unsigned long)path->dentry;
+ get_dcookie(path, &cookie);
return cookie;
}
-
+
/* Look up the dcookie for the task's first VM_EXECUTABLE mapping,
* which corresponds loosely to "application name". This is
* not strictly necessary but allows oprofile to associate
continue;
if (!(vma->vm_flags & VM_EXECUTABLE))
continue;
- cookie = fast_get_dcookie(vma->vm_file->f_path.dentry,
- vma->vm_file->f_path.mnt);
+ cookie = fast_get_dcookie(&vma->vm_file->f_path);
break;
}
continue;
if (vma->vm_file) {
- cookie = fast_get_dcookie(vma->vm_file->f_path.dentry,
- vma->vm_file->f_path.mnt);
+ cookie = fast_get_dcookie(&vma->vm_file->f_path);
*offset = (vma->vm_pgoff << PAGE_SHIFT) + addr -
vma->vm_start;
} else {
#include <linux/errno.h>
#include <linux/dcookies.h>
#include <linux/mutex.h>
+#include <linux/path.h>
#include <asm/uaccess.h>
/* The dcookies are allocated from a kmem_cache and
* code here is particularly performance critical
*/
struct dcookie_struct {
- struct dentry * dentry;
- struct vfsmount * vfsmnt;
+ struct path path;
struct list_head hash_list;
};
/* The dentry is locked, its address will do for the cookie */
static inline unsigned long dcookie_value(struct dcookie_struct * dcs)
{
- return (unsigned long)dcs->dentry;
+ return (unsigned long)dcs->path.dentry;
}
}
-static struct dcookie_struct * alloc_dcookie(struct dentry * dentry,
- struct vfsmount * vfsmnt)
+static struct dcookie_struct *alloc_dcookie(struct path *path)
{
- struct dcookie_struct * dcs = kmem_cache_alloc(dcookie_cache, GFP_KERNEL);
+ struct dcookie_struct *dcs = kmem_cache_alloc(dcookie_cache,
+ GFP_KERNEL);
if (!dcs)
return NULL;
- dentry->d_cookie = dcs;
-
- dcs->dentry = dget(dentry);
- dcs->vfsmnt = mntget(vfsmnt);
+ path->dentry->d_cookie = dcs;
+ dcs->path = *path;
+ path_get(path);
hash_dcookie(dcs);
-
return dcs;
}
/* This is the main kernel-side routine that retrieves the cookie
* value for a dentry/vfsmnt pair.
*/
-int get_dcookie(struct dentry * dentry, struct vfsmount * vfsmnt,
- unsigned long * cookie)
+int get_dcookie(struct path *path, unsigned long *cookie)
{
int err = 0;
struct dcookie_struct * dcs;
goto out;
}
- dcs = dentry->d_cookie;
+ dcs = path->dentry->d_cookie;
if (!dcs)
- dcs = alloc_dcookie(dentry, vfsmnt);
+ dcs = alloc_dcookie(path);
if (!dcs) {
err = -ENOMEM;
goto out;
/* FIXME: (deleted) ? */
- path = d_path(dcs->dentry, dcs->vfsmnt, kbuf, PAGE_SIZE);
+ path = d_path(dcs->path.dentry, dcs->path.mnt, kbuf, PAGE_SIZE);
if (IS_ERR(path)) {
err = PTR_ERR(path);
static void free_dcookie(struct dcookie_struct * dcs)
{
- dcs->dentry->d_cookie = NULL;
- dput(dcs->dentry);
- mntput(dcs->vfsmnt);
+ dcs->path.dentry->d_cookie = NULL;
+ path_put(&dcs->path);
kmem_cache_free(dcookie_cache, dcs);
}
#ifdef CONFIG_PROFILING
#include <linux/dcache.h>
+#include <linux/path.h>
#include <linux/types.h>
struct dcookie_user;
*
* Returns 0 on success, with *cookie filled in
*/
-int get_dcookie(struct dentry * dentry, struct vfsmount * vfsmnt,
- unsigned long * cookie);
+int get_dcookie(struct path *path, unsigned long *cookie);
#else
{
return;
}
-
-static inline int get_dcookie(struct dentry * dentry,
- struct vfsmount * vfsmnt, unsigned long * cookie)
+
+static inline int get_dcookie(struct path *path, unsigned long *cookie)
{
return -ENOSYS;
-}
-
+}
+
#endif /* CONFIG_PROFILING */
-
+
#endif /* DCOOKIES_H */