Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 124983
b: refs/heads/master
c: c2452f3
h: refs/heads/master
i:
  124981: 0361158
  124979: 7c55347
  124975: 08926d4
v: v3
  • Loading branch information
Nick Piggin authored and Al Viro committed Dec 31, 2008
1 parent e29e943 commit 0c4be3a
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 23 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e2b689d82c0394e5239a3557a217f19e2f47f1be
refs/heads/master: c2452f32786159ed85f0e4b21fec09258f822fc8
2 changes: 1 addition & 1 deletion trunk/arch/powerpc/oprofile/cell/spu_task_sync.c
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ static inline unsigned long fast_get_dcookie(struct path *path)
{
unsigned long cookie;

if (path->dentry->d_cookie)
if (path->dentry->d_flags & DCACHE_COOKIE)
return (unsigned long)path->dentry;
get_dcookie(path, &cookie);
return cookie;
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/oprofile/buffer_sync.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ static inline unsigned long fast_get_dcookie(struct path *path)
{
unsigned long cookie;

if (path->dentry->d_cookie)
if (path->dentry->d_flags & DCACHE_COOKIE)
return (unsigned long)path->dentry;
get_dcookie(path, &cookie);
return cookie;
Expand Down
4 changes: 0 additions & 4 deletions trunk/fs/dcache.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
#include <linux/bootmem.h>
#include "internal.h"


int sysctl_vfs_cache_pressure __read_mostly = 100;
EXPORT_SYMBOL_GPL(sysctl_vfs_cache_pressure);

Expand Down Expand Up @@ -948,9 +947,6 @@ struct dentry *d_alloc(struct dentry * parent, const struct qstr *name)
dentry->d_op = NULL;
dentry->d_fsdata = NULL;
dentry->d_mounted = 0;
#ifdef CONFIG_PROFILING
dentry->d_cookie = NULL;
#endif
INIT_HLIST_NODE(&dentry->d_hash);
INIT_LIST_HEAD(&dentry->d_lru);
INIT_LIST_HEAD(&dentry->d_subdirs);
Expand Down
28 changes: 19 additions & 9 deletions trunk/fs/dcookies.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,15 @@ static struct dcookie_struct *alloc_dcookie(struct path *path)
{
struct dcookie_struct *dcs = kmem_cache_alloc(dcookie_cache,
GFP_KERNEL);
struct dentry *d;
if (!dcs)
return NULL;

path->dentry->d_cookie = dcs;
d = path->dentry;
spin_lock(&d->d_lock);
d->d_flags |= DCACHE_COOKIE;
spin_unlock(&d->d_lock);

dcs->path = *path;
path_get(path);
hash_dcookie(dcs);
Expand All @@ -119,14 +124,14 @@ int get_dcookie(struct path *path, unsigned long *cookie)
goto out;
}

dcs = path->dentry->d_cookie;

if (!dcs)
if (path->dentry->d_flags & DCACHE_COOKIE) {
dcs = find_dcookie((unsigned long)path->dentry);
} else {
dcs = alloc_dcookie(path);

if (!dcs) {
err = -ENOMEM;
goto out;
if (!dcs) {
err = -ENOMEM;
goto out;
}
}

*cookie = dcookie_value(dcs);
Expand Down Expand Up @@ -251,7 +256,12 @@ static int dcookie_init(void)

static void free_dcookie(struct dcookie_struct * dcs)
{
dcs->path.dentry->d_cookie = NULL;
struct dentry *d = dcs->path.dentry;

spin_lock(&d->d_lock);
d->d_flags &= ~DCACHE_COOKIE;
spin_unlock(&d->d_lock);

path_put(&dcs->path);
kmem_cache_free(dcookie_cache, dcs);
}
Expand Down
21 changes: 14 additions & 7 deletions trunk/include/linux/dcache.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,22 @@ full_name_hash(const unsigned char *name, unsigned int len)
return end_name_hash(hash);
}

struct dcookie_struct;

#define DNAME_INLINE_LEN_MIN 36
/*
* Try to keep struct dentry aligned on 64 byte cachelines (this will
* give reasonable cacheline footprint with larger lines without the
* large memory footprint increase).
*/
#ifdef CONFIG_64BIT
#define DNAME_INLINE_LEN_MIN 32 /* 192 bytes */
#else
#define DNAME_INLINE_LEN_MIN 40 /* 128 bytes */
#endif

struct dentry {
atomic_t d_count;
unsigned int d_flags; /* protected by d_lock */
spinlock_t d_lock; /* per dentry lock */
int d_mounted;
struct inode *d_inode; /* Where the name belongs to - NULL is
* negative */
/*
Expand All @@ -107,10 +115,7 @@ struct dentry {
struct dentry_operations *d_op;
struct super_block *d_sb; /* The root of the dentry tree */
void *d_fsdata; /* fs-specific data */
#ifdef CONFIG_PROFILING
struct dcookie_struct *d_cookie; /* cookie, if any */
#endif
int d_mounted;

unsigned char d_iname[DNAME_INLINE_LEN_MIN]; /* small names */
};

Expand Down Expand Up @@ -177,6 +182,8 @@ d_iput: no no no yes

#define DCACHE_INOTIFY_PARENT_WATCHED 0x0020 /* Parent inode is watched */

#define DCACHE_COOKIE 0x0040 /* For use by dcookie subsystem */

extern spinlock_t dcache_lock;
extern seqlock_t rename_lock;

Expand Down

0 comments on commit 0c4be3a

Please sign in to comment.