aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlasdair G Kergon <agk@redhat.com>2005-05-05 19:16:03 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-05-05 19:36:45 -0400
commitd1782a3b0a15d9ac497a8f47931c4536bfe8d18e (patch)
tree76ce9caa1d4c4a1b34ee060fa9f165385a9f1a7e
parentd17d7fa44dbe1f12031773e27eda9e939024a037 (diff)
[PATCH] device-mapper: store bdev while frozen
Store the struct block_device while device is frozen, saving us one call to bdget_disk(). Signed-Off-By: Alasdair G Kergon <agk@redhat.com> From: Christoph Hellwig <hch@lst.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--drivers/md/dm.c23
1 files changed, 8 insertions, 15 deletions
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index 243ff6884e83..ea180af6d227 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -97,6 +97,7 @@ struct mapped_device {
97 * freeze/thaw support require holding onto a super block 97 * freeze/thaw support require holding onto a super block
98 */ 98 */
99 struct super_block *frozen_sb; 99 struct super_block *frozen_sb;
100 struct block_device *frozen_bdev;
100}; 101};
101 102
102#define MIN_IOS 256 103#define MIN_IOS 256
@@ -990,19 +991,17 @@ int dm_swap_table(struct mapped_device *md, struct dm_table *table)
990 */ 991 */
991static int __lock_fs(struct mapped_device *md) 992static int __lock_fs(struct mapped_device *md)
992{ 993{
993 struct block_device *bdev;
994
995 if (test_and_set_bit(DMF_FS_LOCKED, &md->flags)) 994 if (test_and_set_bit(DMF_FS_LOCKED, &md->flags))
996 return 0; 995 return 0;
997 996
998 bdev = bdget_disk(md->disk, 0); 997 md->frozen_bdev = bdget_disk(md->disk, 0);
999 if (!bdev) { 998 if (!md->frozen_bdev) {
1000 DMWARN("bdget failed in __lock_fs"); 999 DMWARN("bdget failed in __lock_fs");
1001 return -ENOMEM; 1000 return -ENOMEM;
1002 } 1001 }
1003 1002
1004 WARN_ON(md->frozen_sb); 1003 WARN_ON(md->frozen_sb);
1005 md->frozen_sb = freeze_bdev(bdev); 1004 md->frozen_sb = freeze_bdev(md->frozen_bdev);
1006 /* don't bdput right now, we don't want the bdev 1005 /* don't bdput right now, we don't want the bdev
1007 * to go away while it is locked. We'll bdput 1006 * to go away while it is locked. We'll bdput
1008 * in __unlock_fs 1007 * in __unlock_fs
@@ -1012,21 +1011,15 @@ static int __lock_fs(struct mapped_device *md)
1012 1011
1013static int __unlock_fs(struct mapped_device *md) 1012static int __unlock_fs(struct mapped_device *md)
1014{ 1013{
1015 struct block_device *bdev;
1016
1017 if (!test_and_clear_bit(DMF_FS_LOCKED, &md->flags)) 1014 if (!test_and_clear_bit(DMF_FS_LOCKED, &md->flags))
1018 return 0; 1015 return 0;
1019 1016
1020 bdev = bdget_disk(md->disk, 0); 1017 thaw_bdev(md->frozen_bdev, md->frozen_sb);
1021 if (!bdev) { 1018 bdput(md->frozen_bdev);
1022 DMWARN("bdget failed in __unlock_fs");
1023 return -ENOMEM;
1024 }
1025 1019
1026 thaw_bdev(bdev, md->frozen_sb);
1027 md->frozen_sb = NULL; 1020 md->frozen_sb = NULL;
1028 bdput(bdev); 1021 md->frozen_bdev = NULL;
1029 bdput(bdev); 1022
1030 return 0; 1023 return 0;
1031} 1024}
1032 1025