diff options
author | Alasdair G Kergon <agk@redhat.com> | 2006-01-06 03:20:06 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-06 11:34:01 -0500 |
commit | aa8d7c2fbe619d8c0837296d2eaf4c14cebac198 (patch) | |
tree | 88b63e397b0c2dbdf2b8feb3920d565d352412d6 | |
parent | e39e2e95eb8bd536b61654e8fda1516d0a6a3cd1 (diff) |
[PATCH] device-mapper: make lock_fs optional
Devices only needs syncing when creating snapshots, so make this optional when
suspending a device.
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | drivers/md/dm-ioctl.c | 4 | ||||
-rw-r--r-- | drivers/md/dm.c | 17 | ||||
-rw-r--r-- | drivers/md/dm.h | 2 |
3 files changed, 16 insertions, 7 deletions
diff --git a/drivers/md/dm-ioctl.c b/drivers/md/dm-ioctl.c index 3e327db57310..dbc07afd4462 100644 --- a/drivers/md/dm-ioctl.c +++ b/drivers/md/dm-ioctl.c | |||
@@ -700,7 +700,7 @@ static int do_suspend(struct dm_ioctl *param) | |||
700 | return -ENXIO; | 700 | return -ENXIO; |
701 | 701 | ||
702 | if (!dm_suspended(md)) | 702 | if (!dm_suspended(md)) |
703 | r = dm_suspend(md); | 703 | r = dm_suspend(md, 1); |
704 | 704 | ||
705 | if (!r) | 705 | if (!r) |
706 | r = __dev_status(md, param); | 706 | r = __dev_status(md, param); |
@@ -738,7 +738,7 @@ static int do_resume(struct dm_ioctl *param) | |||
738 | if (new_map) { | 738 | if (new_map) { |
739 | /* Suspend if it isn't already suspended */ | 739 | /* Suspend if it isn't already suspended */ |
740 | if (!dm_suspended(md)) | 740 | if (!dm_suspended(md)) |
741 | dm_suspend(md); | 741 | dm_suspend(md, 1); |
742 | 742 | ||
743 | r = dm_swap_table(md, new_map); | 743 | r = dm_swap_table(md, new_map); |
744 | if (r) { | 744 | if (r) { |
diff --git a/drivers/md/dm.c b/drivers/md/dm.c index fc335e09d072..0e481512f918 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c | |||
@@ -55,6 +55,7 @@ union map_info *dm_get_mapinfo(struct bio *bio) | |||
55 | */ | 55 | */ |
56 | #define DMF_BLOCK_IO 0 | 56 | #define DMF_BLOCK_IO 0 |
57 | #define DMF_SUSPENDED 1 | 57 | #define DMF_SUSPENDED 1 |
58 | #define DMF_FROZEN 2 | ||
58 | 59 | ||
59 | struct mapped_device { | 60 | struct mapped_device { |
60 | struct rw_semaphore io_lock; | 61 | struct rw_semaphore io_lock; |
@@ -1021,6 +1022,8 @@ static int lock_fs(struct mapped_device *md) | |||
1021 | return r; | 1022 | return r; |
1022 | } | 1023 | } |
1023 | 1024 | ||
1025 | set_bit(DMF_FROZEN, &md->flags); | ||
1026 | |||
1024 | /* don't bdput right now, we don't want the bdev | 1027 | /* don't bdput right now, we don't want the bdev |
1025 | * to go away while it is locked. | 1028 | * to go away while it is locked. |
1026 | */ | 1029 | */ |
@@ -1029,8 +1032,12 @@ static int lock_fs(struct mapped_device *md) | |||
1029 | 1032 | ||
1030 | static void unlock_fs(struct mapped_device *md) | 1033 | static void unlock_fs(struct mapped_device *md) |
1031 | { | 1034 | { |
1035 | if (!test_bit(DMF_FROZEN, &md->flags)) | ||
1036 | return; | ||
1037 | |||
1032 | thaw_bdev(md->suspended_bdev, md->frozen_sb); | 1038 | thaw_bdev(md->suspended_bdev, md->frozen_sb); |
1033 | md->frozen_sb = NULL; | 1039 | md->frozen_sb = NULL; |
1040 | clear_bit(DMF_FROZEN, &md->flags); | ||
1034 | } | 1041 | } |
1035 | 1042 | ||
1036 | /* | 1043 | /* |
@@ -1040,7 +1047,7 @@ static void unlock_fs(struct mapped_device *md) | |||
1040 | * dm_bind_table, dm_suspend must be called to flush any in | 1047 | * dm_bind_table, dm_suspend must be called to flush any in |
1041 | * flight bios and ensure that any further io gets deferred. | 1048 | * flight bios and ensure that any further io gets deferred. |
1042 | */ | 1049 | */ |
1043 | int dm_suspend(struct mapped_device *md) | 1050 | int dm_suspend(struct mapped_device *md, int do_lockfs) |
1044 | { | 1051 | { |
1045 | struct dm_table *map = NULL; | 1052 | struct dm_table *map = NULL; |
1046 | DECLARE_WAITQUEUE(wait, current); | 1053 | DECLARE_WAITQUEUE(wait, current); |
@@ -1064,9 +1071,11 @@ int dm_suspend(struct mapped_device *md) | |||
1064 | } | 1071 | } |
1065 | 1072 | ||
1066 | /* Flush I/O to the device. */ | 1073 | /* Flush I/O to the device. */ |
1067 | r = lock_fs(md); | 1074 | if (do_lockfs) { |
1068 | if (r) | 1075 | r = lock_fs(md); |
1069 | goto out; | 1076 | if (r) |
1077 | goto out; | ||
1078 | } | ||
1070 | 1079 | ||
1071 | /* | 1080 | /* |
1072 | * First we set the BLOCK_IO flag so no more ios will be mapped. | 1081 | * First we set the BLOCK_IO flag so no more ios will be mapped. |
diff --git a/drivers/md/dm.h b/drivers/md/dm.h index 95a0cfbe5b4d..4eaf075da217 100644 --- a/drivers/md/dm.h +++ b/drivers/md/dm.h | |||
@@ -69,7 +69,7 @@ void dm_put(struct mapped_device *md); | |||
69 | /* | 69 | /* |
70 | * A device can still be used while suspended, but I/O is deferred. | 70 | * A device can still be used while suspended, but I/O is deferred. |
71 | */ | 71 | */ |
72 | int dm_suspend(struct mapped_device *md); | 72 | int dm_suspend(struct mapped_device *md, int with_lockfs); |
73 | int dm_resume(struct mapped_device *md); | 73 | int dm_resume(struct mapped_device *md); |
74 | 74 | ||
75 | /* | 75 | /* |