Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S262364AbVEYPwV (ORCPT ); Wed, 25 May 2005 11:52:21 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S262365AbVEYPwU (ORCPT ); Wed, 25 May 2005 11:52:20 -0400 Received: from rev.193.226.233.9.euroweb.hu ([193.226.233.9]:42509 "EHLO dorka.pomaz.szeredi.hu") by vger.kernel.org with ESMTP id S261417AbVEYPwP (ORCPT ); Wed, 25 May 2005 11:52:15 -0400 To: akpm@osdl.org CC: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [PATCH] dcookies.c: use proper refcounting functions Message-Id: From: Miklos Szeredi Date: Wed, 25 May 2005 17:51:57 +0200 Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1104 Lines: 33 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 Index: linux/fs/dcookies.c =================================================================== --- linux.orig/fs/dcookies.c 2004-12-24 22:33:48.000000000 +0100 +++ linux/fs/dcookies.c 2005-05-25 17:14:08.000000000 +0200 @@ -94,12 +94,10 @@ static struct dcookie_struct * alloc_dco if (!dcs) return NULL; - atomic_inc(&dentry->d_count); - atomic_inc(&vfsmnt->mnt_count); dentry->d_cookie = dcs; - dcs->dentry = dentry; - dcs->vfsmnt = vfsmnt; + dcs->dentry = dget(dentry); + dcs->vfsmnt = mntget(vfsmnt); hash_dcookie(dcs); return dcs; - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/