summaryrefslogtreecommitdiffstats
path: root/sys/fs/cd9660
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2016-11-11 20:27:00 +0000
committerkib <kib@FreeBSD.org>2016-11-11 20:27:00 +0000
commitb367d5d01363c09d5c8ab0725ec4990c635e6e0a (patch)
tree6ae009a6753d7cdfa7cc3ce56cb6f6f2988c4d1a /sys/fs/cd9660
parent1221d1e004b5b249b7ec570fe42f267670558108 (diff)
downloadFreeBSD-src-b367d5d01363c09d5c8ab0725ec4990c635e6e0a.zip
FreeBSD-src-b367d5d01363c09d5c8ab0725ec4990c635e6e0a.tar.gz
MFC r308028:
Use buffer pager for cd9660. For now, on stable/11, default is to use generic getpages() as before.
Diffstat (limited to 'sys/fs/cd9660')
-rw-r--r--sys/fs/cd9660/cd9660_vnops.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/sys/fs/cd9660/cd9660_vnops.c b/sys/fs/cd9660/cd9660_vnops.c
index cab8db7..8b19d0d 100644
--- a/sys/fs/cd9660/cd9660_vnops.c
+++ b/sys/fs/cd9660/cd9660_vnops.c
@@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$");
#include <sys/dirent.h>
#include <sys/unistd.h>
#include <sys/filio.h>
+#include <sys/sysctl.h>
#include <vm/vm.h>
#include <vm/vnode_pager.h>
@@ -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 = 0;
+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,
};
/*
OpenPOWER on IntegriCloud