diff options
author | Alasdair G Kergon <agk@redhat.com> | 2006-01-06 09:20:06 +0100 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-06 17:34:01 +0100 |
commit | aa8d7c2fbe619d8c0837296d2eaf4c14cebac198 (patch) | |
tree | 88b63e397b0c2dbdf2b8feb3920d565d352412d6 /drivers/md/dm.c | |
parent | [PATCH] device-mapper: rename frozen_bdev (diff) | |
download | linux-aa8d7c2fbe619d8c0837296d2eaf4c14cebac198.tar.xz linux-aa8d7c2fbe619d8c0837296d2eaf4c14cebac198.zip |
[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) */ #define DMF_BLOCK_IO 0 #define DMF_SUSPENDED 1 +#define DMF_FROZEN 2 struct mapped_device { struct rw_semaphore io_lock; @@ -1021,6 +1022,8 @@ static int lock_fs(struct mapped_device *md) return r; } + set_bit(DMF_FROZEN, &md->flags); + /* don't bdput right now, we don't want the bdev * to go away while it is locked. */ @@ -1029,8 +1032,12 @@ static int lock_fs(struct mapped_device *md) static void unlock_fs(struct mapped_device *md) { + if (!test_bit(DMF_FROZEN, &md->flags)) + return; + thaw_bdev(md->suspended_bdev, md->frozen_sb); md->frozen_sb = NULL; + clear_bit(DMF_FROZEN, &md->flags); } /* @@ -1040,7 +1047,7 @@ 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 dm_suspend(struct mapped_device *md, int do_lockfs) { struct dm_table *map = NULL; DECLARE_WAITQUEUE(wait, current); @@ -1064,9 +1071,11 @@ int dm_suspend(struct mapped_device *md) } /* Flush I/O to the device. */ - r = lock_fs(md); - if (r) - goto out; + if (do_lockfs) { + r = lock_fs(md); + if (r) + goto out; + } /* * First we set the BLOCK_IO flag so no more ios will be mapped. |