From owner-svn-src-stable-9@FreeBSD.ORG Sat Jan 19 06:31:37 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id BA8853D3; Sat, 19 Jan 2013 06:31:37 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id A28DBDF5; Sat, 19 Jan 2013 06:31:37 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r0J6Vbtm017960; Sat, 19 Jan 2013 06:31:37 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r0J6VbuT017959; Sat, 19 Jan 2013 06:31:37 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201301190631.r0J6VbuT017959@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 19 Jan 2013 06:31:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r245662 - stable/9/sys/kern X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Jan 2013 06:31:37 -0000 Author: kib Date: Sat Jan 19 06:31:37 2013 New Revision: 245662 URL: http://svnweb.freebsd.org/changeset/base/245662 Log: MFC r245407,245411: Set the v_hash for a new vnode in the getnewvnode() to the value calculated based on the vnode structure address. Modified: stable/9/sys/kern/vfs_subr.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/vfs_subr.c ============================================================================== --- stable/9/sys/kern/vfs_subr.c Sat Jan 19 06:27:39 2013 (r245661) +++ stable/9/sys/kern/vfs_subr.c Sat Jan 19 06:31:37 2013 (r245662) @@ -282,6 +282,8 @@ SYSCTL_INT(_debug, OID_AUTO, vnlru_nowhe #define VSHOULDFREE(vp) (!((vp)->v_iflag & VI_FREE) && !(vp)->v_holdcnt) #define VSHOULDBUSY(vp) (((vp)->v_iflag & VI_FREE) && (vp)->v_holdcnt) +/* Shift count for (uintptr_t)vp to initialize vp->v_hash. */ +static int vnsz2log; /* * Initialize the vnode management data structures. @@ -296,6 +298,7 @@ SYSCTL_INT(_debug, OID_AUTO, vnlru_nowhe static void vntblinit(void *dummy __unused) { + u_int i; int physvnodes, virtvnodes; /* @@ -337,6 +340,9 @@ vntblinit(void *dummy __unused) syncer_maxdelay = syncer_mask + 1; mtx_init(&sync_mtx, "Syncer mtx", NULL, MTX_DEF); cv_init(&sync_wakeup, "syncer"); + for (i = 1; i <= sizeof(struct vnode); i <<= 1) + vnsz2log++; + vnsz2log--; } SYSINIT(vfs, SI_SUB_VFS, SI_ORDER_FIRST, vntblinit, NULL); @@ -1077,6 +1083,14 @@ alloc: } rangelock_init(&vp->v_rl); + /* + * For the filesystems which do not use vfs_hash_insert(), + * still initialize v_hash to have vfs_hash_index() useful. + * E.g., nullfs uses vfs_hash_index() on the lower vnode for + * its own hashing. + */ + vp->v_hash = (uintptr_t)vp >> vnsz2log; + *vpp = vp; return (0); }