Skip to contentSkip to conversation

master - device: Queue any aio beyond defined limits.

PATCH Alasdair Kergon 1 participant 1 message Feb 9, 2018

lore
Share & tools
lore
#0 lore raw
Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=3e29c80122b8eb1123e42d143f17dd7bddefedcd
Commit:        3e29c80122b8eb1123e42d143f17dd7bddefedcd
Parent:        db41fe6c5dab7ff66db9c0568f0e1e1b31657be3
Author:        Alasdair G Kergon <[email protected]>
AuthorDate:    Mon Jan 22 18:26:03 2018 +0000
Committer:     Alasdair G Kergon <[email protected]>
CommitterDate: Thu Feb 8 20:15:37 2018 +0000

device: Queue any aio beyond defined limits.

---
 WHATS_NEW                    |    1 +
 conf/example.conf.in         |   11 +++++
 lib/config/config_settings.h |    7 +++
 lib/config/defaults.h        |    2 +
 lib/device/dev-io.c          |   85 ++++++++++++++++++++++++++++++++++++++++-
 lib/device/device.h          |    1 +
 6 files changed, 104 insertions(+), 3 deletions(-)
WHATS_NEW +1 -0
index 8ae79cf..9e6cb39 100644
@@ -1,5 +1,6 @@
 Version 2.02.178 - 
 =====================================
+  Add devices/use_aio, aio_max, aio_memory to configure AIO limits.
   Support asynchronous I/O when scanning devices.
   Detect asynchronous I/O capability in configure or accept --disable-aio.
   Add AIO_SUPPORTED_CODE_PATH to indicate whether AIO may be used.
conf/example.conf.in +11 -0
index 6a491fb..3b0638f 100644
@@ -64,6 +64,17 @@ devices {
 	# This configuration option has an automatic default value.
 	# use_aio = 1
 
+	# Configuration option devices/aio_max.
+	# Maximum number of asynchronous I/Os to issue concurrently.
+	# This configuration option has an automatic default value.
+	# aio_max = 128
+
+	# Configuration option devices/aio_memory.
+	# Approximate maximum total amount of memory (in MB) used
+	# for asynchronous I/O buffers.
+	# This configuration option has an automatic default value.
+	# aio_memory = 10
+
 	# 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
lib/config/config_settings.h +7 -0
index 523e6fe..f1db797 100644
@@ -229,6 +229,13 @@ cfg_array(devices_scan_CFG, "scan", devices_CFG_SECTION, CFG_ADVANCED, CFG_TYPE_
 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(devices_aio_max_CFG, "aio_max", devices_CFG_SECTION, CFG_DEFAULT_COMMENTED, CFG_TYPE_INT, DEFAULT_AIO_MAX, vsn(2, 2, 178), NULL, 0, NULL,
+	"Maximum number of asynchronous I/Os to issue concurrently.\n")
+
+cfg(devices_aio_memory_CFG, "aio_memory", devices_CFG_SECTION, CFG_DEFAULT_COMMENTED, CFG_TYPE_INT, DEFAULT_AIO_MEMORY, vsn(2, 2, 178), NULL, 0, NULL,
+	"Approximate maximum total amount of memory (in MB) used\n"
+	"for asynchronous I/O buffers.\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 +2 -0
index 5efab11..1c730a9 100644
@@ -33,6 +33,8 @@
 #define DEFAULT_OBTAIN_DEVICE_LIST_FROM_UDEV 1
 #define DEFAULT_EXTERNAL_DEVICE_INFO_SOURCE "none"
 #define DEFAULT_USE_AIO 1
+#define DEFAULT_AIO_MAX 128
+#define DEFAULT_AIO_MEMORY 10
 #define DEFAULT_SYSFS_SCAN 1
 #define DEFAULT_MD_COMPONENT_DETECTION 1
 #define DEFAULT_FW_RAID_COMPONENT_DETECTION 0
lib/device/dev-io.c +82 -3

161 lines not on this page · raw message

lib/device/device.h +1 -0
index b52522d..9061139 100644
@@ -100,6 +100,7 @@ struct device_buffer {
 
 	lvm_callback_fn_t dev_read_callback_fn;
 	void *dev_read_callback_context;
+	struct dm_list aio_queued;	/* Queue of async I/O waiting to be issued */
 };
 
 /*