浏览代码

[PATCH] dcookies.c: use proper refcounting functions

Dcookies shouldn't play with the internals of dentry and vfsmnt
refcounting.  It defeats grepping, and is prone to break if implementation
details change.

In addition the function doesn't even seem to be performance critical: it
calls kmem_cache_alloc().

Signed-off-by: Miklos Szeredi <miklos@szeredi.hu>
Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Miklos Szeredi 20 年之前
父节点
当前提交
732dbef606
共有 1 个文件被更改,包括 2 次插入4 次删除
  1. 2 4
      fs/dcookies.c

+ 2 - 4
fs/dcookies.c

@@ -94,12 +94,10 @@ static struct dcookie_struct * alloc_dcookie(struct dentry * dentry,
 	if (!dcs)
 	if (!dcs)
 		return NULL;
 		return NULL;
 
 
-	atomic_inc(&dentry->d_count);
-	atomic_inc(&vfsmnt->mnt_count);
 	dentry->d_cookie = dcs;
 	dentry->d_cookie = dcs;
 
 
-	dcs->dentry = dentry;
-	dcs->vfsmnt = vfsmnt;
+	dcs->dentry = dget(dentry);
+	dcs->vfsmnt = mntget(vfsmnt);
 	hash_dcookie(dcs);
 	hash_dcookie(dcs);
 
 
 	return dcs;
 	return dcs;