diff options
author | Miklos Szeredi <mszeredi@suse.cz> | 2008-06-23 12:11:52 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2008-06-23 13:06:36 -0400 |
commit | 31f3e0b3a18c6d48196c40a82a3b8c01f4ff6b23 (patch) | |
tree | 3ff97fb1fbe50a3e37e4a18d68b4720d509e99c5 | |
parent | be285c712bbbe5db43e503782fbef2bfeaa345f9 (diff) |
[patch 1/3] vfs: dcache sparse fixes
Fix the following sparse warnings:
fs/dcache.c:2183:19: warning: symbol 'filp_cachep' was not declared. Should it be static?
fs/dcache.c:115:3: warning: context imbalance in 'dentry_iput' - unexpected unlock
fs/dcache.c:188:2: warning: context imbalance in 'dput' - different lock contexts for basic block
fs/dcache.c:400:2: warning: context imbalance in 'prune_one_dentry' - different lock contexts for basic block
fs/dcache.c:431:22: warning: context imbalance in 'prune_dcache' - different lock contexts for basic block
fs/dcache.c:563:2: warning: context imbalance in 'shrink_dcache_sb' - different lock contexts for basic block
fs/dcache.c:1385:6: warning: context imbalance in 'd_delete' - wrong count at exit
fs/dcache.c:1636:2: warning: context imbalance in '__d_unalias' - unexpected unlock
fs/dcache.c:1735:2: warning: context imbalance in 'd_materialise_unique' - different lock contexts for basic block
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Reviewed-by: Matthew Wilcox <willy@linux.intel.com>
Acked-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r-- | fs/dcache.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/fs/dcache.c b/fs/dcache.c index 2b479de10a0a..e4b2b9436b32 100644 --- a/fs/dcache.c +++ b/fs/dcache.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/syscalls.h> | 17 | #include <linux/syscalls.h> |
18 | #include <linux/string.h> | 18 | #include <linux/string.h> |
19 | #include <linux/mm.h> | 19 | #include <linux/mm.h> |
20 | #include <linux/fdtable.h> | ||
20 | #include <linux/fs.h> | 21 | #include <linux/fs.h> |
21 | #include <linux/fsnotify.h> | 22 | #include <linux/fsnotify.h> |
22 | #include <linux/slab.h> | 23 | #include <linux/slab.h> |
@@ -106,9 +107,10 @@ static void dentry_lru_remove(struct dentry *dentry) | |||
106 | /* | 107 | /* |
107 | * Release the dentry's inode, using the filesystem | 108 | * Release the dentry's inode, using the filesystem |
108 | * d_iput() operation if defined. | 109 | * d_iput() operation if defined. |
109 | * Called with dcache_lock and per dentry lock held, drops both. | ||
110 | */ | 110 | */ |
111 | static void dentry_iput(struct dentry * dentry) | 111 | static void dentry_iput(struct dentry * dentry) |
112 | __releases(dentry->d_lock) | ||
113 | __releases(dcache_lock) | ||
112 | { | 114 | { |
113 | struct inode *inode = dentry->d_inode; | 115 | struct inode *inode = dentry->d_inode; |
114 | if (inode) { | 116 | if (inode) { |
@@ -132,12 +134,13 @@ static void dentry_iput(struct dentry * dentry) | |||
132 | * d_kill - kill dentry and return parent | 134 | * d_kill - kill dentry and return parent |
133 | * @dentry: dentry to kill | 135 | * @dentry: dentry to kill |
134 | * | 136 | * |
135 | * Called with dcache_lock and d_lock, releases both. The dentry must | 137 | * The dentry must already be unhashed and removed from the LRU. |
136 | * already be unhashed and removed from the LRU. | ||
137 | * | 138 | * |
138 | * If this is the root of the dentry tree, return NULL. | 139 | * If this is the root of the dentry tree, return NULL. |
139 | */ | 140 | */ |
140 | static struct dentry *d_kill(struct dentry *dentry) | 141 | static struct dentry *d_kill(struct dentry *dentry) |
142 | __releases(dentry->d_lock) | ||
143 | __releases(dcache_lock) | ||
141 | { | 144 | { |
142 | struct dentry *parent; | 145 | struct dentry *parent; |
143 | 146 | ||
@@ -383,11 +386,11 @@ restart: | |||
383 | * Try to prune ancestors as well. This is necessary to prevent | 386 | * Try to prune ancestors as well. This is necessary to prevent |
384 | * quadratic behavior of shrink_dcache_parent(), but is also expected | 387 | * quadratic behavior of shrink_dcache_parent(), but is also expected |
385 | * to be beneficial in reducing dentry cache fragmentation. | 388 | * to be beneficial in reducing dentry cache fragmentation. |
386 | * | ||
387 | * Called with dcache_lock, drops it and then regains. | ||
388 | * Called with dentry->d_lock held, drops it. | ||
389 | */ | 389 | */ |
390 | static void prune_one_dentry(struct dentry * dentry) | 390 | static void prune_one_dentry(struct dentry * dentry) |
391 | __releases(dentry->d_lock) | ||
392 | __releases(dcache_lock) | ||
393 | __acquires(dcache_lock) | ||
391 | { | 394 | { |
392 | __d_drop(dentry); | 395 | __d_drop(dentry); |
393 | dentry = d_kill(dentry); | 396 | dentry = d_kill(dentry); |
@@ -1604,10 +1607,9 @@ static int d_isparent(struct dentry *p1, struct dentry *p2) | |||
1604 | * | 1607 | * |
1605 | * Note: If ever the locking in lock_rename() changes, then please | 1608 | * Note: If ever the locking in lock_rename() changes, then please |
1606 | * remember to update this too... | 1609 | * remember to update this too... |
1607 | * | ||
1608 | * On return, dcache_lock will have been unlocked. | ||
1609 | */ | 1610 | */ |
1610 | static struct dentry *__d_unalias(struct dentry *dentry, struct dentry *alias) | 1611 | static struct dentry *__d_unalias(struct dentry *dentry, struct dentry *alias) |
1612 | __releases(dcache_lock) | ||
1611 | { | 1613 | { |
1612 | struct mutex *m1 = NULL, *m2 = NULL; | 1614 | struct mutex *m1 = NULL, *m2 = NULL; |
1613 | struct dentry *ret; | 1615 | struct dentry *ret; |
@@ -1743,7 +1745,6 @@ out_nolock: | |||
1743 | shouldnt_be_hashed: | 1745 | shouldnt_be_hashed: |
1744 | spin_unlock(&dcache_lock); | 1746 | spin_unlock(&dcache_lock); |
1745 | BUG(); | 1747 | BUG(); |
1746 | goto shouldnt_be_hashed; | ||
1747 | } | 1748 | } |
1748 | 1749 | ||
1749 | static int prepend(char **buffer, int *buflen, const char *str, | 1750 | static int prepend(char **buffer, int *buflen, const char *str, |
@@ -1758,7 +1759,7 @@ static int prepend(char **buffer, int *buflen, const char *str, | |||
1758 | } | 1759 | } |
1759 | 1760 | ||
1760 | /** | 1761 | /** |
1761 | * d_path - return the path of a dentry | 1762 | * __d_path - return the path of a dentry |
1762 | * @path: the dentry/vfsmount to report | 1763 | * @path: the dentry/vfsmount to report |
1763 | * @root: root vfsmnt/dentry (may be modified by this function) | 1764 | * @root: root vfsmnt/dentry (may be modified by this function) |
1764 | * @buffer: buffer to return value in | 1765 | * @buffer: buffer to return value in |
@@ -1847,7 +1848,7 @@ Elong: | |||
1847 | * | 1848 | * |
1848 | * Returns the buffer or an error code if the path was too long. | 1849 | * Returns the buffer or an error code if the path was too long. |
1849 | * | 1850 | * |
1850 | * "buflen" should be positive. Caller holds the dcache_lock. | 1851 | * "buflen" should be positive. |
1851 | */ | 1852 | */ |
1852 | char *d_path(const struct path *path, char *buf, int buflen) | 1853 | char *d_path(const struct path *path, char *buf, int buflen) |
1853 | { | 1854 | { |