Page MenuHomeFreeBSD

D31513.diff
No OneTemporary

D31513.diff

diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c
--- a/sys/kern/vfs_vnops.c
+++ b/sys/kern/vfs_vnops.c
@@ -920,6 +920,35 @@
return (ret);
}
+static int
+get_write_ioflag(struct file *fp)
+{
+ int ioflag;
+ struct mount *mp;
+ struct vnode *vp;
+
+ ioflag = 0;
+ vp = fp->f_vnode;
+ mp = atomic_load_ptr(&vp->v_mount);
+
+ if ((fp->f_flag & O_DIRECT) != 0)
+ ioflag |= IO_DIRECT;
+
+ if ((fp->f_flag & O_FSYNC) != 0 ||
+ (mp != NULL && (mp->mnt_flag & MNT_SYNCHRONOUS) != 0))
+ ioflag |= IO_SYNC;
+
+ /*
+ * For O_DSYNC we set both IO_SYNC and IO_DATASYNC, so that VOP_WRITE()
+ * or VOP_DEALLOCATE() implementations that don't understand IO_DATASYNC
+ * fall back to full O_SYNC behavior.
+ */
+ if ((fp->f_flag & O_DSYNC) != 0)
+ ioflag |= IO_SYNC | IO_DATASYNC;
+
+ return (ioflag);
+}
+
int
vn_read_from_obj(struct vnode *vp, struct uio *uio)
{
@@ -1119,25 +1148,12 @@
if (vp->v_type == VREG)
bwillwrite();
ioflag = IO_UNIT;
- if (vp->v_type == VREG && (fp->f_flag & O_APPEND))
+ if (vp->v_type == VREG && (fp->f_flag & O_APPEND) != 0)
ioflag |= IO_APPEND;
- if (fp->f_flag & FNONBLOCK)
+ if ((fp->f_flag & FNONBLOCK) != 0)
ioflag |= IO_NDELAY;
- if (fp->f_flag & O_DIRECT)
- ioflag |= IO_DIRECT;
+ ioflag |= get_write_ioflag(fp);
- mp = atomic_load_ptr(&vp->v_mount);
- if ((fp->f_flag & O_FSYNC) ||
- (mp != NULL && (mp->mnt_flag & MNT_SYNCHRONOUS)))
- ioflag |= IO_SYNC;
-
- /*
- * For O_DSYNC we set both IO_SYNC and IO_DATASYNC, so that VOP_WRITE()
- * implementations that don't understand IO_DATASYNC fall back to full
- * O_SYNC behavior.
- */
- if (fp->f_flag & O_DSYNC)
- ioflag |= IO_SYNC | IO_DATASYNC;
mp = NULL;
need_finished_write = false;
if (vp->v_type != VCHR) {

File Metadata

Mime Type
text/plain
Expires
Fri, Jan 17, 1:58 PM (20 h, 19 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15839332
Default Alt Text
D31513.diff (1 KB)

Event Timeline