Date: Thu, 27 Jun 2019 23:39:07 +0000 (UTC) From: Alan Somers <asomers@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349478 - head/sys/kern Message-ID: <201906272339.x5RNd7nx040562@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201906272339.x5RNd7nx040562>