zfs_read(struct inode *ip, uio_t *uio, int ioflag, cred_t *cr)
{
int error = 0;
+ boolean_t frsync = B_FALSE;
znode_t *zp = ITOZ(ip);
zfsvfs_t *zfsvfs = ITOZSB(ip);
return (0);
}
+#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.
*/
+ frsync = !!(ioflag & FRSYNC);
+#endif
if (zfsvfs->z_log &&
- (ioflag & FRSYNC || zfsvfs->z_os->os_sync == ZFS_SYNC_ALWAYS))
+ (frsync || zfsvfs->z_os->os_sync == ZFS_SYNC_ALWAYS))
zil_commit(zfsvfs->z_log, zp->z_id);
/*
* excl - flag indicating exclusive or non-exclusive mode.
* mode - mode to open file with.
* cr - credentials of caller.
- * flag - large file flag [UNUSED].
+ * flag - file flag.
* vsecp - ACL to be set
*
* OUT: ipp - inode of created or trunc'd entry.
dmu_tx_t *tx = NULL;
uint64_t uid, gid;
sa_bulk_attr_t bulk[4];
- int count = 0;
+ int count;
int err;
zap_cursor_init(&zc, os, dzp->z_id);
while ((err = zap_cursor_retrieve(&zc, &zap)) == 0) {
+ count = 0;
if (zap.za_integer_length != 8 || zap.za_num_integers != 1) {
err = ENXIO;
break;
vattr_t vap;
int error;
- if ((lckdat->l_whence == 2) || (whence == 2)) {
+ if ((lckdat->l_whence == SEEK_END) || (whence == SEEK_END)) {
if ((error = zfs_getattr(ip, &vap, 0, CRED())))
return (error);
}
switch (lckdat->l_whence) {
- case 1:
+ case SEEK_CUR:
lckdat->l_start += offset;
break;
- case 2:
+ case SEEK_END:
lckdat->l_start += vap.va_size;
/* FALLTHRU */
- case 0:
+ case SEEK_SET:
break;
default:
return (SET_ERROR(EINVAL));
return (SET_ERROR(EINVAL));
switch (whence) {
- case 1:
+ case SEEK_CUR:
lckdat->l_start -= offset;
break;
- case 2:
+ case SEEK_END:
lckdat->l_start -= vap.va_size;
/* FALLTHRU */
- case 0:
+ case SEEK_SET:
break;
default:
return (SET_ERROR(EINVAL));
* bfp - section of file to free/alloc.
* flag - current file open mode flags.
* offset - current file offset.
- * cr - credentials of caller [UNUSED].
+ * cr - credentials of caller.
*
* RETURN: 0 on success, error code on failure.
*
return (SET_ERROR(EROFS));
}
- if ((error = convoff(ip, bfp, 0, offset))) {
+ if ((error = convoff(ip, bfp, SEEK_SET, offset))) {
ZFS_EXIT(zfsvfs);
return (error);
}