Hi,
I''m working on 6280630 zil synchronicity
http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=6280630
I have a working prototype.
However I need some guidance.
Currently if zil_disable=1 then a zfs_domount() calls zfsvfs_setup()
which in turn checks for zil_disable and if it is 1 then it calls
zil_destroy() and sets zfsvfs->z_log = NULL. Then zil_commit() and
zil_replaying() are checking if z_log is NULL and if it is they return
immediately.
Now in my prototype when I do: zfs set sync=delayed test/fs1
I do not actually destroy a ZIL (so I do not set z_log to NULL either)
rather I do:
1. zil_replaying()
zil_replaying(zilog_t *zilog, dmu_tx_t *tx)
{
if (zilog == NULL || zilog->zl_sync == ZFS_SYNC_DELAYED)
return (B_TRUE);
2. zil_commit()
originally I put similar check in zil_commit() but because there is also
a requirement to implement sync=always then extra check for
ZFS_SYN_ALWAYS will be required to be added on vnode operations anyway
so I might put a check for DELAYED there as well, for example:
zfs_write()
[...]
if ((ioflag & (FSYNC | FDSYNC) || zfsvfs->z_os->os_sync ==
ZFS_SYNC_ALWAYS)
&& (zfsvfs->z_os->os_sync != ZFS_SYNC_DELAYED))
zil_commit(zilog, zp->z_last_itx, zp->z_id);
And similarly for all the other operations which call zil_commit on
vnode layer (+zfs_sync() on vfs layer).
So in essence for ''zfs set sync=delayed ds'' I keep ZIL open
but
zil_commit() is not being called from vnode ops and zil_replaying()
returns immediately. Is such an approach ok or should I rather destroy
zil when ''zfs set sync=delayed'' and allocate it again if
''zfs set
sync=default|always''?
ps. I haven''t looked at zvols yet