Skip to contentSkip to conversation

dm: add 'DM_NOFLUSH_FLAG' ioctl option for suspend

PATCH New Kiyoshi Ueda 1 participant 1 message Oct 10, 2006 Device mapper

lore
Share & tools
lore
#0 lore raw

PATCH 5/7 dm: add 'DM_NOFLUSH_FLAG' ioctl option for suspend

This patch adds ioctl option for noflush suspending. As the interface is extended, the version number is incremented. Should have no effect on the behavior.

Test results:
Confirmed the option is given from user-space correctly.

The patch is for:

    2.6.18-mm2 + patch 1-4
drivers/md/dm.h +1 -0
diff -rupN 4-target-rval-iface-change/drivers/md/dm.h 5-add-noflush-ioctl-opt/drivers/md/dm.h
@@ -47,6 +47,7 @@
  * Suspend feature flags
  */
 #define DM_SUSPEND_LOCKFS_FLAG		(1 << 0)
+#define DM_SUSPEND_NOFLUSH_FLAG		(1 << 1)
 
 /*
  * List of devices that a metadevice uses and should open/close.
drivers/md/dm-ioctl.c +4 -0
diff -rupN 4-target-rval-iface-change/drivers/md/dm-ioctl.c 5-add-noflush-ioctl-opt/drivers/md/dm-ioctl.c
@@ -769,6 +769,8 @@ static int do_suspend(struct dm_ioctl *p
 
 	if (param->flags & DM_SKIP_LOCKFS_FLAG)
 		suspend_flags &= ~DM_SUSPEND_LOCKFS_FLAG;
+	if (param->flags & DM_NOFLUSH_FLAG)
+		suspend_flags |= DM_SUSPEND_NOFLUSH_FLAG;
 
 	if (!dm_suspended(md))
 		r = dm_suspend(md, suspend_flags);
@@ -810,6 +812,8 @@ static int do_resume(struct dm_ioctl *pa
 		/* Suspend if it isn't already suspended */
 		if (param->flags & DM_SKIP_LOCKFS_FLAG)
 			suspend_flags &= ~DM_SUSPEND_LOCKFS_FLAG;
+		if (param->flags & DM_NOFLUSH_FLAG)
+			suspend_flags |= DM_SUSPEND_NOFLUSH_FLAG;
 		if (!dm_suspended(md))
 			dm_suspend(md, suspend_flags);
 
include/linux/dm-ioctl.h +6 -1
diff -rupN 4-target-rval-iface-change/include/linux/dm-ioctl.h 5-add-noflush-ioctl-opt/include/linux/dm-ioctl.h
@@ -285,7 +285,7 @@ typedef char ioctl_struct[308];
 #define DM_DEV_SET_GEOMETRY	_IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD, struct dm_ioctl)
 
 #define DM_VERSION_MAJOR	4
-#define DM_VERSION_MINOR	10
+#define DM_VERSION_MINOR	11
 #define DM_VERSION_PATCHLEVEL	0
 #define DM_VERSION_EXTRA	"-ioctl (2006-09-14)"
 
@@ -323,4 +323,9 @@ typedef char ioctl_struct[308];
  */
 #define DM_SKIP_LOCKFS_FLAG	(1 << 10) /* In */
 
+/*
+ * Set this to suspend without flushing queued ios.
+ */
+#define DM_NOFLUSH_FLAG		(1 << 11) /* In */
+
 #endif				/* _LINUX_DM_IOCTL_H */