diff options
Diffstat (limited to 'fs/dcache.c')
-rw-r--r-- | fs/dcache.c | 39 |
1 files changed, 15 insertions, 24 deletions
diff --git a/fs/dcache.c b/fs/dcache.c index a1d86c7f3e66..937df0fb0da5 100644 --- a/fs/dcache.c +++ b/fs/dcache.c | |||
@@ -34,7 +34,6 @@ | |||
34 | #include <linux/bootmem.h> | 34 | #include <linux/bootmem.h> |
35 | #include "internal.h" | 35 | #include "internal.h" |
36 | 36 | ||
37 | |||
38 | int sysctl_vfs_cache_pressure __read_mostly = 100; | 37 | int sysctl_vfs_cache_pressure __read_mostly = 100; |
39 | EXPORT_SYMBOL_GPL(sysctl_vfs_cache_pressure); | 38 | EXPORT_SYMBOL_GPL(sysctl_vfs_cache_pressure); |
40 | 39 | ||
@@ -948,9 +947,6 @@ struct dentry *d_alloc(struct dentry * parent, const struct qstr *name) | |||
948 | dentry->d_op = NULL; | 947 | dentry->d_op = NULL; |
949 | dentry->d_fsdata = NULL; | 948 | dentry->d_fsdata = NULL; |
950 | dentry->d_mounted = 0; | 949 | dentry->d_mounted = 0; |
951 | #ifdef CONFIG_PROFILING | ||
952 | dentry->d_cookie = NULL; | ||
953 | #endif | ||
954 | INIT_HLIST_NODE(&dentry->d_hash); | 950 | INIT_HLIST_NODE(&dentry->d_hash); |
955 | INIT_LIST_HEAD(&dentry->d_lru); | 951 | INIT_LIST_HEAD(&dentry->d_lru); |
956 | INIT_LIST_HEAD(&dentry->d_subdirs); | 952 | INIT_LIST_HEAD(&dentry->d_subdirs); |
@@ -1336,7 +1332,7 @@ err_out: | |||
1336 | * | 1332 | * |
1337 | * Searches the children of the parent dentry for the name in question. If | 1333 | * Searches the children of the parent dentry for the name in question. If |
1338 | * the dentry is found its reference count is incremented and the dentry | 1334 | * the dentry is found its reference count is incremented and the dentry |
1339 | * is returned. The caller must use d_put to free the entry when it has | 1335 | * is returned. The caller must use dput to free the entry when it has |
1340 | * finished using it. %NULL is returned on failure. | 1336 | * finished using it. %NULL is returned on failure. |
1341 | * | 1337 | * |
1342 | * __d_lookup is dcache_lock free. The hash list is protected using RCU. | 1338 | * __d_lookup is dcache_lock free. The hash list is protected using RCU. |
@@ -1571,10 +1567,6 @@ void d_rehash(struct dentry * entry) | |||
1571 | spin_unlock(&dcache_lock); | 1567 | spin_unlock(&dcache_lock); |
1572 | } | 1568 | } |
1573 | 1569 | ||
1574 | #define do_switch(x,y) do { \ | ||
1575 | __typeof__ (x) __tmp = x; \ | ||
1576 | x = y; y = __tmp; } while (0) | ||
1577 | |||
1578 | /* | 1570 | /* |
1579 | * When switching names, the actual string doesn't strictly have to | 1571 | * When switching names, the actual string doesn't strictly have to |
1580 | * be preserved in the target - because we're dropping the target | 1572 | * be preserved in the target - because we're dropping the target |
@@ -1593,7 +1585,7 @@ static void switch_names(struct dentry *dentry, struct dentry *target) | |||
1593 | /* | 1585 | /* |
1594 | * Both external: swap the pointers | 1586 | * Both external: swap the pointers |
1595 | */ | 1587 | */ |
1596 | do_switch(target->d_name.name, dentry->d_name.name); | 1588 | swap(target->d_name.name, dentry->d_name.name); |
1597 | } else { | 1589 | } else { |
1598 | /* | 1590 | /* |
1599 | * dentry:internal, target:external. Steal target's | 1591 | * dentry:internal, target:external. Steal target's |
@@ -1620,8 +1612,11 @@ static void switch_names(struct dentry *dentry, struct dentry *target) | |||
1620 | */ | 1612 | */ |
1621 | memcpy(dentry->d_iname, target->d_name.name, | 1613 | memcpy(dentry->d_iname, target->d_name.name, |
1622 | target->d_name.len + 1); | 1614 | target->d_name.len + 1); |
1615 | dentry->d_name.len = target->d_name.len; | ||
1616 | return; | ||
1623 | } | 1617 | } |
1624 | } | 1618 | } |
1619 | swap(dentry->d_name.len, target->d_name.len); | ||
1625 | } | 1620 | } |
1626 | 1621 | ||
1627 | /* | 1622 | /* |
@@ -1681,8 +1676,7 @@ already_unhashed: | |||
1681 | 1676 | ||
1682 | /* Switch the names.. */ | 1677 | /* Switch the names.. */ |
1683 | switch_names(dentry, target); | 1678 | switch_names(dentry, target); |
1684 | do_switch(dentry->d_name.len, target->d_name.len); | 1679 | swap(dentry->d_name.hash, target->d_name.hash); |
1685 | do_switch(dentry->d_name.hash, target->d_name.hash); | ||
1686 | 1680 | ||
1687 | /* ... and switch the parents */ | 1681 | /* ... and switch the parents */ |
1688 | if (IS_ROOT(dentry)) { | 1682 | if (IS_ROOT(dentry)) { |
@@ -1690,7 +1684,7 @@ already_unhashed: | |||
1690 | target->d_parent = target; | 1684 | target->d_parent = target; |
1691 | INIT_LIST_HEAD(&target->d_u.d_child); | 1685 | INIT_LIST_HEAD(&target->d_u.d_child); |
1692 | } else { | 1686 | } else { |
1693 | do_switch(dentry->d_parent, target->d_parent); | 1687 | swap(dentry->d_parent, target->d_parent); |
1694 | 1688 | ||
1695 | /* And add them back to the (new) parent lists */ | 1689 | /* And add them back to the (new) parent lists */ |
1696 | list_add(&target->d_u.d_child, &target->d_parent->d_subdirs); | 1690 | list_add(&target->d_u.d_child, &target->d_parent->d_subdirs); |
@@ -1791,8 +1785,7 @@ static void __d_materialise_dentry(struct dentry *dentry, struct dentry *anon) | |||
1791 | struct dentry *dparent, *aparent; | 1785 | struct dentry *dparent, *aparent; |
1792 | 1786 | ||
1793 | switch_names(dentry, anon); | 1787 | switch_names(dentry, anon); |
1794 | do_switch(dentry->d_name.len, anon->d_name.len); | 1788 | swap(dentry->d_name.hash, anon->d_name.hash); |
1795 | do_switch(dentry->d_name.hash, anon->d_name.hash); | ||
1796 | 1789 | ||
1797 | dparent = dentry->d_parent; | 1790 | dparent = dentry->d_parent; |
1798 | aparent = anon->d_parent; | 1791 | aparent = anon->d_parent; |
@@ -1911,7 +1904,8 @@ static int prepend_name(char **buffer, int *buflen, struct qstr *name) | |||
1911 | * Convert a dentry into an ASCII path name. If the entry has been deleted | 1904 | * Convert a dentry into an ASCII path name. If the entry has been deleted |
1912 | * the string " (deleted)" is appended. Note that this is ambiguous. | 1905 | * the string " (deleted)" is appended. Note that this is ambiguous. |
1913 | * | 1906 | * |
1914 | * Returns the buffer or an error code if the path was too long. | 1907 | * Returns a pointer into the buffer or an error code if the |
1908 | * path was too long. | ||
1915 | * | 1909 | * |
1916 | * "buflen" should be positive. Caller holds the dcache_lock. | 1910 | * "buflen" should be positive. Caller holds the dcache_lock. |
1917 | * | 1911 | * |
@@ -1987,7 +1981,10 @@ Elong: | |||
1987 | * Convert a dentry into an ASCII path name. If the entry has been deleted | 1981 | * Convert a dentry into an ASCII path name. If the entry has been deleted |
1988 | * the string " (deleted)" is appended. Note that this is ambiguous. | 1982 | * the string " (deleted)" is appended. Note that this is ambiguous. |
1989 | * | 1983 | * |
1990 | * Returns the buffer or an error code if the path was too long. | 1984 | * Returns a pointer into the buffer or an error code if the path was |
1985 | * too long. Note: Callers should use the returned pointer, not the passed | ||
1986 | * in buffer, to use the name! The implementation often starts at an offset | ||
1987 | * into the buffer, and may leave 0 bytes at the start. | ||
1991 | * | 1988 | * |
1992 | * "buflen" should be positive. | 1989 | * "buflen" should be positive. |
1993 | */ | 1990 | */ |
@@ -2095,7 +2092,7 @@ Elong: | |||
2095 | * return NULL; | 2092 | * return NULL; |
2096 | * } | 2093 | * } |
2097 | */ | 2094 | */ |
2098 | asmlinkage long sys_getcwd(char __user *buf, unsigned long size) | 2095 | SYSCALL_DEFINE2(getcwd, char __user *, buf, unsigned long, size) |
2099 | { | 2096 | { |
2100 | int error; | 2097 | int error; |
2101 | struct path pwd, root; | 2098 | struct path pwd, root; |
@@ -2313,9 +2310,6 @@ static void __init dcache_init(void) | |||
2313 | /* SLAB cache for __getname() consumers */ | 2310 | /* SLAB cache for __getname() consumers */ |
2314 | struct kmem_cache *names_cachep __read_mostly; | 2311 | struct kmem_cache *names_cachep __read_mostly; |
2315 | 2312 | ||
2316 | /* SLAB cache for file structures */ | ||
2317 | struct kmem_cache *filp_cachep __read_mostly; | ||
2318 | |||
2319 | EXPORT_SYMBOL(d_genocide); | 2313 | EXPORT_SYMBOL(d_genocide); |
2320 | 2314 | ||
2321 | void __init vfs_caches_init_early(void) | 2315 | void __init vfs_caches_init_early(void) |
@@ -2337,9 +2331,6 @@ void __init vfs_caches_init(unsigned long mempages) | |||
2337 | names_cachep = kmem_cache_create("names_cache", PATH_MAX, 0, | 2331 | names_cachep = kmem_cache_create("names_cache", PATH_MAX, 0, |
2338 | SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL); | 2332 | SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL); |
2339 | 2333 | ||
2340 | filp_cachep = kmem_cache_create("filp", sizeof(struct file), 0, | ||
2341 | SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL); | ||
2342 | |||
2343 | dcache_init(); | 2334 | dcache_init(); |
2344 | inode_init(); | 2335 | inode_init(); |
2345 | files_init(mempages); | 2336 | files_init(mempages); |