On Fri, Apr 2, 2010 at 16:24, Edward Ned Harvey <solar...@nedharvey.com> wrote:
>> The purpose of the ZIL is to act like a fast "log" for synchronous
>> writes.  It allows the system to quickly confirm a synchronous write
>> request with the minimum amount of work.
>
> Bob and Casper and some others clearly know a lot here.  But I'm hearing
> conflicting information, and don't know what to believe.  Does anyone here
> work on ZFS as an actual ZFS developer for Sun/Oracle?  Can claim "I can
> answer this question, I wrote that code, or at least have read it?"
>
> Questions to answer would be:
>
> Is a ZIL log device used only by sync() and fsync() system calls?  Is it
> ever used to accelerate async writes?

sync() will tell the filesystems to flush writes to disk. sync() will
not use ZIL, it will just start a new TXG, and could return before the
writes are done.

fsync() is what you are interested in.

>
> Suppose there is an application which sometimes does sync writes, and
> sometimes async writes.  In fact, to make it easier, suppose two processes
> open two files, one of which always writes asynchronously, and one of which
> always writes synchronously.  Suppose the ZIL is disabled.  Is it possible
> for writes to be committed to disk out-of-order?  Meaning, can a large block
> async write be put into a TXG and committed to disk before a small sync
> write to a different file is committed to disk, even though the small sync
> write was issued by the application before the large async write?  Remember,
> the point is:  ZIL is disabled.  Question is whether the async could
> possibly be committed to disk before the sync.
>

Writers from a TXG will not be used until the whole TXG is committed to disk.
Everything from a half written TXG will be ignored after a crash.

This means that the order of writes within a TXG is not important.

The only way to do a sync write without ZIL is to start a new TXG
after the write. That costs a lot so we have the ZIL for sync writes.
_______________________________________________
zfs-discuss mailing list
zfs-discuss@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/zfs-discuss

Reply via email to