diff options
author | Thomas Munro <tmunro@FreeBSD.org> | 2021-01-07 10:50:59 +0000 |
---|---|---|
committer | Thomas Munro <tmunro@FreeBSD.org> | 2021-01-08 00:15:56 +0000 |
commit | e7347be9e34d05130df878d6af2ff847227610b6 (patch) | |
tree | 6fabddc4c44442c46ba97ee17ab8c732b2571fad /sys/ufs | |
parent | a5e284038edc36b0447f1e6337419a3c0ea1788d (diff) | |
download | src-e7347be9e34d05130df878d6af2ff847227610b6.tar.gz src-e7347be9e34d05130df878d6af2ff847227610b6.zip |
ffs: Support O_DSYNC.
Respect the new IO_DATASYNC flag when performing synchronous writes.
Compared to O_SYNC, O_DSYNC lets us skip updating the inode in some
cases, matching the behaviour of fdatasync(2).
Reviewed by: kib
Differential Review: https://reviews.freebsd.org/D25160
Diffstat (limited to 'sys/ufs')
-rw-r--r-- | sys/ufs/ffs/ffs_vnops.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/ufs/ffs/ffs_vnops.c b/sys/ufs/ffs/ffs_vnops.c index f7a1084d2838..6ca98a84869d 100644 --- a/sys/ufs/ffs/ffs_vnops.c +++ b/sys/ufs/ffs/ffs_vnops.c @@ -1001,7 +1001,9 @@ ffs_write(ap) uio->uio_resid = resid; } } else if (resid > uio->uio_resid && (ioflag & IO_SYNC)) { - error = ffs_update(vp, 1); + if (!(ioflag & IO_DATASYNC) || + (ip->i_flags & (IN_SIZEMOD | IN_IBLKDATA))) + error = ffs_update(vp, 1); if (ffs_fsfail_cleanup(VFSTOUFS(vp->v_mount), error)) error = ENXIO; } |