]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[PATCH] dm: suspend: parameter change
authorKiyoshi Ueda <k-ueda@ct.jp.nec.com>
Fri, 8 Dec 2006 10:41:04 +0000 (02:41 -0800)
committerLinus Torvalds <torvalds@woody.osdl.org>
Fri, 8 Dec 2006 16:29:09 +0000 (08:29 -0800)
Change the interface of dm_suspend() so that we can pass several options
without increasing the number of parameters.  The existing 'do_lockfs' integer
parameter is replaced by a flag DM_SUSPEND_LOCKFS_FLAG.

There is no functional change to the code.

Test results:
I have tested 'dmsetup suspend' command with/without the '--nolockfs'
option and confirmed the do_lockfs value is correctly set.

Signed-off-by: Kiyoshi Ueda <k-ueda@ct.jp.nec.com>
Signed-off-by: Jun'ichi Nomura <j-nomura@ce.jp.nec.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Cc: dm-devel@redhat.com
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/md/dm-ioctl.c
drivers/md/dm.c
drivers/md/dm.h
include/linux/device-mapper.h

index 4510ad8f971c366f4979403f4b0e13075f9d944b..6d7a3d0c8f88cf1d917ca67ecb7dac507615429f 100644 (file)
@@ -765,7 +765,7 @@ out:
 static int do_suspend(struct dm_ioctl *param)
 {
        int r = 0;
-       int do_lockfs = 1;
+       unsigned suspend_flags = DM_SUSPEND_LOCKFS_FLAG;
        struct mapped_device *md;
 
        md = find_device(param);
@@ -773,10 +773,10 @@ static int do_suspend(struct dm_ioctl *param)
                return -ENXIO;
 
        if (param->flags & DM_SKIP_LOCKFS_FLAG)
-               do_lockfs = 0;
+               suspend_flags &= ~DM_SUSPEND_LOCKFS_FLAG;
 
        if (!dm_suspended(md))
-               r = dm_suspend(md, do_lockfs);
+               r = dm_suspend(md, suspend_flags);
 
        if (!r)
                r = __dev_status(md, param);
@@ -788,7 +788,7 @@ static int do_suspend(struct dm_ioctl *param)
 static int do_resume(struct dm_ioctl *param)
 {
        int r = 0;
-       int do_lockfs = 1;
+       unsigned suspend_flags = DM_SUSPEND_LOCKFS_FLAG;
        struct hash_cell *hc;
        struct mapped_device *md;
        struct dm_table *new_map;
@@ -814,9 +814,9 @@ static int do_resume(struct dm_ioctl *param)
        if (new_map) {
                /* Suspend if it isn't already suspended */
                if (param->flags & DM_SKIP_LOCKFS_FLAG)
-                       do_lockfs = 0;
+                       suspend_flags &= ~DM_SUSPEND_LOCKFS_FLAG;
                if (!dm_suspended(md))
-                       dm_suspend(md, do_lockfs);
+                       dm_suspend(md, suspend_flags);
 
                r = dm_swap_table(md, new_map);
                if (r) {
index dd50e30b6dcf809ec8ca7aef10c15855da6712c2..b42e71bb9e6722f71ce332948b78e6732f531dae 100644 (file)
@@ -1272,12 +1272,13 @@ static void unlock_fs(struct mapped_device *md)
  * dm_bind_table, dm_suspend must be called to flush any in
  * flight bios and ensure that any further io gets deferred.
  */
-int dm_suspend(struct mapped_device *md, int do_lockfs)
+int dm_suspend(struct mapped_device *md, unsigned suspend_flags)
 {
        struct dm_table *map = NULL;
        DECLARE_WAITQUEUE(wait, current);
        struct bio *def;
        int r = -EINVAL;
+       int do_lockfs = suspend_flags & DM_SUSPEND_LOCKFS_FLAG ? 1 : 0;
 
        down(&md->suspend_lock);
 
index a48ec5e3c1f478ea9523424f87b0db21fc8ab06d..81c98d6e35e97c6489b51ed9e83fd0117ea175e1 100644 (file)
 
 #define SECTOR_SHIFT 9
 
+/*
+ * Suspend feature flags
+ */
+#define DM_SUSPEND_LOCKFS_FLAG         (1 << 0)
+
 /*
  * List of devices that a metadevice uses and should open/close.
  */
index 03ef41c1eaac346b441a00a54048818b7f35c60f..9194ff2d08c0c7ef411fd41eaa690681c91336c3 100644 (file)
@@ -173,7 +173,7 @@ void *dm_get_mdptr(struct mapped_device *md);
 /*
  * A device can still be used while suspended, but I/O is deferred.
  */
-int dm_suspend(struct mapped_device *md, int with_lockfs);
+int dm_suspend(struct mapped_device *md, unsigned suspend_flags);
 int dm_resume(struct mapped_device *md);
 
 /*