mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 03:27:44 -04:00
[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 <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> Acked-by: Jens Axboe <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
6f87f0deeb
commit
c039e3134a
7 changed files with 38 additions and 38 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue