master - device: Basic config and setup to support async I/O.
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=8c7bbcfb0f6771a10acd238057fdb7931c3fbb12 Commit: 8c7bbcfb0f6771a10acd238057fdb7931c3fbb12 Parent: 7a9af3cd0e609e10840202ae1754ab76b6add511 Author: Alasdair G Kergon <[email protected]> AuthorDate: Mon Jan 22 17:45:12 2018 +0000 Committer: Alasdair G Kergon <[email protected]> CommitterDate: Thu Feb 8 20:15:14 2018 +0000
device: Basic config and setup to support async I/O.
--- WHATS_NEW | 1 + conf/example.conf.in | 5 + configure | 69 ++++++++++++++ configure.in | 22 +++++ doc/aio_design.txt | 215 ++++++++++++++++++++++++++++++++++++++++++ include/configure.h.in | 3 + lib/commands/toolcontext.c | 10 ++ lib/commands/toolcontext.h | 1 + lib/config/config_settings.h | 3 + lib/config/defaults.h | 1 + lib/device/dev-cache.c | 2 + lib/device/dev-io.c | 79 +++++++++++++++ lib/device/device.h | 5 + make.tmpl.in | 3 +- tools/toollib.c | 1 + 15 files changed, 419 insertions(+), 1 deletions(-)
WHATS_NEW +1 -0
@@ -1,5 +1,6 @@ Version 2.02.178 - ===================================== + Detect asynchronous I/O capability in configure or accept --disable-aio. Add AIO_SUPPORTED_CODE_PATH to indicate whether AIO may be used. Configure ensures /usr/bin dir is checked for dmpd tools. Restore pvmove support for wide-clustered active volumes (2.02.177).
conf/example.conf.in +5 -0
@@ -59,6 +59,11 @@ devices { # This configuration option is advanced. scan = [ "/dev" ] + # Configuration option devices/use_aio. + # Use linux asynchronous I/O for parallel device access where possible. + # This configuration option has an automatic default value. + # use_aio = 1 + # Configuration option devices/obtain_device_list_from_udev. # Obtain the list of available devices from udev. # This avoids opening or using any inapplicable non-block devices or
configure +69 -0
112 lines not on this page · raw message
at.socket scripts/lvm2_lvmlockd_systemd_red_hat.service scripts/lvm2_lvmlocking_systemd_red_hat.service scripts/lvm2_monitoring_init_red_hat scripts/lvm2_monitoring_systemd_red_hat.service scripts/lvm2_pvscan_systemd_red_hat at .service scripts/lvm2_tmpfiles_red_hat.conf scripts/lvmdump.sh scripts/Makefile test/Makefile test/api/Makefile test/unit/Makefile tools/Makefile udev/Makefile unit-tests/datastruct/Makefile unit-tests/regex/Makefile unit-tests/mm/Makefile"
configure.in +22 -0
@@ -39,6 +39,7 @@ case "$host_os" in LDDEPS="$LDDEPS .export.sym" LIB_SUFFIX=so DEVMAPPER=yes + AIO=yes BUILD_LVMETAD=no BUILD_LVMPOLLD=no LOCKDSANLOCK=no
@@ -58,6 +59,7 @@ case "$host_os" in CLDNOWHOLEARCHIVE= LIB_SUFFIX=dylib DEVMAPPER=yes + AIO=no ODIRECT=no DM_IOCTLS=no SELINUX=no
@@ -1123,6 +1125,24 @@ if test "$DEVMAPPER" = yes; then fi ################################################################################ +dnl -- Disable aio +AC_MSG_CHECKING(whether to use asynchronous I/O) +AC_ARG_ENABLE(aio, + AC_HELP_STRING([--disable-aio], + [disable asynchronous I/O]), + AIO=$enableval) +AC_MSG_RESULT($AIO) + +if test "$AIO" = yes; then + AC_CHECK_LIB(aio, io_setup, + [AC_DEFINE([AIO_SUPPORT], 1, [Define to 1 if aio is available.]) + AIO_LIBS="-laio" + AIO_SUPPORT=yes], + [AIO_LIBS= + AIO_SUPPORT=no ]) +fi + +################################################################################ dnl -- Build lvmetad AC_MSG_CHECKING(whether to build LVMetaD) AC_ARG_ENABLE(lvmetad,
@@ -2061,9 +2081,11 @@ AC_SUBST(DEFAULT_USE_LVMETAD) AC_SUBST(DEFAULT_USE_LVMPOLLD) AC_SUBST(DEFAULT_USE_LVMLOCKD) AC_SUBST(DEVMAPPER) +AC_SUBST(AIO) AC_SUBST(DLM_CFLAGS) AC_SUBST(DLM_LIBS) AC_SUBST(DL_LIBS) +AC_SUBST(AIO_LIBS) AC_SUBST(DMEVENTD_PATH) AC_SUBST(DM_LIB_PATCHLEVEL) AC_SUBST(ELDFLAGS)
doc/aio_design.txt new file +215 -0
215 lines not on this page · raw message
include/configure.h.in +3 -0
@@ -1,5 +1,8 @@ /* include/configure.h.in. Generated from configure.in by autoheader. */ +/* Define to 1 if aio is available. */ +#undef AIO_SUPPORT + /* Define to 1 to use libblkid detection of signatures when wiping. */ #undef BLKID_WIPING_SUPPORT
lib/commands/toolcontext.c +10 -0
@@ -635,6 +635,16 @@ static int _process_config(struct cmd_context *cmd)*/ cmd->default_settings.udev_fallback = udev_disabled ?1 :-1 ; +#ifdef AIO_SUPPORT + cmd->use_aio =find_config_tree_bool (cmd, devices_use_aio_CFG,NULL ); +#else + cmd->use_aio =0 ; +#endif +if (cmd->use_aio && !dev_async_setup (cmd)) + cmd->use_aio =0 ; + +log_debug_io ("%ssing asynchronous I/O." , cmd->use_aio ?"U" :"Not u" ); +init_retry_deactivation (find_config_tree_bool (cmd, activation_retry_deactivation_CFG,NULL ));init_activation_checks (find_config_tree_bool (cmd, activation_checks_CFG,NULL ));
lib/commands/toolcontext.h +1 -0
@@ -164,6 +164,7 @@ struct cmd_context { unsigned vg_notify:1; unsigned lv_notify:1; unsigned pv_notify:1; + unsigned use_aio:1;/* * Filtering.
lib/config/config_settings.h +3 -0
@@ -226,6 +226,9 @@ cfg(devices_dir_CFG, "dir", devices_CFG_SECTION, CFG_ADVANCED, CFG_TYPE_STRING,cfg_array (devices_scan_CFG,"scan" , devices_CFG_SECTION,CFG_ADVANCED ,CFG_TYPE_STRING ,"#S/dev" ,vsn (1 ,0 ,0 ),NULL ,0 ,NULL , "Directories containing device nodes to use with LVM.\n") +cfg (devices_use_aio_CFG,"use_aio" , devices_CFG_SECTION,CFG_DEFAULT_COMMENTED ,CFG_TYPE_BOOL ,DEFAULT_USE_AIO ,vsn (2 ,2 ,178 ),NULL ,0 ,NULL , + "Use linux asynchronous I/O for parallel device access where possible.\n") + cfg_array(devices_loopfiles_CFG, "loopfiles", devices_CFG_SECTION, CFG_DEFAULT_UNDEFINED | CFG_UNSUPPORTED, CFG_TYPE_STRING, NULL, vsn(1, 2, 0), NULL, 0, NULL, NULL) cfg(devices_obtain_device_list_from_udev_CFG, "obtain_device_list_from_udev", devices_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_OBTAIN_DEVICE_LIST_FROM_UDEV, vsn(2, 2, 85), NULL, 0, NULL,
lib/config/defaults.h +1 -0
@@ -32,6 +32,7 @@#define DEFAULT_SYSTEM_ID_SOURCE "none"#define DEFAULT_OBTAIN_DEVICE_LIST_FROM_UDEV 1#define DEFAULT_EXTERNAL_DEVICE_INFO_SOURCE "none" +#define DEFAULT_USE_AIO 1#define DEFAULT_SYSFS_SCAN 1#define DEFAULT_MD_COMPONENT_DETECTION 1#define DEFAULT_FW_RAID_COMPONENT_DETECTION 0
lib/device/dev-cache.c +2 -0
@@ -1250,6 +1250,8 @@ int dev_cache_exit(void)struct btree_iter *b;int num_open =0 ; +dev_async_exit (); +if (_cache.names)if ((num_open =_check_for_open_devices (1 )) >0 )log_error (INTERNAL_ERROR "%d device(s) were left open and have been closed." , num_open);
lib/device/dev-io.c +79 -0
85 lines not on this page · raw message
lib/device/device.h +5 -0
@@ -202,4 +202,9 @@ void devbufs_release(struct device *dev);/* Return a valid device name from the alias list; NULL otherwise */ const char *dev_name_confirmed (struct device *dev,int quiet); +struct cmd_context ; +int dev_async_setup (struct cmd_context *cmd); +void dev_async_exit (void ); +int dev_async_reset (struct cmd_context *cmd); +#endif
make.tmpl.in +2 -1
@@ -62,7 +62,8 @@ CLDFLAGS += @CLDFLAGS@ ELDFLAGS += @ELDFLAGS@ LDDEPS += @LDDEPS@ LIB_SUFFIX = @LIB_SUFFIX@ -LVMINTERNAL_LIBS = -llvm-internal $(DMEVENT_LIBS) $(DAEMON_LIBS) $(SYSTEMD_LIBS) $(UDEV_LIBS) $(DL_LIBS) $(BLKID_LIBS) +LVMINTERNAL_LIBS = -llvm-internal $(DMEVENT_LIBS) $(DAEMON_LIBS) $(SYSTEMD_LIBS) $(UDEV_LIBS) $(DL_LIBS) $(BLKID_LIBS) $(AIO_LIBS) +AIO_LIBS = @AIO_LIBS@ DL_LIBS = @DL_LIBS@ RT_LIBS = @RT_LIBS@ M_LIBS = @M_LIBS@
tools/toollib.c +1 -0
@@ -116,6 +116,7 @@ int become_daemon(struct cmd_context *cmd, int skip_lvm)/* FIXME Clean up properly here */ _exit (ECMD_FAILED ); } +dev_async_reset (cmd);dev_close_all ();return 1 ;