aboutsummaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorArjan van de Ven <arjan@infradead.org>2006-03-23 03:00:28 -0800
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-23 07:38:11 -0800
commitc039e3134ae62863bbc8e8429b29e3c43cf21b2a (patch)
treeb9bbf4fda0844e3173bf10a5bffbaaec94fb4246 /block
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 'block')
-rw-r--r--block/ioctl.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/block/ioctl.c b/block/ioctl.c
index e1109491c23..35fdb7dc651 100644
--- a/block/ioctl.c
+++ b/block/ioctl.c
@@ -42,9 +42,9 @@ static int blkpg_ioctl(struct block_device *bdev, struct blkpg_ioctl_arg __user
return -EINVAL;
}
/* partition number in use? */
- down(&bdev->bd_sem);
+ mutex_lock(&bdev->bd_mutex);
if (disk->part[part - 1]) {
- up(&bdev->bd_sem);
+ mutex_unlock(&bdev->bd_mutex);
return -EBUSY;
}
/* overlap? */
@@ -55,13 +55,13 @@ static int blkpg_ioctl(struct block_device *bdev, struct blkpg_ioctl_arg __user
continue;
if (!(start+length <= s->start_sect ||
start >= s->start_sect + s->nr_sects)) {
- up(&bdev->bd_sem);
+ mutex_unlock(&bdev->bd_mutex);
return -EBUSY;
}
}
/* all seems OK */
add_partition(disk, part, start, length);
- up(&bdev->bd_sem);
+ mutex_unlock(&bdev->bd_mutex);
return 0;
case BLKPG_DEL_PARTITION:
if (!disk->part[part-1])
@@ -71,9 +71,9 @@ static int blkpg_ioctl(struct block_device *bdev, struct blkpg_ioctl_arg __user
bdevp = bdget_disk(disk, part);
if (!bdevp)
return -ENOMEM;
- down(&bdevp->bd_sem);
+ mutex_lock(&bdevp->bd_mutex);
if (bdevp->bd_openers) {
- up(&bdevp->bd_sem);
+ mutex_unlock(&bdevp->bd_mutex);
bdput(bdevp);
return -EBUSY;
}
@@ -81,10 +81,10 @@ static int blkpg_ioctl(struct block_device *bdev, struct blkpg_ioctl_arg __user
fsync_bdev(bdevp);
invalidate_bdev(bdevp, 0);
- down(&bdev->bd_sem);
+ mutex_lock(&bdev->bd_mutex);
delete_partition(disk, part);
- up(&bdev->bd_sem);
- up(&bdevp->bd_sem);
+ mutex_unlock(&bdev->bd_mutex);
+ mutex_unlock(&bdevp->bd_mutex);
bdput(bdevp);
return 0;
@@ -102,10 +102,10 @@ static int blkdev_reread_part(struct block_device *bdev)
return -EINVAL;
if (!capable(CAP_SYS_ADMIN))
return -EACCES;
- if (down_trylock(&bdev->bd_sem))
+ if (!mutex_trylock(&bdev->bd_mutex))
return -EBUSY;
res = rescan_partitions(disk, bdev);
- up(&bdev->bd_sem);
+ mutex_unlock(&bdev->bd_mutex);
return res;
}