Module Name: src
Committed By: riz
Date: Tue Aug 26 23:15:13 UTC 2014
Modified Files:
src/sys/fs/puffs [netbsd-7]: puffs_msgif.h puffs_sys.h puffs_vnops.c
Log Message:
Pull up following revision(s) (requested by manu in ticket #52):
sys/fs/puffs/puffs_msgif.h: revision 1.81
sys/fs/puffs/puffs_sys.h: revision 1.85
sys/fs/puffs/puffs_vnops.c: revision 1.183
Add a oflags input field to open requests so that the filesystem can pass
back information about the file. Implement PUFFS_OPEN_IO_DIRECT, which
will force direct IO (bypassing page cache) for the file.
To generate a diff of this commit:
cvs rdiff -u -r1.80 -r1.80.14.1 src/sys/fs/puffs/puffs_msgif.h
cvs rdiff -u -r1.84 -r1.84.4.1 src/sys/fs/puffs/puffs_sys.h
cvs rdiff -u -r1.182 -r1.182.2.1 src/sys/fs/puffs/puffs_vnops.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/fs/puffs/puffs_msgif.h
diff -u src/sys/fs/puffs/puffs_msgif.h:1.80 src/sys/fs/puffs/puffs_msgif.h:1.80.14.1
--- src/sys/fs/puffs/puffs_msgif.h:1.80 Fri Aug 10 16:49:35 2012
+++ src/sys/fs/puffs/puffs_msgif.h Tue Aug 26 23:15:12 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: puffs_msgif.h,v 1.80 2012/08/10 16:49:35 manu Exp $ */
+/* $NetBSD: puffs_msgif.h,v 1.80.14.1 2014/08/26 23:15:12 riz Exp $ */
/*
* Copyright (c) 2005, 2006, 2007 Antti Kantee. All Rights Reserved.
@@ -339,6 +339,9 @@ struct puffs_vfsmsg_suspend {
#define PUFFS_EXTATTRCTL_HASNODE 0x01
#define PUFFS_EXTATTRCTL_HASATTRNAME 0x02
+
+#define PUFFS_OPEN_IO_DIRECT 0x01
+
struct puffs_vfsmsg_extattrctl {
struct puffs_req pvfsr_pr;
@@ -399,6 +402,7 @@ struct puffs_vnmsg_open {
struct puffs_kcred pvnr_cred; /* OUT */
int pvnr_mode; /* OUT */
+ int pvnr_oflags; /* IN */
};
struct puffs_vnmsg_close {
Index: src/sys/fs/puffs/puffs_sys.h
diff -u src/sys/fs/puffs/puffs_sys.h:1.84 src/sys/fs/puffs/puffs_sys.h:1.84.4.1
--- src/sys/fs/puffs/puffs_sys.h:1.84 Thu Oct 17 21:03:27 2013
+++ src/sys/fs/puffs/puffs_sys.h Tue Aug 26 23:15:12 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: puffs_sys.h,v 1.84 2013/10/17 21:03:27 christos Exp $ */
+/* $NetBSD: puffs_sys.h,v 1.84.4.1 2014/08/26 23:15:12 riz Exp $ */
/*
* Copyright (c) 2005, 2006 Antti Kantee. All Rights Reserved.
@@ -197,6 +197,8 @@ struct puffs_mount {
#define PNODE_FAF 0x004 /* issue all operations as FAF */
#define PNODE_DOINACT 0x008 /* if inactive-on-demand, call inactive */
#define PNODE_SOPEXP 0x100 /* Node reclaim postponed in sop thread */
+#define PNODE_RDIRECT 0x200 /* bypass page cache on read */
+#define PNODE_WDIRECT 0x400 /* bypass page cache on write */
#define PNODE_METACACHE_ATIME 0x10 /* cache atime metadata */
#define PNODE_METACACHE_CTIME 0x20 /* cache atime metadata */
Index: src/sys/fs/puffs/puffs_vnops.c
diff -u src/sys/fs/puffs/puffs_vnops.c:1.182 src/sys/fs/puffs/puffs_vnops.c:1.182.2.1
--- src/sys/fs/puffs/puffs_vnops.c:1.182 Fri Jul 25 08:20:52 2014
+++ src/sys/fs/puffs/puffs_vnops.c Tue Aug 26 23:15:12 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: puffs_vnops.c,v 1.182 2014/07/25 08:20:52 dholland Exp $ */
+/* $NetBSD: puffs_vnops.c,v 1.182.2.1 2014/08/26 23:15:12 riz Exp $ */
/*
* Copyright (c) 2005, 2006, 2007 Antti Kantee. All Rights Reserved.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: puffs_vnops.c,v 1.182 2014/07/25 08:20:52 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: puffs_vnops.c,v 1.182.2.1 2014/08/26 23:15:12 riz Exp $");
#include <sys/param.h>
#include <sys/buf.h>
@@ -893,6 +893,7 @@ puffs_vnop_open(void *v)
PUFFS_MSG_VARS(vn, open);
struct vnode *vp = ap->a_vp;
struct puffs_mount *pmp = MPTOPUFFSMP(vp->v_mount);
+ struct puffs_node *pn = VPTOPP(vp);
int mode = ap->a_mode;
int error;
@@ -913,6 +914,12 @@ puffs_vnop_open(void *v)
PUFFS_MSG_ENQUEUEWAIT2(pmp, park_open, vp->v_data, NULL, error);
error = checkerr(pmp, error, __func__);
+ if (open_msg->pvnr_oflags & PUFFS_OPEN_IO_DIRECT) {
+ if (mode & FREAD)
+ pn->pn_stat |= PNODE_RDIRECT;
+ if (mode & FWRITE)
+ pn->pn_stat |= PNODE_WDIRECT;
+ }
out:
DPRINTF(("puffs_open: returning %d\n", error));
PUFFS_MSG_RELEASE(open);
@@ -2181,6 +2188,7 @@ puffs_vnop_read(void *v)
} */ *ap = v;
PUFFS_MSG_VARS(vn, read);
struct vnode *vp = ap->a_vp;
+ struct puffs_node *pn = VPTOPP(vp);
struct puffs_mount *pmp = MPTOPUFFSMP(vp->v_mount);
struct uio *uio = ap->a_uio;
size_t tomove, argsize;
@@ -2196,7 +2204,9 @@ puffs_vnop_read(void *v)
if (uio->uio_offset < 0)
return EINVAL;
- if (vp->v_type == VREG && PUFFS_USE_PAGECACHE(pmp)) {
+ if (vp->v_type == VREG &&
+ PUFFS_USE_PAGECACHE(pmp) &&
+ !(pn->pn_stat & PNODE_RDIRECT)) {
const int advice = IO_ADV_DECODE(ap->a_ioflag);
while (uio->uio_resid > 0) {
@@ -2301,7 +2311,9 @@ puffs_vnop_write(void *v)
mutex_enter(&pn->pn_sizemtx);
- if (vp->v_type == VREG && PUFFS_USE_PAGECACHE(pmp)) {
+ if (vp->v_type == VREG &&
+ PUFFS_USE_PAGECACHE(pmp) &&
+ !(pn->pn_stat & PNODE_WDIRECT)) {
ubcflags = UBC_WRITE | UBC_PARTIALOK | UBC_UNMAP_FLAG(vp);
/*