From owner-svn-src-all@FreeBSD.ORG Sat Oct 4 18:28:29 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 15A0866D; Sat, 4 Oct 2014 18:28:29 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 0175F390; Sat, 4 Oct 2014 18:28:29 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s94ISSI8099604; Sat, 4 Oct 2014 18:28:28 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s94ISSaf099602; Sat, 4 Oct 2014 18:28:28 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201410041828.s94ISSaf099602@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 4 Oct 2014 18:28:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272534 - in head/sys: kern sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Oct 2014 18:28:29 -0000 Author: kib Date: Sat Oct 4 18:28:27 2014 New Revision: 272534 URL: https://svnweb.freebsd.org/changeset/base/272534 Log: Add IO_RANGELOCKED flag for vn_rdwr(9), which specifies that vnode is not locked, but range is. Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Modified: head/sys/kern/vfs_vnops.c head/sys/sys/vnode.h Modified: head/sys/kern/vfs_vnops.c ============================================================================== --- head/sys/kern/vfs_vnops.c Sat Oct 4 18:00:15 2014 (r272533) +++ head/sys/kern/vfs_vnops.c Sat Oct 4 18:28:27 2014 (r272534) @@ -504,13 +504,16 @@ vn_rdwr(enum uio_rw rw, struct vnode *vp error = 0; if ((ioflg & IO_NODELOCKED) == 0) { - if (rw == UIO_READ) { - rl_cookie = vn_rangelock_rlock(vp, offset, - offset + len); - } else { - rl_cookie = vn_rangelock_wlock(vp, offset, - offset + len); - } + if ((ioflg & IO_RANGELOCKED) == 0) { + if (rw == UIO_READ) { + rl_cookie = vn_rangelock_rlock(vp, offset, + offset + len); + } else { + rl_cookie = vn_rangelock_wlock(vp, offset, + offset + len); + } + } else + rl_cookie = NULL; mp = NULL; if (rw == UIO_WRITE) { if (vp->v_type != VCHR && Modified: head/sys/sys/vnode.h ============================================================================== --- head/sys/sys/vnode.h Sat Oct 4 18:00:15 2014 (r272533) +++ head/sys/sys/vnode.h Sat Oct 4 18:28:27 2014 (r272534) @@ -305,6 +305,7 @@ struct vattr { #define IO_NORMAL 0x0800 /* operate on regular data */ #define IO_NOMACCHECK 0x1000 /* MAC checks unnecessary */ #define IO_BUFLOCKED 0x2000 /* ffs flag; indir buf is locked */ +#define IO_RANGELOCKED 0x4000 /* range locked */ #define IO_SEQMAX 0x7F /* seq heuristic max value */ #define IO_SEQSHIFT 16 /* seq heuristic in upper 16 bits */