diff mbox

[39/57] devmapper: do not flush I/O for DM_DEVICE_CREATE

Message ID 1461755458-29225-40-git-send-email-hare@suse.de (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Hannes Reinecke April 27, 2016, 11:10 a.m. UTC
DM_DEVICE_CREATE loads a new table, so there cannot be any
I/O pending. Hence we should be setting the 'no flush'
and 'skip lockfs' flag to avoid delays during creation.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 libmultipath/devmapper.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)
diff mbox

Patch

diff --git a/libmultipath/devmapper.c b/libmultipath/devmapper.c
index 15c91c9..c2ae83b 100644
--- a/libmultipath/devmapper.c
+++ b/libmultipath/devmapper.c
@@ -321,11 +321,16 @@  dm_addmap (int task, const char *target, struct multipath *mpp,
 
 	dm_task_no_open_count(dmt);
 
-	if (cookie &&
-	    !dm_task_set_cookie(dmt, cookie,
-				DM_UDEV_DISABLE_LIBRARY_FALLBACK)) {
-		dm_udev_complete(*cookie);
-		goto freeout;
+	if (cookie) {
+		if (!dm_task_set_cookie(dmt, cookie,
+					DM_UDEV_DISABLE_LIBRARY_FALLBACK)) {
+			dm_udev_complete(*cookie);
+			goto freeout;
+		}
+		dm_task_skip_lockfs(dmt);
+#ifdef LIBDM_API_FLUSH
+		dm_task_no_flush(dmt);
+#endif
 	}
 	r = dm_task_run (dmt);