mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-11-17 10:01:01 +03:00
a10e552b99
Adding O_DIRECT support to ZFS to bypass the ARC for writes/reads. O_DIRECT support in ZFS will always ensure there is coherency between buffered and O_DIRECT IO requests. This ensures that all IO requests, whether buffered or direct, will see the same file contents at all times. Just as in other FS's , O_DIRECT does not imply O_SYNC. While data is written directly to VDEV disks, metadata will not be synced until the associated TXG is synced. For both O_DIRECT read and write request the offset and request sizes, at a minimum, must be PAGE_SIZE aligned. In the event they are not, then EINVAL is returned unless the direct property is set to always (see below). For O_DIRECT writes: The request also must be block aligned (recordsize) or the write request will take the normal (buffered) write path. In the event that request is block aligned and a cached copy of the buffer in the ARC, then it will be discarded from the ARC forcing all further reads to retrieve the data from disk. For O_DIRECT reads: The only alignment restrictions are PAGE_SIZE alignment. In the event that the requested data is in buffered (in the ARC) it will just be copied from the ARC into the user buffer. For both O_DIRECT writes and reads the O_DIRECT flag will be ignored in the event that file contents are mmap'ed. In this case, all requests that are at least PAGE_SIZE aligned will just fall back to the buffered paths. If the request however is not PAGE_SIZE aligned, EINVAL will be returned as always regardless if the file's contents are mmap'ed. Since O_DIRECT writes go through the normal ZIO pipeline, the following operations are supported just as with normal buffered writes: Checksum Compression Encryption Erasure Coding There is one caveat for the data integrity of O_DIRECT writes that is distinct for each of the OS's supported by ZFS. FreeBSD - FreeBSD is able to place user pages under write protection so any data in the user buffers and written directly down to the VDEV disks is guaranteed to not change. There is no concern with data integrity and O_DIRECT writes. Linux - Linux is not able to place anonymous user pages under write protection. Because of this, if the user decides to manipulate the page contents while the write operation is occurring, data integrity can not be guaranteed. However, there is a module parameter `zfs_vdev_direct_write_verify` that controls the if a O_DIRECT writes that can occur to a top-level VDEV before a checksum verify is run before the contents of the I/O buffer are committed to disk. In the event of a checksum verification failure the write will return EIO. The number of O_DIRECT write checksum verification errors can be observed by doing `zpool status -d`, which will list all verification errors that have occurred on a top-level VDEV. Along with `zpool status`, a ZED event will be issues as `dio_verify` when a checksum verification error occurs. ZVOLs and dedup is not currently supported with Direct I/O. A new dataset property `direct` has been added with the following 3 allowable values: disabled - Accepts O_DIRECT flag, but silently ignores it and treats the request as a buffered IO request. standard - Follows the alignment restrictions outlined above for write/read IO requests when the O_DIRECT flag is used. always - Treats every write/read IO request as though it passed O_DIRECT and will do O_DIRECT if the alignment restrictions are met otherwise will redirect through the ARC. This property will not allow a request to fail. There is also a module parameter zfs_dio_enabled that can be used to force all reads and writes through the ARC. By setting this module parameter to 0, it mimics as if the direct dataset property is set to disabled. Reviewed-by: Brian Behlendorf <behlendorf@llnl.gov> Reviewed-by: Alexander Motin <mav@FreeBSD.org> Reviewed-by: Tony Hutter <hutter2@llnl.gov> Signed-off-by: Brian Atkinson <batkinson@lanl.gov> Co-authored-by: Mark Maybee <mark.maybee@delphix.com> Co-authored-by: Matt Macy <mmacy@FreeBSD.org> Co-authored-by: Brian Behlendorf <behlendorf@llnl.gov> Closes #10018
114 lines
6.7 KiB
INI
114 lines
6.7 KiB
INI
# This file exports variables for each tunable used in the test suite.
|
|
#
|
|
# Different platforms use different names for most tunables. To avoid littering
|
|
# the tests with conditional logic for deciding how to set each tunable, the
|
|
# logic is instead consolidated to this one file.
|
|
#
|
|
# Any use of tunables in tests must use a name defined here. New entries
|
|
# should be added to the table as needed. Please keep the table sorted
|
|
# alphabetically for ease of maintenance.
|
|
#
|
|
# Platform-specific tunables should still use a NAME from this table for
|
|
# consistency. Enter UNSUPPORTED in the column for platforms on which the
|
|
# tunable is not implemented.
|
|
|
|
UNAME=$(uname)
|
|
|
|
# NAME FreeBSD tunable Linux tunable
|
|
cat <<%%%% |
|
|
ADMIN_SNAPSHOT UNSUPPORTED zfs_admin_snapshot
|
|
ALLOW_REDACTED_DATASET_MOUNT allow_redacted_dataset_mount zfs_allow_redacted_dataset_mount
|
|
ARC_MAX arc.max zfs_arc_max
|
|
ARC_MIN arc.min zfs_arc_min
|
|
ASYNC_BLOCK_MAX_BLOCKS async_block_max_blocks zfs_async_block_max_blocks
|
|
CHECKSUM_EVENTS_PER_SECOND checksum_events_per_second zfs_checksum_events_per_second
|
|
COMMIT_TIMEOUT_PCT commit_timeout_pct zfs_commit_timeout_pct
|
|
COMPRESSED_ARC_ENABLED compressed_arc_enabled zfs_compressed_arc_enabled
|
|
CONDENSE_INDIRECT_COMMIT_ENTRY_DELAY_MS condense.indirect_commit_entry_delay_ms zfs_condense_indirect_commit_entry_delay_ms
|
|
CONDENSE_INDIRECT_OBSOLETE_PCT condense.indirect_obsolete_pct zfs_condense_indirect_obsolete_pct
|
|
CONDENSE_MIN_MAPPING_BYTES condense.min_mapping_bytes zfs_condense_min_mapping_bytes
|
|
DBUF_CACHE_SHIFT dbuf.cache_shift dbuf_cache_shift
|
|
DDT_ZAP_DEFAULT_BS dedup.ddt_zap_default_bs ddt_zap_default_bs
|
|
DDT_ZAP_DEFAULT_IBS dedup.ddt_zap_default_ibs ddt_zap_default_ibs
|
|
DDT_DATA_IS_SPECIAL ddt_data_is_special zfs_ddt_data_is_special
|
|
DEDUP_LOG_TXG_MAX dedup.log_txg_max zfs_dedup_log_txg_max
|
|
DEADMAN_CHECKTIME_MS deadman.checktime_ms zfs_deadman_checktime_ms
|
|
DEADMAN_EVENTS_PER_SECOND deadman_events_per_second zfs_deadman_events_per_second
|
|
DEADMAN_FAILMODE deadman.failmode zfs_deadman_failmode
|
|
DEADMAN_SYNCTIME_MS deadman.synctime_ms zfs_deadman_synctime_ms
|
|
DEADMAN_ZIOTIME_MS deadman.ziotime_ms zfs_deadman_ziotime_ms
|
|
DISABLE_IVSET_GUID_CHECK disable_ivset_guid_check zfs_disable_ivset_guid_check
|
|
DMU_OFFSET_NEXT_SYNC dmu_offset_next_sync zfs_dmu_offset_next_sync
|
|
EMBEDDED_SLOG_MIN_MS embedded_slog_min_ms zfs_embedded_slog_min_ms
|
|
INITIALIZE_CHUNK_SIZE initialize_chunk_size zfs_initialize_chunk_size
|
|
INITIALIZE_VALUE initialize_value zfs_initialize_value
|
|
KEEP_LOG_SPACEMAPS_AT_EXPORT keep_log_spacemaps_at_export zfs_keep_log_spacemaps_at_export
|
|
LUA_MAX_MEMLIMIT lua.max_memlimit zfs_lua_max_memlimit
|
|
L2ARC_MFUONLY l2arc.mfuonly l2arc_mfuonly
|
|
L2ARC_NOPREFETCH l2arc.noprefetch l2arc_noprefetch
|
|
L2ARC_REBUILD_BLOCKS_MIN_L2SIZE l2arc.rebuild_blocks_min_l2size l2arc_rebuild_blocks_min_l2size
|
|
L2ARC_REBUILD_ENABLED l2arc.rebuild_enabled l2arc_rebuild_enabled
|
|
L2ARC_TRIM_AHEAD l2arc.trim_ahead l2arc_trim_ahead
|
|
L2ARC_WRITE_BOOST l2arc.write_boost l2arc_write_boost
|
|
L2ARC_WRITE_MAX l2arc.write_max l2arc_write_max
|
|
LIVELIST_CONDENSE_NEW_ALLOC livelist.condense.new_alloc zfs_livelist_condense_new_alloc
|
|
LIVELIST_CONDENSE_SYNC_CANCEL livelist.condense.sync_cancel zfs_livelist_condense_sync_cancel
|
|
LIVELIST_CONDENSE_SYNC_PAUSE livelist.condense.sync_pause zfs_livelist_condense_sync_pause
|
|
LIVELIST_CONDENSE_ZTHR_CANCEL livelist.condense.zthr_cancel zfs_livelist_condense_zthr_cancel
|
|
LIVELIST_CONDENSE_ZTHR_PAUSE livelist.condense.zthr_pause zfs_livelist_condense_zthr_pause
|
|
LIVELIST_MAX_ENTRIES livelist.max_entries zfs_livelist_max_entries
|
|
LIVELIST_MIN_PERCENT_SHARED livelist.min_percent_shared zfs_livelist_min_percent_shared
|
|
MAX_DATASET_NESTING max_dataset_nesting zfs_max_dataset_nesting
|
|
MAX_MISSING_TVDS max_missing_tvds zfs_max_missing_tvds
|
|
METASLAB_DEBUG_LOAD metaslab.debug_load metaslab_debug_load
|
|
METASLAB_FORCE_GANGING metaslab.force_ganging metaslab_force_ganging
|
|
MULTIHOST_FAIL_INTERVALS multihost.fail_intervals zfs_multihost_fail_intervals
|
|
MULTIHOST_HISTORY multihost.history zfs_multihost_history
|
|
MULTIHOST_IMPORT_INTERVALS multihost.import_intervals zfs_multihost_import_intervals
|
|
MULTIHOST_INTERVAL multihost.interval zfs_multihost_interval
|
|
OVERRIDE_ESTIMATE_RECORDSIZE send.override_estimate_recordsize zfs_override_estimate_recordsize
|
|
PREFETCH_DISABLE prefetch.disable zfs_prefetch_disable
|
|
RAIDZ_EXPAND_MAX_REFLOW_BYTES vdev.expand_max_reflow_bytes raidz_expand_max_reflow_bytes
|
|
REBUILD_SCRUB_ENABLED rebuild_scrub_enabled zfs_rebuild_scrub_enabled
|
|
REMOVAL_SUSPEND_PROGRESS removal_suspend_progress zfs_removal_suspend_progress
|
|
REMOVE_MAX_SEGMENT remove_max_segment zfs_remove_max_segment
|
|
RESILVER_MIN_TIME_MS resilver_min_time_ms zfs_resilver_min_time_ms
|
|
SCAN_LEGACY scan_legacy zfs_scan_legacy
|
|
SCAN_SUSPEND_PROGRESS scan_suspend_progress zfs_scan_suspend_progress
|
|
SCAN_VDEV_LIMIT scan_vdev_limit zfs_scan_vdev_limit
|
|
SCRUB_AFTER_EXPAND scrub_after_expand zfs_scrub_after_expand
|
|
SEND_HOLES_WITHOUT_BIRTH_TIME send_holes_without_birth_time send_holes_without_birth_time
|
|
SLOW_IO_EVENTS_PER_SECOND slow_io_events_per_second zfs_slow_io_events_per_second
|
|
SPA_ASIZE_INFLATION spa.asize_inflation spa_asize_inflation
|
|
SPA_DISCARD_MEMORY_LIMIT spa.discard_memory_limit zfs_spa_discard_memory_limit
|
|
SPA_LOAD_VERIFY_DATA spa.load_verify_data spa_load_verify_data
|
|
SPA_LOAD_VERIFY_METADATA spa.load_verify_metadata spa_load_verify_metadata
|
|
TRIM_EXTENT_BYTES_MIN trim.extent_bytes_min zfs_trim_extent_bytes_min
|
|
TRIM_METASLAB_SKIP trim.metaslab_skip zfs_trim_metaslab_skip
|
|
TRIM_TXG_BATCH trim.txg_batch zfs_trim_txg_batch
|
|
TXG_HISTORY txg.history zfs_txg_history
|
|
TXG_TIMEOUT txg.timeout zfs_txg_timeout
|
|
UNLINK_SUSPEND_PROGRESS UNSUPPORTED zfs_unlink_suspend_progress
|
|
VDEV_FILE_LOGICAL_ASHIFT vdev.file.logical_ashift vdev_file_logical_ashift
|
|
VDEV_FILE_PHYSICAL_ASHIFT vdev.file.physical_ashift vdev_file_physical_ashift
|
|
VDEV_MAX_AUTO_ASHIFT vdev.max_auto_ashift zfs_vdev_max_auto_ashift
|
|
VDEV_MIN_MS_COUNT vdev.min_ms_count zfs_vdev_min_ms_count
|
|
VDEV_DIRECT_WR_VERIFY vdev.direct_write_verify zfs_vdev_direct_write_verify
|
|
VDEV_VALIDATE_SKIP vdev.validate_skip vdev_validate_skip
|
|
VOL_INHIBIT_DEV UNSUPPORTED zvol_inhibit_dev
|
|
VOL_MODE vol.mode zvol_volmode
|
|
VOL_RECURSIVE vol.recursive UNSUPPORTED
|
|
VOL_USE_BLK_MQ UNSUPPORTED zvol_use_blk_mq
|
|
BCLONE_ENABLED bclone_enabled zfs_bclone_enabled
|
|
BCLONE_WAIT_DIRTY bclone_wait_dirty zfs_bclone_wait_dirty
|
|
DIO_ENABLED dio_enabled zfs_dio_enabled
|
|
XATTR_COMPAT xattr_compat zfs_xattr_compat
|
|
ZEVENT_LEN_MAX zevent.len_max zfs_zevent_len_max
|
|
ZEVENT_RETAIN_MAX zevent.retain_max zfs_zevent_retain_max
|
|
ZIO_SLOW_IO_MS zio.slow_io_ms zio_slow_io_ms
|
|
ZIL_SAXATTR zil_saxattr zfs_zil_saxattr
|
|
%%%%
|
|
while read name FreeBSD Linux; do
|
|
eval "export ${name}=\$${UNAME}"
|
|
done
|