diff options
author | George Wilson <gwilson@zfsmail.com> | 2019-05-22 14:28:52 +0000 |
---|---|---|
committer | Jerry Jelinek <jerry.jelinek@joyent.com> | 2019-06-28 16:27:00 +0000 |
commit | da7753c428994e4e6c715886c93d7b49390c3705 (patch) | |
tree | a147cd5719bc116d4711eda66c30991a5cb60db4 | |
parent | a1d63828c2e12098f43bb49de5b78a6bafc80979 (diff) | |
download | illumos-gate-da7753c428994e4e6c715886c93d7b49390c3705.tar.gz |
11052 ZFS Reads may result in unneccesary calls to zil_commit
Portions contributed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Reviewed by: Matt Ahrens <mahrens@delphix.com>
Reviewed by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed by: Toomas Soome <tsoome@me.com>
Reviewed by: Andy Fiddaman <andy@omniosce.org>
Approved by: Dan McDonald <danmcd@joyent.com>
-rw-r--r-- | usr/src/uts/common/fs/zfs/zfs_vnops.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/usr/src/uts/common/fs/zfs/zfs_vnops.c b/usr/src/uts/common/fs/zfs/zfs_vnops.c index c8cb5b3935..87c2d64dd3 100644 --- a/usr/src/uts/common/fs/zfs/zfs_vnops.c +++ b/usr/src/uts/common/fs/zfs/zfs_vnops.c @@ -513,6 +513,7 @@ zfs_read(vnode_t *vp, uio_t *uio, int ioflag, cred_t *cr, caller_context_t *ct) zfsvfs_t *zfsvfs = zp->z_zfsvfs; ssize_t n, nbytes; int error = 0; + boolean_t frsync = B_FALSE; xuio_t *xuio = NULL; ZFS_ENTER(zfsvfs); @@ -550,10 +551,20 @@ zfs_read(vnode_t *vp, uio_t *uio, int ioflag, cred_t *cr, caller_context_t *ct) } } +#ifdef FRSYNC /* * If we're in FRSYNC mode, sync out this znode before reading it. + * Only do this for non-snapshots. + * + * Some platforms do not support FRSYNC and instead map it + * to FSYNC, which results in unnecessary calls to zil_commit. We + * only honor FRSYNC requests on platforms which support it. */ - if (ioflag & FRSYNC || zfsvfs->z_os->os_sync == ZFS_SYNC_ALWAYS) + frsync = !!(ioflag & FRSYNC); +#endif + + if (zfsvfs->z_log && + (frsync || zfsvfs->z_os->os_sync == ZFS_SYNC_ALWAYS)) zil_commit(zfsvfs->z_log, zp->z_id); /* |