From: Alasdair G Kergon Devices only needs syncing when creating snapshots, so make this optional when suspending a device. Signed-off-by: Alasdair G Kergon Signed-off-by: Andrew Morton --- drivers/md/dm-ioctl.c | 4 ++-- drivers/md/dm.c | 17 +++++++++++++---- drivers/md/dm.h | 2 +- 3 files changed, 16 insertions(+), 7 deletions(-) diff -puN drivers/md/dm.c~device-mapper-make-lock_fs-optional drivers/md/dm.c --- devel/drivers/md/dm.c~device-mapper-make-lock_fs-optional 2005-11-18 18:16:20.000000000 -0800 +++ devel-akpm/drivers/md/dm.c 2005-11-18 18:16:20.000000000 -0800 @@ -56,6 +56,7 @@ union map_info *dm_get_mapinfo(struct bi */ #define DMF_BLOCK_IO 0 #define DMF_SUSPENDED 1 +#define DMF_FROZEN 2 struct mapped_device { struct rw_semaphore io_lock; @@ -1032,6 +1033,8 @@ static int lock_fs(struct mapped_device 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. */ @@ -1040,8 +1043,12 @@ static int lock_fs(struct mapped_device 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); } /* @@ -1051,7 +1058,7 @@ static void unlock_fs(struct mapped_devi * 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); @@ -1075,9 +1082,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. diff -puN drivers/md/dm.h~device-mapper-make-lock_fs-optional drivers/md/dm.h --- devel/drivers/md/dm.h~device-mapper-make-lock_fs-optional 2005-11-18 18:16:20.000000000 -0800 +++ devel-akpm/drivers/md/dm.h 2005-11-18 18:16:20.000000000 -0800 @@ -69,7 +69,7 @@ void dm_put(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 dm_suspend(struct mapped_device *md, int with_lockfs); int dm_resume(struct mapped_device *md); /* diff -puN drivers/md/dm-ioctl.c~device-mapper-make-lock_fs-optional drivers/md/dm-ioctl.c --- devel/drivers/md/dm-ioctl.c~device-mapper-make-lock_fs-optional 2005-11-18 18:16:20.000000000 -0800 +++ devel-akpm/drivers/md/dm-ioctl.c 2005-11-18 18:16:20.000000000 -0800 @@ -700,7 +700,7 @@ static int do_suspend(struct dm_ioctl *p return -ENXIO; if (!dm_suspended(md)) - r = dm_suspend(md); + r = dm_suspend(md, 1); if (!r) r = __dev_status(md, param); @@ -738,7 +738,7 @@ static int do_resume(struct dm_ioctl *pa if (new_map) { /* Suspend if it isn't already suspended */ if (!dm_suspended(md)) - dm_suspend(md); + dm_suspend(md, 1); r = dm_swap_table(md, new_map); if (r) { _