On Mon, Feb 7, 2011 at 1:17 PM, Yi Zhang <yizhan...@gmail.com> wrote:
> On Mon, Feb 7, 2011 at 1:51 PM, Brandon High <bh...@freaks.com> wrote:
> Maybe I didn't make my intention clear. UFS with directio is
> reasonably close to a raw disk from my application's perspective: when
> the app writes to a file location, no buffering happens. My goal is to
> find a way to duplicate this on ZFS.

You're still mixing directio and O_DSYNC.

O_DSYNC is like calling fsync(2) after every write(2).  fsync(2) is
useful to obtain
some limited transactional semantics, as well as for durability
semantics.  In ZFS
you don't need to call fsync(2) to get those transactional semantics, but you do
need to call fsync(2) get those durability semantics.

Now, in ZFS fsync(2) implies a synchronous I/O operation involving significantly
more than just the data blocks you wrote to.  Which means that O_DSYNC on ZFS
is significantly slower than on UFS.  You can address this in one of two ways:
a) you might realize that you don't need every write(2) to be durable, then stop
using O_DSYNC, b) you might get a fast ZIL device.

I'm betting that if you look carefully at your application's requirements you'll
probably conclude that you don't need O_DSYNC at all.  Perhaps you can tell us
more about your application.

> Setting primarycache didn't eliminate the buffering, using O_DSYNC
> (whose side effects include elimination of buffering) made it
> ridiculously slow: none of the things I tried eliminated buffering,
> and just buffering, on ZFS.
>
> From the discussion so far my feeling is that ZFS is too different
> from UFS that there's simply no way to achieve this goal...

You've not really stated your application's requirements.  You may be convinced
that you need O_DSYNC, but chances are that you don't.  And yes, it's possible
that you'd need O_DSYNC on UFS but not on ZFS.

Nico
--
_______________________________________________
zfs-discuss mailing list
zfs-discuss@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/zfs-discuss

Reply via email to