From owner-svn-src-all@freebsd.org Thu Jun 27 23:39:08 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 643B615D1C14; Thu, 27 Jun 2019 23:39:08 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6A99F76F8A; Thu, 27 Jun 2019 23:39:07 +0000 (UTC) (envelope-from asomers@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 411741E883; Thu, 27 Jun 2019 23:39:07 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x5RNd7uM040563; Thu, 27 Jun 2019 23:39:07 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5RNd7nx040562; Thu, 27 Jun 2019 23:39:07 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201906272339.x5RNd7nx040562@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Thu, 27 Jun 2019 23:39:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349478 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 349478 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 6A99F76F8A X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.95)[-0.951,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 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: Thu, 27 Jun 2019 23:39:08 -0000 Author: asomers Date: Thu Jun 27 23:39:06 2019 New Revision: 349478 URL: https://svnweb.freebsd.org/changeset/base/349478 Log: FIOBMAP2: inline vn_ioc_bmap2 Reported by: kib Reviewed by: kib MFC after: 2 weeks MFC-With: 349238 Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D20783 Modified: head/sys/kern/vfs_vnops.c Modified: head/sys/kern/vfs_vnops.c ============================================================================== --- head/sys/kern/vfs_vnops.c Thu Jun 27 23:37:09 2019 (r349477) +++ head/sys/kern/vfs_vnops.c Thu Jun 27 23:39:06 2019 (r349478) @@ -1457,25 +1457,6 @@ vn_stat(struct vnode *vp, struct stat *sb, struct ucre return (0); } -/* generic FIOBMAP2 implementation */ -static int -vn_ioc_bmap2(struct file *fp, struct fiobmap2_arg *arg, struct ucred *cred) -{ - struct vnode *vp = fp->f_vnode; - daddr_t lbn = arg->bn; - int error; - - vn_lock(vp, LK_SHARED | LK_RETRY); -#ifdef MAC - error = mac_vnode_check_read(cred, fp->f_cred, vp); - if (error == 0) -#endif - error = VOP_BMAP(vp, lbn, NULL, &arg->bn, &arg->runp, - &arg->runb); - VOP_UNLOCK(vp, 0); - return (error); -} - /* * File table vnode ioctl routine. */ @@ -1485,6 +1466,7 @@ vn_ioctl(struct file *fp, u_long com, void *data, stru { struct vattr vattr; struct vnode *vp; + struct fiobmap2_arg *bmarg; int error; vp = fp->f_vnode; @@ -1500,8 +1482,17 @@ vn_ioctl(struct file *fp, u_long com, void *data, stru *(int *)data = vattr.va_size - fp->f_offset; return (error); case FIOBMAP2: - return (vn_ioc_bmap2(fp, (struct fiobmap2_arg*)data, - active_cred)); + bmarg = (struct fiobmap2_arg *)data; + vn_lock(vp, LK_SHARED | LK_RETRY); +#ifdef MAC + error = mac_vnode_check_read(active_cred, fp->f_cred, + vp); + if (error == 0) +#endif + error = VOP_BMAP(vp, bmarg->bn, NULL, + &bmarg->bn, &bmarg->runp, &bmarg->runb); + VOP_UNLOCK(vp, 0); + return (error); case FIONBIO: case FIOASYNC: return (0);