Skip to content

Commit

Permalink
ffs: Support O_DSYNC.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
macdice committed Jan 8, 2021
1 parent a5e2840 commit e7347be
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion sys/ufs/ffs/ffs_vnops.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit e7347be

Please sign in to comment.