aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorArjan van de Ven <arjan@infradead.org>2006-03-23 06:00:28 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-23 10:38:11 -0500
commitc039e3134ae62863bbc8e8429b29e3c43cf21b2a (patch)
treeb9bbf4fda0844e3173bf10a5bffbaaec94fb4246 /fs
parent6f87f0deebaff2716a3ce9232f948d702690562a (diff)
[PATCH] sem2mutex: blockdev #2
Semaphore to mutex conversion. The conversion was generated via scripts, and the result was validated automatically via a script as well. Signed-off-by: Arjan van de Ven <arjan@infradead.org> Signed-off-by: Ingo Molnar <mingo@elte.hu> Acked-by: Jens Axboe <axboe@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/block_dev.c28
-rw-r--r--fs/buffer.c6
-rw-r--r--fs/super.c4
3 files changed, 19 insertions, 19 deletions
diff --git a/fs/block_dev.c b/fs/block_dev.c
index 6e50346fb1ee..44d05e6e34db 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -265,8 +265,8 @@ static void init_once(void * foo, kmem_cache_t * cachep, unsigned long flags)
265 SLAB_CTOR_CONSTRUCTOR) 265 SLAB_CTOR_CONSTRUCTOR)
266 { 266 {
267 memset(bdev, 0, sizeof(*bdev)); 267 memset(bdev, 0, sizeof(*bdev));
268 sema_init(&bdev->bd_sem, 1); 268 mutex_init(&bdev->bd_mutex);
269 sema_init(&bdev->bd_mount_sem, 1); 269 mutex_init(&bdev->bd_mount_mutex);
270 INIT_LIST_HEAD(&bdev->bd_inodes); 270 INIT_LIST_HEAD(&bdev->bd_inodes);
271 INIT_LIST_HEAD(&bdev->bd_list); 271 INIT_LIST_HEAD(&bdev->bd_list);
272 inode_init_once(&ei->vfs_inode); 272 inode_init_once(&ei->vfs_inode);
@@ -574,7 +574,7 @@ static int do_open(struct block_device *bdev, struct file *file)
574 } 574 }
575 owner = disk->fops->owner; 575 owner = disk->fops->owner;
576 576
577 down(&bdev->bd_sem); 577 mutex_lock(&bdev->bd_mutex);
578 if (!bdev->bd_openers) { 578 if (!bdev->bd_openers) {
579 bdev->bd_disk = disk; 579 bdev->bd_disk = disk;
580 bdev->bd_contains = bdev; 580 bdev->bd_contains = bdev;
@@ -605,21 +605,21 @@ static int do_open(struct block_device *bdev, struct file *file)
605 if (ret) 605 if (ret)
606 goto out_first; 606 goto out_first;
607 bdev->bd_contains = whole; 607 bdev->bd_contains = whole;
608 down(&whole->bd_sem); 608 mutex_lock(&whole->bd_mutex);
609 whole->bd_part_count++; 609 whole->bd_part_count++;
610 p = disk->part[part - 1]; 610 p = disk->part[part - 1];
611 bdev->bd_inode->i_data.backing_dev_info = 611 bdev->bd_inode->i_data.backing_dev_info =
612 whole->bd_inode->i_data.backing_dev_info; 612 whole->bd_inode->i_data.backing_dev_info;
613 if (!(disk->flags & GENHD_FL_UP) || !p || !p->nr_sects) { 613 if (!(disk->flags & GENHD_FL_UP) || !p || !p->nr_sects) {
614 whole->bd_part_count--; 614 whole->bd_part_count--;
615 up(&whole->bd_sem); 615 mutex_unlock(&whole->bd_mutex);
616 ret = -ENXIO; 616 ret = -ENXIO;
617 goto out_first; 617 goto out_first;
618 } 618 }
619 kobject_get(&p->kobj); 619 kobject_get(&p->kobj);
620 bdev->bd_part = p; 620 bdev->bd_part = p;
621 bd_set_size(bdev, (loff_t) p->nr_sects << 9); 621 bd_set_size(bdev, (loff_t) p->nr_sects << 9);
622 up(&whole->bd_sem); 622 mutex_unlock(&whole->bd_mutex);
623 } 623 }
624 } else { 624 } else {
625 put_disk(disk); 625 put_disk(disk);
@@ -633,13 +633,13 @@ static int do_open(struct block_device *bdev, struct file *file)
633 if (bdev->bd_invalidated) 633 if (bdev->bd_invalidated)
634 rescan_partitions(bdev->bd_disk, bdev); 634 rescan_partitions(bdev->bd_disk, bdev);
635 } else { 635 } else {
636 down(&bdev->bd_contains->bd_sem); 636 mutex_lock(&bdev->bd_contains->bd_mutex);
637 bdev->bd_contains->bd_part_count++; 637 bdev->bd_contains->bd_part_count++;
638 up(&bdev->bd_contains->bd_sem); 638 mutex_unlock(&bdev->bd_contains->bd_mutex);
639 } 639 }
640 } 640 }
641 bdev->bd_openers++; 641 bdev->bd_openers++;
642 up(&bdev->bd_sem); 642 mutex_unlock(&bdev->bd_mutex);
643 unlock_kernel(); 643 unlock_kernel();
644 return 0; 644 return 0;
645 645
@@ -652,7 +652,7 @@ out_first:
652 put_disk(disk); 652 put_disk(disk);
653 module_put(owner); 653 module_put(owner);
654out: 654out:
655 up(&bdev->bd_sem); 655 mutex_unlock(&bdev->bd_mutex);
656 unlock_kernel(); 656 unlock_kernel();
657 if (ret) 657 if (ret)
658 bdput(bdev); 658 bdput(bdev);
@@ -714,7 +714,7 @@ int blkdev_put(struct block_device *bdev)
714 struct inode *bd_inode = bdev->bd_inode; 714 struct inode *bd_inode = bdev->bd_inode;
715 struct gendisk *disk = bdev->bd_disk; 715 struct gendisk *disk = bdev->bd_disk;
716 716
717 down(&bdev->bd_sem); 717 mutex_lock(&bdev->bd_mutex);
718 lock_kernel(); 718 lock_kernel();
719 if (!--bdev->bd_openers) { 719 if (!--bdev->bd_openers) {
720 sync_blockdev(bdev); 720 sync_blockdev(bdev);
@@ -724,9 +724,9 @@ int blkdev_put(struct block_device *bdev)
724 if (disk->fops->release) 724 if (disk->fops->release)
725 ret = disk->fops->release(bd_inode, NULL); 725 ret = disk->fops->release(bd_inode, NULL);
726 } else { 726 } else {
727 down(&bdev->bd_contains->bd_sem); 727 mutex_lock(&bdev->bd_contains->bd_mutex);
728 bdev->bd_contains->bd_part_count--; 728 bdev->bd_contains->bd_part_count--;
729 up(&bdev->bd_contains->bd_sem); 729 mutex_unlock(&bdev->bd_contains->bd_mutex);
730 } 730 }
731 if (!bdev->bd_openers) { 731 if (!bdev->bd_openers) {
732 struct module *owner = disk->fops->owner; 732 struct module *owner = disk->fops->owner;
@@ -746,7 +746,7 @@ int blkdev_put(struct block_device *bdev)
746 bdev->bd_contains = NULL; 746 bdev->bd_contains = NULL;
747 } 747 }
748 unlock_kernel(); 748 unlock_kernel();
749 up(&bdev->bd_sem); 749 mutex_unlock(&bdev->bd_mutex);
750 bdput(bdev); 750 bdput(bdev);
751 return ret; 751 return ret;
752} 752}
diff --git a/fs/buffer.c b/fs/buffer.c
index 1d3683d496f8..0d6ca7bac6c8 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -201,7 +201,7 @@ int fsync_bdev(struct block_device *bdev)
201 * freeze_bdev -- lock a filesystem and force it into a consistent state 201 * freeze_bdev -- lock a filesystem and force it into a consistent state
202 * @bdev: blockdevice to lock 202 * @bdev: blockdevice to lock
203 * 203 *
204 * This takes the block device bd_mount_sem to make sure no new mounts 204 * This takes the block device bd_mount_mutex to make sure no new mounts
205 * happen on bdev until thaw_bdev() is called. 205 * happen on bdev until thaw_bdev() is called.
206 * If a superblock is found on this device, we take the s_umount semaphore 206 * If a superblock is found on this device, we take the s_umount semaphore
207 * on it to make sure nobody unmounts until the snapshot creation is done. 207 * on it to make sure nobody unmounts until the snapshot creation is done.
@@ -210,7 +210,7 @@ struct super_block *freeze_bdev(struct block_device *bdev)
210{ 210{
211 struct super_block *sb; 211 struct super_block *sb;
212 212
213 down(&bdev->bd_mount_sem); 213 mutex_lock(&bdev->bd_mount_mutex);
214 sb = get_super(bdev); 214 sb = get_super(bdev);
215 if (sb && !(sb->s_flags & MS_RDONLY)) { 215 if (sb && !(sb->s_flags & MS_RDONLY)) {
216 sb->s_frozen = SB_FREEZE_WRITE; 216 sb->s_frozen = SB_FREEZE_WRITE;
@@ -264,7 +264,7 @@ void thaw_bdev(struct block_device *bdev, struct super_block *sb)
264 drop_super(sb); 264 drop_super(sb);
265 } 265 }
266 266
267 up(&bdev->bd_mount_sem); 267 mutex_unlock(&bdev->bd_mount_mutex);
268} 268}
269EXPORT_SYMBOL(thaw_bdev); 269EXPORT_SYMBOL(thaw_bdev);
270 270
diff --git a/fs/super.c b/fs/super.c
index e20b5580afd5..8f9c9b3af70c 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -693,9 +693,9 @@ struct super_block *get_sb_bdev(struct file_system_type *fs_type,
693 * will protect the lockfs code from trying to start a snapshot 693 * will protect the lockfs code from trying to start a snapshot
694 * while we are mounting 694 * while we are mounting
695 */ 695 */
696 down(&bdev->bd_mount_sem); 696 mutex_lock(&bdev->bd_mount_mutex);
697 s = sget(fs_type, test_bdev_super, set_bdev_super, bdev); 697 s = sget(fs_type, test_bdev_super, set_bdev_super, bdev);
698 up(&bdev->bd_mount_sem); 698 mutex_unlock(&bdev->bd_mount_mutex);
699 if (IS_ERR(s)) 699 if (IS_ERR(s))
700 goto out; 700 goto out;
701 701