diff options
author | Nick Piggin <npiggin@kernel.dk> | 2011-01-07 01:49:23 -0500 |
---|---|---|
committer | Nick Piggin <npiggin@kernel.dk> | 2011-01-07 01:50:18 -0500 |
commit | fe15ce446beb3a33583af81ffe6c9d01a75314ed (patch) | |
tree | bc8af66b6dd2d0f21a2a3f48a19975ae2cdbae4e /fs | |
parent | 5eef7fa905c814826f518aca2d414ca77508ce30 (diff) |
fs: change d_delete semantics
Change d_delete from a dentry deletion notification to a dentry caching
advise, more like ->drop_inode. Require it to be constant and idempotent,
and not take d_lock. This is how all existing filesystems use the callback
anyway.
This makes fine grained dentry locking of dput and dentry lru scanning
much simpler.
Signed-off-by: Nick Piggin <npiggin@kernel.dk>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/9p/vfs_dentry.c | 4 | ||||
-rw-r--r-- | fs/afs/dir.c | 4 | ||||
-rw-r--r-- | fs/btrfs/inode.c | 2 | ||||
-rw-r--r-- | fs/coda/dir.c | 4 | ||||
-rw-r--r-- | fs/configfs/dir.c | 2 | ||||
-rw-r--r-- | fs/dcache.c | 2 | ||||
-rw-r--r-- | fs/gfs2/dentry.c | 2 | ||||
-rw-r--r-- | fs/hostfs/hostfs_kern.c | 2 | ||||
-rw-r--r-- | fs/libfs.c | 2 | ||||
-rw-r--r-- | fs/ncpfs/dir.c | 4 | ||||
-rw-r--r-- | fs/nfs/dir.c | 2 | ||||
-rw-r--r-- | fs/proc/base.c | 2 | ||||
-rw-r--r-- | fs/proc/generic.c | 2 | ||||
-rw-r--r-- | fs/proc/proc_sysctl.c | 2 | ||||
-rw-r--r-- | fs/sysfs/dir.c | 2 |
15 files changed, 18 insertions, 20 deletions
diff --git a/fs/9p/vfs_dentry.c b/fs/9p/vfs_dentry.c index cbf4e50f3933..466d2a4fc5cb 100644 --- a/fs/9p/vfs_dentry.c +++ b/fs/9p/vfs_dentry.c | |||
@@ -51,7 +51,7 @@ | |||
51 | * | 51 | * |
52 | */ | 52 | */ |
53 | 53 | ||
54 | static int v9fs_dentry_delete(struct dentry *dentry) | 54 | static int v9fs_dentry_delete(const struct dentry *dentry) |
55 | { | 55 | { |
56 | P9_DPRINTK(P9_DEBUG_VFS, " dentry: %s (%p)\n", dentry->d_name.name, | 56 | P9_DPRINTK(P9_DEBUG_VFS, " dentry: %s (%p)\n", dentry->d_name.name, |
57 | dentry); | 57 | dentry); |
@@ -68,7 +68,7 @@ static int v9fs_dentry_delete(struct dentry *dentry) | |||
68 | * | 68 | * |
69 | */ | 69 | */ |
70 | 70 | ||
71 | static int v9fs_cached_dentry_delete(struct dentry *dentry) | 71 | static int v9fs_cached_dentry_delete(const struct dentry *dentry) |
72 | { | 72 | { |
73 | struct inode *inode = dentry->d_inode; | 73 | struct inode *inode = dentry->d_inode; |
74 | P9_DPRINTK(P9_DEBUG_VFS, " dentry: %s (%p)\n", dentry->d_name.name, | 74 | P9_DPRINTK(P9_DEBUG_VFS, " dentry: %s (%p)\n", dentry->d_name.name, |
diff --git a/fs/afs/dir.c b/fs/afs/dir.c index 5439e1bc9a86..2c18cde27000 100644 --- a/fs/afs/dir.c +++ b/fs/afs/dir.c | |||
@@ -23,7 +23,7 @@ static struct dentry *afs_lookup(struct inode *dir, struct dentry *dentry, | |||
23 | static int afs_dir_open(struct inode *inode, struct file *file); | 23 | static int afs_dir_open(struct inode *inode, struct file *file); |
24 | static int afs_readdir(struct file *file, void *dirent, filldir_t filldir); | 24 | static int afs_readdir(struct file *file, void *dirent, filldir_t filldir); |
25 | static int afs_d_revalidate(struct dentry *dentry, struct nameidata *nd); | 25 | static int afs_d_revalidate(struct dentry *dentry, struct nameidata *nd); |
26 | static int afs_d_delete(struct dentry *dentry); | 26 | static int afs_d_delete(const struct dentry *dentry); |
27 | static void afs_d_release(struct dentry *dentry); | 27 | static void afs_d_release(struct dentry *dentry); |
28 | static int afs_lookup_filldir(void *_cookie, const char *name, int nlen, | 28 | static int afs_lookup_filldir(void *_cookie, const char *name, int nlen, |
29 | loff_t fpos, u64 ino, unsigned dtype); | 29 | loff_t fpos, u64 ino, unsigned dtype); |
@@ -730,7 +730,7 @@ out_bad: | |||
730 | * - called from dput() when d_count is going to 0. | 730 | * - called from dput() when d_count is going to 0. |
731 | * - return 1 to request dentry be unhashed, 0 otherwise | 731 | * - return 1 to request dentry be unhashed, 0 otherwise |
732 | */ | 732 | */ |
733 | static int afs_d_delete(struct dentry *dentry) | 733 | static int afs_d_delete(const struct dentry *dentry) |
734 | { | 734 | { |
735 | _enter("%s", dentry->d_name.name); | 735 | _enter("%s", dentry->d_name.name); |
736 | 736 | ||
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 72f31ecb5c90..7ce9f8932789 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -4127,7 +4127,7 @@ struct inode *btrfs_lookup_dentry(struct inode *dir, struct dentry *dentry) | |||
4127 | return inode; | 4127 | return inode; |
4128 | } | 4128 | } |
4129 | 4129 | ||
4130 | static int btrfs_dentry_delete(struct dentry *dentry) | 4130 | static int btrfs_dentry_delete(const struct dentry *dentry) |
4131 | { | 4131 | { |
4132 | struct btrfs_root *root; | 4132 | struct btrfs_root *root; |
4133 | 4133 | ||
diff --git a/fs/coda/dir.c b/fs/coda/dir.c index 5d8b35539601..4cce3b07d9d7 100644 --- a/fs/coda/dir.c +++ b/fs/coda/dir.c | |||
@@ -47,7 +47,7 @@ static int coda_readdir(struct file *file, void *buf, filldir_t filldir); | |||
47 | 47 | ||
48 | /* dentry ops */ | 48 | /* dentry ops */ |
49 | static int coda_dentry_revalidate(struct dentry *de, struct nameidata *nd); | 49 | static int coda_dentry_revalidate(struct dentry *de, struct nameidata *nd); |
50 | static int coda_dentry_delete(struct dentry *); | 50 | static int coda_dentry_delete(const struct dentry *); |
51 | 51 | ||
52 | /* support routines */ | 52 | /* support routines */ |
53 | static int coda_venus_readdir(struct file *coda_file, void *buf, | 53 | static int coda_venus_readdir(struct file *coda_file, void *buf, |
@@ -577,7 +577,7 @@ out: | |||
577 | * This is the callback from dput() when d_count is going to 0. | 577 | * This is the callback from dput() when d_count is going to 0. |
578 | * We use this to unhash dentries with bad inodes. | 578 | * We use this to unhash dentries with bad inodes. |
579 | */ | 579 | */ |
580 | static int coda_dentry_delete(struct dentry * dentry) | 580 | static int coda_dentry_delete(const struct dentry * dentry) |
581 | { | 581 | { |
582 | int flags; | 582 | int flags; |
583 | 583 | ||
diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c index 578706969415..20024a9ef5a7 100644 --- a/fs/configfs/dir.c +++ b/fs/configfs/dir.c | |||
@@ -67,7 +67,7 @@ static void configfs_d_iput(struct dentry * dentry, | |||
67 | * We _must_ delete our dentries on last dput, as the chain-to-parent | 67 | * We _must_ delete our dentries on last dput, as the chain-to-parent |
68 | * behavior is required to clear the parents of default_groups. | 68 | * behavior is required to clear the parents of default_groups. |
69 | */ | 69 | */ |
70 | static int configfs_d_delete(struct dentry *dentry) | 70 | static int configfs_d_delete(const struct dentry *dentry) |
71 | { | 71 | { |
72 | return 1; | 72 | return 1; |
73 | } | 73 | } |
diff --git a/fs/dcache.c b/fs/dcache.c index b2cb2662ca00..6ee6bc40cb63 100644 --- a/fs/dcache.c +++ b/fs/dcache.c | |||
@@ -453,8 +453,6 @@ static void prune_one_dentry(struct dentry * dentry) | |||
453 | if (!atomic_dec_and_lock(&dentry->d_count, &dentry->d_lock)) | 453 | if (!atomic_dec_and_lock(&dentry->d_count, &dentry->d_lock)) |
454 | return; | 454 | return; |
455 | 455 | ||
456 | if (dentry->d_op && dentry->d_op->d_delete) | ||
457 | dentry->d_op->d_delete(dentry); | ||
458 | dentry_lru_del(dentry); | 456 | dentry_lru_del(dentry); |
459 | __d_drop(dentry); | 457 | __d_drop(dentry); |
460 | dentry = d_kill(dentry); | 458 | dentry = d_kill(dentry); |
diff --git a/fs/gfs2/dentry.c b/fs/gfs2/dentry.c index 6798755b3858..e80fea2f65ff 100644 --- a/fs/gfs2/dentry.c +++ b/fs/gfs2/dentry.c | |||
@@ -106,7 +106,7 @@ static int gfs2_dhash(struct dentry *dentry, struct qstr *str) | |||
106 | return 0; | 106 | return 0; |
107 | } | 107 | } |
108 | 108 | ||
109 | static int gfs2_dentry_delete(struct dentry *dentry) | 109 | static int gfs2_dentry_delete(const struct dentry *dentry) |
110 | { | 110 | { |
111 | struct gfs2_inode *ginode; | 111 | struct gfs2_inode *ginode; |
112 | 112 | ||
diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c index 2c0f148a49e6..cfe8bc7de511 100644 --- a/fs/hostfs/hostfs_kern.c +++ b/fs/hostfs/hostfs_kern.c | |||
@@ -32,7 +32,7 @@ static inline struct hostfs_inode_info *HOSTFS_I(struct inode *inode) | |||
32 | 32 | ||
33 | #define FILE_HOSTFS_I(file) HOSTFS_I((file)->f_path.dentry->d_inode) | 33 | #define FILE_HOSTFS_I(file) HOSTFS_I((file)->f_path.dentry->d_inode) |
34 | 34 | ||
35 | static int hostfs_d_delete(struct dentry *dentry) | 35 | static int hostfs_d_delete(const struct dentry *dentry) |
36 | { | 36 | { |
37 | return 1; | 37 | return 1; |
38 | } | 38 | } |
diff --git a/fs/libfs.c b/fs/libfs.c index a3accdf528ad..b9d25d83e228 100644 --- a/fs/libfs.c +++ b/fs/libfs.c | |||
@@ -37,7 +37,7 @@ int simple_statfs(struct dentry *dentry, struct kstatfs *buf) | |||
37 | * Retaining negative dentries for an in-memory filesystem just wastes | 37 | * Retaining negative dentries for an in-memory filesystem just wastes |
38 | * memory and lookup time: arrange for them to be deleted immediately. | 38 | * memory and lookup time: arrange for them to be deleted immediately. |
39 | */ | 39 | */ |
40 | static int simple_delete_dentry(struct dentry *dentry) | 40 | static int simple_delete_dentry(const struct dentry *dentry) |
41 | { | 41 | { |
42 | return 1; | 42 | return 1; |
43 | } | 43 | } |
diff --git a/fs/ncpfs/dir.c b/fs/ncpfs/dir.c index f22b12e7d337..d6e6453881ce 100644 --- a/fs/ncpfs/dir.c +++ b/fs/ncpfs/dir.c | |||
@@ -76,7 +76,7 @@ const struct inode_operations ncp_dir_inode_operations = | |||
76 | static int ncp_lookup_validate(struct dentry *, struct nameidata *); | 76 | static int ncp_lookup_validate(struct dentry *, struct nameidata *); |
77 | static int ncp_hash_dentry(struct dentry *, struct qstr *); | 77 | static int ncp_hash_dentry(struct dentry *, struct qstr *); |
78 | static int ncp_compare_dentry (struct dentry *, struct qstr *, struct qstr *); | 78 | static int ncp_compare_dentry (struct dentry *, struct qstr *, struct qstr *); |
79 | static int ncp_delete_dentry(struct dentry *); | 79 | static int ncp_delete_dentry(const struct dentry *); |
80 | 80 | ||
81 | static const struct dentry_operations ncp_dentry_operations = | 81 | static const struct dentry_operations ncp_dentry_operations = |
82 | { | 82 | { |
@@ -162,7 +162,7 @@ ncp_compare_dentry(struct dentry *dentry, struct qstr *a, struct qstr *b) | |||
162 | * Closing files can be safely postponed until iput() - it's done there anyway. | 162 | * Closing files can be safely postponed until iput() - it's done there anyway. |
163 | */ | 163 | */ |
164 | static int | 164 | static int |
165 | ncp_delete_dentry(struct dentry * dentry) | 165 | ncp_delete_dentry(const struct dentry * dentry) |
166 | { | 166 | { |
167 | struct inode *inode = dentry->d_inode; | 167 | struct inode *inode = dentry->d_inode; |
168 | 168 | ||
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index 996dd8989a91..9184c7c80f78 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c | |||
@@ -1117,7 +1117,7 @@ out_error: | |||
1117 | /* | 1117 | /* |
1118 | * This is called from dput() when d_count is going to 0. | 1118 | * This is called from dput() when d_count is going to 0. |
1119 | */ | 1119 | */ |
1120 | static int nfs_dentry_delete(struct dentry *dentry) | 1120 | static int nfs_dentry_delete(const struct dentry *dentry) |
1121 | { | 1121 | { |
1122 | dfprintk(VFS, "NFS: dentry_delete(%s/%s, %x)\n", | 1122 | dfprintk(VFS, "NFS: dentry_delete(%s/%s, %x)\n", |
1123 | dentry->d_parent->d_name.name, dentry->d_name.name, | 1123 | dentry->d_parent->d_name.name, dentry->d_name.name, |
diff --git a/fs/proc/base.c b/fs/proc/base.c index 182845147fe4..d932fdb6a245 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c | |||
@@ -1744,7 +1744,7 @@ static int pid_revalidate(struct dentry *dentry, struct nameidata *nd) | |||
1744 | return 0; | 1744 | return 0; |
1745 | } | 1745 | } |
1746 | 1746 | ||
1747 | static int pid_delete_dentry(struct dentry * dentry) | 1747 | static int pid_delete_dentry(const struct dentry * dentry) |
1748 | { | 1748 | { |
1749 | /* Is the task we represent dead? | 1749 | /* Is the task we represent dead? |
1750 | * If so, then don't put the dentry on the lru list, | 1750 | * If so, then don't put the dentry on the lru list, |
diff --git a/fs/proc/generic.c b/fs/proc/generic.c index dd29f0337661..1d607be36d95 100644 --- a/fs/proc/generic.c +++ b/fs/proc/generic.c | |||
@@ -400,7 +400,7 @@ static const struct inode_operations proc_link_inode_operations = { | |||
400 | * smarter: we could keep a "volatile" flag in the | 400 | * smarter: we could keep a "volatile" flag in the |
401 | * inode to indicate which ones to keep. | 401 | * inode to indicate which ones to keep. |
402 | */ | 402 | */ |
403 | static int proc_delete_dentry(struct dentry * dentry) | 403 | static int proc_delete_dentry(const struct dentry * dentry) |
404 | { | 404 | { |
405 | return 1; | 405 | return 1; |
406 | } | 406 | } |
diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c index b652cb00906b..a256d770ea18 100644 --- a/fs/proc/proc_sysctl.c +++ b/fs/proc/proc_sysctl.c | |||
@@ -392,7 +392,7 @@ static int proc_sys_revalidate(struct dentry *dentry, struct nameidata *nd) | |||
392 | return !PROC_I(dentry->d_inode)->sysctl->unregistering; | 392 | return !PROC_I(dentry->d_inode)->sysctl->unregistering; |
393 | } | 393 | } |
394 | 394 | ||
395 | static int proc_sys_delete(struct dentry *dentry) | 395 | static int proc_sys_delete(const struct dentry *dentry) |
396 | { | 396 | { |
397 | return !!PROC_I(dentry->d_inode)->sysctl->unregistering; | 397 | return !!PROC_I(dentry->d_inode)->sysctl->unregistering; |
398 | } | 398 | } |
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c index 7e54bac8c4b0..27e1102e303e 100644 --- a/fs/sysfs/dir.c +++ b/fs/sysfs/dir.c | |||
@@ -231,7 +231,7 @@ void release_sysfs_dirent(struct sysfs_dirent * sd) | |||
231 | goto repeat; | 231 | goto repeat; |
232 | } | 232 | } |
233 | 233 | ||
234 | static int sysfs_dentry_delete(struct dentry *dentry) | 234 | static int sysfs_dentry_delete(const struct dentry *dentry) |
235 | { | 235 | { |
236 | struct sysfs_dirent *sd = dentry->d_fsdata; | 236 | struct sysfs_dirent *sd = dentry->d_fsdata; |
237 | return !!(sd->s_flags & SYSFS_FLAG_REMOVED); | 237 | return !!(sd->s_flags & SYSFS_FLAG_REMOVED); |