mirror_zfs/lib/libzfs
Etienne Dechamps b18019d2d8 Fix synchronicity for ZVOLs.
zvol_write() assumes that the write request must be written to stable storage
if rq_is_sync() is true. Unfortunately, this assumption is incorrect. Indeed,
"sync" does *not* mean what we think it means in the context of the Linux
block layer. This is well explained in linux/fs.h:

    WRITE:       A normal async write. Device will be plugged.
    WRITE_SYNC:  Synchronous write. Identical to WRITE, but passes down
                 the hint that someone will be waiting on this IO
                 shortly.
    WRITE_FLUSH: Like WRITE_SYNC but with preceding cache flush.
    WRITE_FUA:   Like WRITE_SYNC but data is guaranteed to be on
                 non-volatile media on completion.

In other words, SYNC does not *mean* that the write must be on stable storage
on completion. It just means that someone is waiting on us to complete the
write request. Thus triggering a ZIL commit for each SYNC write request on a
ZVOL is unnecessary and harmful for performance. To make matters worse, ZVOL
users have no way to express that they actually want data to be written to
stable storage, which means the ZIL is broken for ZVOLs.

The request for stable storage is expressed by the FUA flag, so we must
commit the ZIL after the write if the FUA flag is set. In addition, we must
commit the ZIL before the write if the FLUSH flag is set.

Also, we must inform the block layer that we actually support FLUSH and FUA.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
2012-02-07 16:23:06 -08:00
..
libzfs_changelist.c Remove HAVE_ZPL from commands and libraries 2011-02-04 16:14:34 -08:00
libzfs_config.c Fix gcc missing braces warnings 2010-08-27 15:34:03 -07:00
libzfs_dataset.c Ignore dataset if the dds_type is DMU_OST_OTHER 2012-01-19 09:29:48 -08:00
libzfs_diff.c Add linux compatibility 2010-08-31 13:41:59 -07:00
libzfs_fru.c Add linux topology support 2010-08-31 13:42:00 -07:00
libzfs_graph.c Fix gcc missing braces warnings 2010-08-27 15:34:03 -07:00
libzfs_import.c Improve 'zpool import' safety 2011-02-17 09:35:43 -08:00
libzfs_mount.c Add overlay(-O) mount option support 2012-01-12 15:49:38 -08:00
libzfs_pool.c Allow GPT+EFI vdev replacement in boot pools. 2012-01-18 11:05:24 -08:00
libzfs_sendrecv.c Fix 'zfs send -D' segfault 2011-06-09 13:58:48 -07:00
libzfs_status.c Use gethostid in the Linux convention. 2011-04-25 10:36:17 -05:00
libzfs_util.c Use /dev/null for stdout/stderr in libzfs_run_process(). 2011-08-01 13:52:23 -07:00
Makefile.am Combine libraries: spl, avl, efi, share, unicode. 2012-01-17 15:19:50 -08:00
Makefile.in Fix synchronicity for ZVOLs. 2012-02-07 16:23:06 -08:00