diff options
author | Kiyoshi Ueda <k-ueda@ct.jp.nec.com> | 2006-12-08 05:41:04 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.osdl.org> | 2006-12-08 11:29:09 -0500 |
commit | a3d77d35be6f416a250c528c3ed5c70013a915e8 (patch) | |
tree | 6aaecdf78b4da52f8a3b3ded2bd320812e3db6df /drivers/md | |
parent | 74859364633963cb660c4fa518adca9ab1ca4229 (diff) |
[PATCH] dm: suspend: parameter change
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>
Diffstat (limited to 'drivers/md')
-rw-r--r-- | drivers/md/dm-ioctl.c | 12 | ||||
-rw-r--r-- | drivers/md/dm.c | 3 | ||||
-rw-r--r-- | drivers/md/dm.h | 5 |
3 files changed, 13 insertions, 7 deletions
diff --git a/drivers/md/dm-ioctl.c b/drivers/md/dm-ioctl.c index 4510ad8f971c..6d7a3d0c8f88 100644 --- a/drivers/md/dm-ioctl.c +++ b/drivers/md/dm-ioctl.c | |||
@@ -765,7 +765,7 @@ out: | |||
765 | static int do_suspend(struct dm_ioctl *param) | 765 | static int do_suspend(struct dm_ioctl *param) |
766 | { | 766 | { |
767 | int r = 0; | 767 | int r = 0; |
768 | int do_lockfs = 1; | 768 | unsigned suspend_flags = DM_SUSPEND_LOCKFS_FLAG; |
769 | struct mapped_device *md; | 769 | struct mapped_device *md; |
770 | 770 | ||
771 | md = find_device(param); | 771 | md = find_device(param); |
@@ -773,10 +773,10 @@ static int do_suspend(struct dm_ioctl *param) | |||
773 | return -ENXIO; | 773 | return -ENXIO; |
774 | 774 | ||
775 | if (param->flags & DM_SKIP_LOCKFS_FLAG) | 775 | if (param->flags & DM_SKIP_LOCKFS_FLAG) |
776 | do_lockfs = 0; | 776 | suspend_flags &= ~DM_SUSPEND_LOCKFS_FLAG; |
777 | 777 | ||
778 | if (!dm_suspended(md)) | 778 | if (!dm_suspended(md)) |
779 | r = dm_suspend(md, do_lockfs); | 779 | r = dm_suspend(md, suspend_flags); |
780 | 780 | ||
781 | if (!r) | 781 | if (!r) |
782 | r = __dev_status(md, param); | 782 | r = __dev_status(md, param); |
@@ -788,7 +788,7 @@ static int do_suspend(struct dm_ioctl *param) | |||
788 | static int do_resume(struct dm_ioctl *param) | 788 | static int do_resume(struct dm_ioctl *param) |
789 | { | 789 | { |
790 | int r = 0; | 790 | int r = 0; |
791 | int do_lockfs = 1; | 791 | unsigned suspend_flags = DM_SUSPEND_LOCKFS_FLAG; |
792 | struct hash_cell *hc; | 792 | struct hash_cell *hc; |
793 | struct mapped_device *md; | 793 | struct mapped_device *md; |
794 | struct dm_table *new_map; | 794 | struct dm_table *new_map; |
@@ -814,9 +814,9 @@ static int do_resume(struct dm_ioctl *param) | |||
814 | if (new_map) { | 814 | if (new_map) { |
815 | /* Suspend if it isn't already suspended */ | 815 | /* Suspend if it isn't already suspended */ |
816 | if (param->flags & DM_SKIP_LOCKFS_FLAG) | 816 | if (param->flags & DM_SKIP_LOCKFS_FLAG) |
817 | do_lockfs = 0; | 817 | suspend_flags &= ~DM_SUSPEND_LOCKFS_FLAG; |
818 | if (!dm_suspended(md)) | 818 | if (!dm_suspended(md)) |
819 | dm_suspend(md, do_lockfs); | 819 | dm_suspend(md, suspend_flags); |
820 | 820 | ||
821 | r = dm_swap_table(md, new_map); | 821 | r = dm_swap_table(md, new_map); |
822 | if (r) { | 822 | if (r) { |
diff --git a/drivers/md/dm.c b/drivers/md/dm.c index dd50e30b6dcf..b42e71bb9e67 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c | |||
@@ -1272,12 +1272,13 @@ static void unlock_fs(struct mapped_device *md) | |||
1272 | * dm_bind_table, dm_suspend must be called to flush any in | 1272 | * dm_bind_table, dm_suspend must be called to flush any in |
1273 | * flight bios and ensure that any further io gets deferred. | 1273 | * flight bios and ensure that any further io gets deferred. |
1274 | */ | 1274 | */ |
1275 | int dm_suspend(struct mapped_device *md, int do_lockfs) | 1275 | int dm_suspend(struct mapped_device *md, unsigned suspend_flags) |
1276 | { | 1276 | { |
1277 | struct dm_table *map = NULL; | 1277 | struct dm_table *map = NULL; |
1278 | DECLARE_WAITQUEUE(wait, current); | 1278 | DECLARE_WAITQUEUE(wait, current); |
1279 | struct bio *def; | 1279 | struct bio *def; |
1280 | int r = -EINVAL; | 1280 | int r = -EINVAL; |
1281 | int do_lockfs = suspend_flags & DM_SUSPEND_LOCKFS_FLAG ? 1 : 0; | ||
1281 | 1282 | ||
1282 | down(&md->suspend_lock); | 1283 | down(&md->suspend_lock); |
1283 | 1284 | ||
diff --git a/drivers/md/dm.h b/drivers/md/dm.h index a48ec5e3c1f4..81c98d6e35e9 100644 --- a/drivers/md/dm.h +++ b/drivers/md/dm.h | |||
@@ -33,6 +33,11 @@ | |||
33 | #define SECTOR_SHIFT 9 | 33 | #define SECTOR_SHIFT 9 |
34 | 34 | ||
35 | /* | 35 | /* |
36 | * Suspend feature flags | ||
37 | */ | ||
38 | #define DM_SUSPEND_LOCKFS_FLAG (1 << 0) | ||
39 | |||
40 | /* | ||
36 | * List of devices that a metadevice uses and should open/close. | 41 | * List of devices that a metadevice uses and should open/close. |
37 | */ | 42 | */ |
38 | struct dm_dev { | 43 | struct dm_dev { |