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 /drivers/md/dm.c | |
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>
Diffstat (limited to 'drivers/md/dm.c')
-rw-r--r-- | drivers/md/dm.c | 17 |
1 files changed, 13 insertions, 4 deletions
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. |