Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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>

authored by

Alasdair G Kergon and committed by
Linus Torvalds
aa8d7c2f e39e2e95

+16 -7
+2 -2
drivers/md/dm-ioctl.c
··· 700 700 return -ENXIO; 701 701 702 702 if (!dm_suspended(md)) 703 - r = dm_suspend(md); 703 + r = dm_suspend(md, 1); 704 704 705 705 if (!r) 706 706 r = __dev_status(md, param); ··· 738 738 if (new_map) { 739 739 /* Suspend if it isn't already suspended */ 740 740 if (!dm_suspended(md)) 741 - dm_suspend(md); 741 + dm_suspend(md, 1); 742 742 743 743 r = dm_swap_table(md, new_map); 744 744 if (r) {
+13 -4
drivers/md/dm.c
··· 55 55 */ 56 56 #define DMF_BLOCK_IO 0 57 57 #define DMF_SUSPENDED 1 58 + #define DMF_FROZEN 2 58 59 59 60 struct mapped_device { 60 61 struct rw_semaphore io_lock; ··· 1022 1021 return r; 1023 1022 } 1024 1023 1024 + set_bit(DMF_FROZEN, &md->flags); 1025 + 1025 1026 /* don't bdput right now, we don't want the bdev 1026 1027 * to go away while it is locked. 1027 1028 */ ··· 1032 1029 1033 1030 static void unlock_fs(struct mapped_device *md) 1034 1031 { 1032 + if (!test_bit(DMF_FROZEN, &md->flags)) 1033 + return; 1034 + 1035 1035 thaw_bdev(md->suspended_bdev, md->frozen_sb); 1036 1036 md->frozen_sb = NULL; 1037 + clear_bit(DMF_FROZEN, &md->flags); 1037 1038 } 1038 1039 1039 1040 /* ··· 1047 1040 * dm_bind_table, dm_suspend must be called to flush any in 1048 1041 * flight bios and ensure that any further io gets deferred. 1049 1042 */ 1050 - int dm_suspend(struct mapped_device *md) 1043 + int dm_suspend(struct mapped_device *md, int do_lockfs) 1051 1044 { 1052 1045 struct dm_table *map = NULL; 1053 1046 DECLARE_WAITQUEUE(wait, current); ··· 1071 1064 } 1072 1065 1073 1066 /* Flush I/O to the device. */ 1074 - r = lock_fs(md); 1075 - if (r) 1076 - goto out; 1067 + if (do_lockfs) { 1068 + r = lock_fs(md); 1069 + if (r) 1070 + goto out; 1071 + } 1077 1072 1078 1073 /* 1079 1074 * First we set the BLOCK_IO flag so no more ios will be mapped.
+1 -1
drivers/md/dm.h
··· 69 69 /* 70 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 73 int dm_resume(struct mapped_device *md); 74 74 75 75 /*