From owner-svn-src-head@freebsd.org Sun Jan 22 19:38:46 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C8B0BCBC0C1; Sun, 22 Jan 2017 19:38:46 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7E89DED9; Sun, 22 Jan 2017 19:38:46 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0MJcjLK089023; Sun, 22 Jan 2017 19:38:45 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0MJcjcB089022; Sun, 22 Jan 2017 19:38:45 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201701221938.v0MJcjcB089022@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 22 Jan 2017 19:38:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312646 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Jan 2017 19:38:46 -0000 Author: kib Date: Sun Jan 22 19:38:45 2017 New Revision: 312646 URL: https://svnweb.freebsd.org/changeset/base/312646 Log: More style cleanup. Use ANSI C definition for vn_closefile(). Switch to VNASSERT in _vn_lock(), simplify messages. Sponsored by: The FreeBSD Foundation X-MFC with: r312600, r312601, r312602, r312606 Modified: head/sys/kern/vfs_vnops.c Modified: head/sys/kern/vfs_vnops.c ============================================================================== --- head/sys/kern/vfs_vnops.c Sun Jan 22 19:36:02 2017 (r312645) +++ head/sys/kern/vfs_vnops.c Sun Jan 22 19:38:45 2017 (r312646) @@ -1538,27 +1538,21 @@ _vn_lock(struct vnode *vp, int flags, ch int error; VNASSERT((flags & LK_TYPE_MASK) != 0, vp, - ("vn_lock called with no locktype.")); -#ifdef DEBUG_VFS_LOCKS - KASSERT(vp->v_holdcnt != 0, - ("vn_lock %p: zero hold count", vp)); -#endif + ("vn_lock: no locktype")); + VNASSERT(vp->v_holdcnt != 0, vp, ("vn_lock: zero hold count")); retry: error = VOP_LOCK1(vp, flags, file, line); flags &= ~LK_INTERLOCK; /* Interlock is always dropped. */ KASSERT((flags & LK_RETRY) == 0 || error == 0, - ("LK_RETRY set with incompatible flags (0x%x) or " - " an error occurred (%d)", flags, error)); + ("vn_lock: error %d incompatible with flags %#x", error, flags)); if ((flags & LK_RETRY) == 0) { - if (error == 0 && vp->v_iflag & VI_DOOMED) { + if (error == 0 && (vp->v_iflag & VI_DOOMED) != 0) { VOP_UNLOCK(vp, 0); error = ENOENT; } - } else { - if (error != 0) - goto retry; - } + } else if (error != 0) + goto retry; return (error); } @@ -1566,9 +1560,7 @@ retry: * File table vnode close routine. */ static int -vn_closefile(fp, td) - struct file *fp; - struct thread *td; +vn_closefile(struct file *fp, struct thread *td) { struct vnode *vp; struct flock lf; @@ -1577,12 +1569,14 @@ vn_closefile(fp, td) vp = fp->f_vnode; fp->f_ops = &badfileops; - if (__predict_false(fp->f_flag & FHASLOCK) && fp->f_type == DTYPE_VNODE) + if (__predict_false((fp->f_flag & FHASLOCK) != 0) && + fp->f_type == DTYPE_VNODE) vrefact(vp); error = vn_close(vp, fp->f_flag, fp->f_cred, td); - if (__predict_false(fp->f_flag & FHASLOCK) && fp->f_type == DTYPE_VNODE) { + if (__predict_false((fp->f_flag & FHASLOCK) != 0) && + fp->f_type == DTYPE_VNODE) { lf.l_whence = SEEK_SET; lf.l_start = 0; lf.l_len = 0;