mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] Remove unneded lock_kernel() in driver/block/loop.c
@ 2007-07-09  1:57 Diego Woitasen
  2007-07-20  0:38 ` Andrew Morton
  0 siblings, 1 reply; 2+ messages in thread
From: Diego Woitasen @ 2007-07-09  1:57 UTC (permalink / raw)
  To: akpm, linux-kernel; +Cc: Diego Woitasen


Signed-off-by: Diego Woitasen <diego@woitasen.com.ar>
---
 drivers/block/loop.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index 0ed5470..1cc004e 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -1286,7 +1286,6 @@ static long lo_compat_ioctl(struct file *file, unsigned int cmd, unsigned long a
 	struct loop_device *lo = inode->i_bdev->bd_disk->private_data;
 	int err;
 
-	lock_kernel();
 	switch(cmd) {
 	case LOOP_SET_STATUS:
 		mutex_lock(&lo->lo_ctl_mutex);
@@ -1312,7 +1311,6 @@ static long lo_compat_ioctl(struct file *file, unsigned int cmd, unsigned long a
 		err = -ENOIOCTLCMD;
 		break;
 	}
-	unlock_kernel();
 	return err;
 }
 #endif
-- 
1.5.2.3


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Remove unneded lock_kernel() in driver/block/loop.c
  2007-07-09  1:57 [PATCH] Remove unneded lock_kernel() in driver/block/loop.c Diego Woitasen
@ 2007-07-20  0:38 ` Andrew Morton
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2007-07-20  0:38 UTC (permalink / raw)
  To: Diego Woitasen; +Cc: linux-kernel, Christoph Hellwig

On Sun,  8 Jul 2007 22:57:01 -0300
Diego Woitasen <diego@woitasen.com.ar> wrote:

> 
> Signed-off-by: Diego Woitasen <diego@woitasen.com.ar>
> ---
>  drivers/block/loop.c |    2 --
>  1 files changed, 0 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/block/loop.c b/drivers/block/loop.c
> index 0ed5470..1cc004e 100644
> --- a/drivers/block/loop.c
> +++ b/drivers/block/loop.c
> @@ -1286,7 +1286,6 @@ static long lo_compat_ioctl(struct file *file, unsigned int cmd, unsigned long a
>  	struct loop_device *lo = inode->i_bdev->bd_disk->private_data;
>  	int err;
>  
> -	lock_kernel();
>  	switch(cmd) {
>  	case LOOP_SET_STATUS:
>  		mutex_lock(&lo->lo_ctl_mutex);
> @@ -1312,7 +1311,6 @@ static long lo_compat_ioctl(struct file *file, unsigned int cmd, unsigned long a
>  		err = -ENOIOCTLCMD;
>  		break;
>  	}
> -	unlock_kernel();
>  	return err;
>  }
>  #endif

I agree.  And that means that we can move lo_ioctl over to being an
unlocked_ioctl handler.


--- a/drivers/block/loop.c~loop-use-unlocked_ioctl
+++ a/drivers/block/loop.c
@@ -1124,12 +1124,14 @@ loop_get_status64(struct loop_device *lo
 	return err;
 }
 
-static int lo_ioctl(struct inode * inode, struct file * file,
-	unsigned int cmd, unsigned long arg)
+static long lo_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 {
-	struct loop_device *lo = inode->i_bdev->bd_disk->private_data;
+	struct inode *inode;
+	struct loop_device *lo;
 	int err;
 
+	inode = file->f_mapping->host;
+	lo = inode->i_bdev->bd_disk->private_data;
 	mutex_lock(&lo->lo_ctl_mutex);
 	switch (cmd) {
 	case LOOP_SET_FD:
@@ -1304,7 +1306,7 @@ static long lo_compat_ioctl(struct file 
 		arg = (unsigned long) compat_ptr(arg);
 	case LOOP_SET_FD:
 	case LOOP_CHANGE_FD:
-		err = lo_ioctl(inode, file, cmd, arg);
+		err = lo_ioctl(file, cmd, arg);
 		break;
 	default:
 		err = -ENOIOCTLCMD;
@@ -1340,7 +1342,7 @@ static struct block_device_operations lo
 	.owner =	THIS_MODULE,
 	.open =		lo_open,
 	.release =	lo_release,
-	.ioctl =	lo_ioctl,
+	.unlocked_ioctl = lo_ioctl,
 #ifdef CONFIG_COMPAT
 	.compat_ioctl =	lo_compat_ioctl,
 #endif
_


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-07-20  0:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-09  1:57 [PATCH] Remove unneded lock_kernel() in driver/block/loop.c Diego Woitasen
2007-07-20  0:38 ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome