Bug #7578


Fix/improve some aspects of ZIL writing.

Added by Alexander Motin over 7 years ago. Updated almost 7 years ago.

zfs - Zettabyte File System
Start date:
Due date:
% Done:


Estimated time:
Gerrit CR:
External Bug:


After some ZIL changes 6 years ago zil_slog_limit got partially broken
due to zl_itx_list_sz not updated when async itx'es upgraded to sync.
Actually because of other changes about that time zl_itx_list_sz is not
really required to implement the functionality, so this patch removes
some unneeded broken code and variables.

Original idea of zil_slog_limit was to reduce chance of SLOG abuse by
single heavy logger, that increased latency for other (more latency critical)
loggers, by pushing heavy log out into the main pool instead of SLOG. Beside
huge latency increase for heavy writers, this implementation caused double
write of all data, since the log records were explicitly prepared for SLOG.
Since we now have I/O scheduler, I've found it can be much more efficient
to reduce priority of heavy logger SLOG writes from ZIO_PRIORITY_SYNC_WRITE
to ZIO_PRIORITY_ASYNC_WRITE, while still leave them on SLOG.

Existing ZIL implementation had problem with space efficiency when it
has to write large chunks of data into log blocks of limited size. In some
cases efficiency stopped to almost as low as 50%. In case of ZIL stored on
spinning rust, that also reduced log write speed in half, since head had to
uselessly fly over allocated but not written areas. This change improves
the situation by offloading problematic operations from z*_log_write() to
zil_lwb_commit(), which knows real situation of log blocks allocation and
can split large requests into pieces much more efficiently. Also as side
effect it removes one of two data copy operations done by ZIL code WR_COPIED

While there, untangle and unify code of z*_log_write() functions.
Also zfs_log_write() alike to zvol_log_write() can now handle writes crossing
block boundary, that may also improve efficiency if ZPL is made to do that.

Actions #2

Updated by Electric Monk almost 7 years ago

  • Status changed from In Progress to Closed
  • % Done changed from 0 to 100

git commit c5ee46810f82e8a53d2cc5a487568a573f449039

commit  c5ee46810f82e8a53d2cc5a487568a573f449039
Author: Alexander Motin <>
Date:   2017-05-24T01:14:37.000Z

    7578 Fix/improve some aspects of ZIL writing.
    Reviewed by: Matthew Ahrens <>
    Reviewed by: Prakash Surya <>
    Reviewed by: Andriy Gapon <>
    Reviewed by: Steven Hartland <>
    Reviewed by: Brad Lewis <>
    Reviewed by: Richard Elling <>
    Approved by: Robert Mustacchi <>


Also available in: Atom PDF