Date: Tue, 24 Apr 2018 06:10:36 +0000 (UTC) From: Mateusz Guzik <mjg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332911 - head/sys/kern Message-ID: <201804240610.w3O6AaUg096284@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mjg Date: Tue Apr 24 06:10:36 2018 New Revision: 332911 URL: https://svnweb.freebsd.org/changeset/base/332911 Log: lockf: change the owner hash from pid to vnode-based This adds a bit missed due to the patch split, see r332882 Tested by: pho Modified: head/sys/kern/kern_lockf.c Modified: head/sys/kern/kern_lockf.c ============================================================================== --- head/sys/kern/kern_lockf.c Tue Apr 24 05:42:10 2018 (r332910) +++ head/sys/kern/kern_lockf.c Tue Apr 24 06:10:36 2018 (r332911) @@ -105,7 +105,7 @@ struct owner_graph; #define SELF 0x1 #define OTHERS 0x2 static void lf_init(void *); -static int lf_hash_owner(caddr_t, struct flock *, int); +static int lf_hash_owner(caddr_t, struct vnode *, struct flock *, int); static int lf_owner_matches(struct lock_owner *, caddr_t, struct flock *, int); static struct lockf_entry * @@ -301,7 +301,7 @@ SYSINIT(lf_init, SI_SUB_LOCK, SI_ORDER_FIRST, lf_init, * Generate a hash value for a lock owner. */ static int -lf_hash_owner(caddr_t id, struct flock *fl, int flags) +lf_hash_owner(caddr_t id, struct vnode *vp, struct flock *fl, int flags) { uint32_t h; @@ -311,9 +311,7 @@ lf_hash_owner(caddr_t id, struct flock *fl, int flags) } else if (flags & F_FLOCK) { h = ((uintptr_t) id) >> 7; } else { - struct proc *p = (struct proc *) id; - h = HASHSTEP(0, p->p_pid); - h = HASHSTEP(h, 0); + h = ((uintptr_t) vp) >> 7; } return (h % LOCK_OWNER_HASH_SIZE); @@ -500,7 +498,7 @@ retry_setlock: * Map our arguments to an existing lock owner or create one * if this is the first time we have seen this owner. */ - hash = lf_hash_owner(id, fl, flags); + hash = lf_hash_owner(id, vp, fl, flags); sx_xlock(&lf_lock_owners[hash].lock); LIST_FOREACH(lo, &lf_lock_owners[hash].list, lo_link) if (lf_owner_matches(lo, id, fl, flags))
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201804240610.w3O6AaUg096284>