mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-25 21:24:08 +08:00
[PATCH] sem2mutex: drivers/block/loop.c
Semaphore to mutex conversion. The conversion was generated via scripts, and the result was validated automatically via a script as well. Signed-off-by: Ingo Molnar <mingo@elte.hu> Cc: Jens Axboe <axboe@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
parent
0ac1759abc
commit
f85221dd74
@ -1144,7 +1144,7 @@ static int lo_ioctl(struct inode * inode, struct file * file,
|
||||
struct loop_device *lo = inode->i_bdev->bd_disk->private_data;
|
||||
int err;
|
||||
|
||||
down(&lo->lo_ctl_mutex);
|
||||
mutex_lock(&lo->lo_ctl_mutex);
|
||||
switch (cmd) {
|
||||
case LOOP_SET_FD:
|
||||
err = loop_set_fd(lo, file, inode->i_bdev, arg);
|
||||
@ -1170,7 +1170,7 @@ static int lo_ioctl(struct inode * inode, struct file * file,
|
||||
default:
|
||||
err = lo->ioctl ? lo->ioctl(lo, cmd, arg) : -EINVAL;
|
||||
}
|
||||
up(&lo->lo_ctl_mutex);
|
||||
mutex_unlock(&lo->lo_ctl_mutex);
|
||||
return err;
|
||||
}
|
||||
|
||||
@ -1178,9 +1178,9 @@ static int lo_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
struct loop_device *lo = inode->i_bdev->bd_disk->private_data;
|
||||
|
||||
down(&lo->lo_ctl_mutex);
|
||||
mutex_lock(&lo->lo_ctl_mutex);
|
||||
lo->lo_refcnt++;
|
||||
up(&lo->lo_ctl_mutex);
|
||||
mutex_unlock(&lo->lo_ctl_mutex);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -1189,9 +1189,9 @@ static int lo_release(struct inode *inode, struct file *file)
|
||||
{
|
||||
struct loop_device *lo = inode->i_bdev->bd_disk->private_data;
|
||||
|
||||
down(&lo->lo_ctl_mutex);
|
||||
mutex_lock(&lo->lo_ctl_mutex);
|
||||
--lo->lo_refcnt;
|
||||
up(&lo->lo_ctl_mutex);
|
||||
mutex_unlock(&lo->lo_ctl_mutex);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -1233,12 +1233,12 @@ int loop_unregister_transfer(int number)
|
||||
xfer_funcs[n] = NULL;
|
||||
|
||||
for (lo = &loop_dev[0]; lo < &loop_dev[max_loop]; lo++) {
|
||||
down(&lo->lo_ctl_mutex);
|
||||
mutex_lock(&lo->lo_ctl_mutex);
|
||||
|
||||
if (lo->lo_encryption == xfer)
|
||||
loop_release_xfer(lo);
|
||||
|
||||
up(&lo->lo_ctl_mutex);
|
||||
mutex_unlock(&lo->lo_ctl_mutex);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -1285,7 +1285,7 @@ static int __init loop_init(void)
|
||||
lo->lo_queue = blk_alloc_queue(GFP_KERNEL);
|
||||
if (!lo->lo_queue)
|
||||
goto out_mem4;
|
||||
init_MUTEX(&lo->lo_ctl_mutex);
|
||||
mutex_init(&lo->lo_ctl_mutex);
|
||||
init_completion(&lo->lo_done);
|
||||
init_completion(&lo->lo_bh_done);
|
||||
lo->lo_number = i;
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include <linux/bio.h>
|
||||
#include <linux/blkdev.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/mutex.h>
|
||||
|
||||
/* Possible states of device */
|
||||
enum {
|
||||
@ -60,7 +61,7 @@ struct loop_device {
|
||||
int lo_state;
|
||||
struct completion lo_done;
|
||||
struct completion lo_bh_done;
|
||||
struct semaphore lo_ctl_mutex;
|
||||
struct mutex lo_ctl_mutex;
|
||||
int lo_pending;
|
||||
|
||||
request_queue_t *lo_queue;
|
||||
|
Loading…
Reference in New Issue
Block a user