diff options
author | Arjan van de Ven <arjan@infradead.org> | 2006-03-23 06:00:28 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-23 10:38:11 -0500 |
commit | c039e3134ae62863bbc8e8429b29e3c43cf21b2a (patch) | |
tree | b9bbf4fda0844e3173bf10a5bffbaaec94fb4246 /fs/block_dev.c | |
parent | 6f87f0deebaff2716a3ce9232f948d702690562a (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/block_dev.c')
-rw-r--r-- | fs/block_dev.c | 28 |
1 files changed, 14 insertions, 14 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); |
654 | out: | 654 | out: |
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 | } |