Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 8 Jan 2021 00:16:58 GMT
From:      Thomas Munro <tmunro@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: e7347be9e34d - main - ffs: Support O_DSYNC.
Message-ID:  <202101080016.1080GwWF034094@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by tmunro:

URL: https://cgit.FreeBSD.org/src/commit/?id=e7347be9e34d05130df878d6af2ff847227610b6

commit e7347be9e34d05130df878d6af2ff847227610b6
Author:     Thomas Munro <tmunro@FreeBSD.org>
AuthorDate: 2021-01-07 10:50:59 +0000
Commit:     Thomas Munro <tmunro@FreeBSD.org>
CommitDate: 2021-01-08 00:15:56 +0000

    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
---
 sys/ufs/ffs/ffs_vnops.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

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;
 	}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202101080016.1080GwWF034094>