diff options
author | Ralf Baechle <ralf@linux-mips.org> | 1997-12-01 04:02:08 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 1997-12-01 04:02:08 +0000 |
commit | fd095d09f2d475dc2e8599b1b8bae1cd65e91685 (patch) | |
tree | 217f87a997699505e0dd752931409b9f10fffe65 /fs/dcache.c | |
parent | c02e0599c4233f97071928f8118841954bacdadf (diff) |
Merge with 2.1.56 as first part of merging back my code.
Diffstat (limited to 'fs/dcache.c')
-rw-r--r-- | fs/dcache.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/fs/dcache.c b/fs/dcache.c index afc24db1e..600e5b0e3 100644 --- a/fs/dcache.c +++ b/fs/dcache.c @@ -119,7 +119,7 @@ int d_invalidate(struct dentry * dentry) * something (at which point we need to unuse * all dentries). */ -void shrink_dcache(void) +void prune_dcache(int count) { for (;;) { struct dentry *dentry; @@ -143,6 +143,8 @@ void shrink_dcache(void) parent = dentry->d_parent; d_free(dentry); dput(parent); + if (!--count) + break; } } } @@ -177,7 +179,12 @@ struct dentry * d_alloc(struct dentry * parent, const struct qstr *name) dentry->d_count = 1; dentry->d_flags = 0; dentry->d_inode = NULL; - dentry->d_parent = dget(parent); + dentry->d_parent = NULL; + dentry->d_sb = NULL; + if (parent) { + dentry->d_parent = dget(parent); + dentry->d_sb = parent->d_sb; + } dentry->d_mounts = dentry; dentry->d_covers = dentry; INIT_LIST_HEAD(&dentry->d_hash); @@ -211,8 +218,11 @@ struct dentry * d_alloc_root(struct inode * root_inode, struct dentry *old_root) if (root_inode) { res = d_alloc(NULL, &(const struct qstr) { "/", 1, 0 }); - res->d_parent = res; - d_instantiate(res, root_inode); + if (res) { + res->d_sb = root_inode->i_sb; + res->d_parent = res; + d_instantiate(res, root_inode); + } } return res; } @@ -344,7 +354,7 @@ void d_add(struct dentry * entry, struct inode * inode) x = y; y = __tmp; } while (0) /* - * We cannibalize "newdentry" when moving dentry on top of it, + * We cannibalize "target" when moving dentry on top of it, * because it's going to be thrown away anyway. We could be more * polite about it, though. * |