From owner-svn-src-all@freebsd.org Fri Oct 28 11:46:40 2016 Return-Path: Delivered-To: svn-src-all@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 66242C2555F; Fri, 28 Oct 2016 11:46:40 +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 1EF1669D; Fri, 28 Oct 2016 11:46:40 +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 u9SBkdJe008745; Fri, 28 Oct 2016 11:46:39 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9SBkdlD008744; Fri, 28 Oct 2016 11:46:39 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201610281146.u9SBkdlD008744@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 28 Oct 2016 11:46:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308028 - head/sys/fs/cd9660 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.23 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: Fri, 28 Oct 2016 11:46:40 -0000 Author: kib Date: Fri Oct 28 11:46:39 2016 New Revision: 308028 URL: https://svnweb.freebsd.org/changeset/base/308028 Log: Use buffer pager for cd9660. Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Modified: head/sys/fs/cd9660/cd9660_vnops.c Modified: head/sys/fs/cd9660/cd9660_vnops.c ============================================================================== --- head/sys/fs/cd9660/cd9660_vnops.c Fri Oct 28 11:46:15 2016 (r308027) +++ head/sys/fs/cd9660/cd9660_vnops.c Fri Oct 28 11:46:39 2016 (r308028) @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -74,6 +75,7 @@ static vop_readdir_t cd9660_readdir; static vop_readlink_t cd9660_readlink; static vop_strategy_t cd9660_strategy; static vop_vptofh_t cd9660_vptofh; +static vop_getpages_t cd9660_getpages; /* * Setattr call. Only allowed for block and character special devices. @@ -836,6 +838,45 @@ cd9660_vptofh(ap) return (0); } +SYSCTL_NODE(_vfs, OID_AUTO, cd9660, CTLFLAG_RW, 0, "cd9660 filesystem"); +static int use_buf_pager = 1; +SYSCTL_INT(_vfs_cd9660, OID_AUTO, use_buf_pager, CTLFLAG_RWTUN, + &use_buf_pager, 0, + "Use buffer pager instead of bmap"); + +static daddr_t +cd9660_gbp_getblkno(struct vnode *vp, vm_ooffset_t off) +{ + + return (lblkno(VTOI(vp)->i_mnt, off)); +} + +static int +cd9660_gbp_getblksz(struct vnode *vp, daddr_t lbn) +{ + struct iso_node *ip; + + ip = VTOI(vp); + return (blksize(ip->i_mnt, ip, lbn)); +} + +static int +cd9660_getpages(struct vop_getpages_args *ap) +{ + struct vnode *vp; + + vp = ap->a_vp; + if (vp->v_type == VCHR || vp->v_type == VBLK) + return (EOPNOTSUPP); + + if (use_buf_pager) + return (vfs_bio_getpages(vp, ap->a_m, ap->a_count, + ap->a_rbehind, ap->a_rahead, cd9660_gbp_getblkno, + cd9660_gbp_getblksz)); + return (vnode_pager_generic_getpages(vp, ap->a_m, ap->a_count, + ap->a_rbehind, ap->a_rahead, NULL, NULL)); +} + /* * Global vfs data structures for cd9660 */ @@ -857,6 +898,7 @@ struct vop_vector cd9660_vnodeops = { .vop_setattr = cd9660_setattr, .vop_strategy = cd9660_strategy, .vop_vptofh = cd9660_vptofh, + .vop_getpages = cd9660_getpages, }; /*