From: Andrew Morton <akpm@linux-foundation.org>
To: Diego Woitasen <diego@woitasen.com.ar>
Cc: linux-kernel@vger.kernel.org, Christoph Hellwig <hch@lst.de>
Subject: Re: [PATCH] Remove unneded lock_kernel() in driver/block/loop.c
Date: Thu, 19 Jul 2007 17:38:43 -0700 [thread overview]
Message-ID: <20070719173843.b9478df5.akpm@linux-foundation.org> (raw)
In-Reply-To: <118394622153-git-send-email-diego@woitasen.com.ar>
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
_
prev parent reply other threads:[~2007-07-20 0:39 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-09 1:57 Diego Woitasen
2007-07-20 0:38 ` Andrew Morton [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070719173843.b9478df5.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=diego@woitasen.com.ar \
--cc=hch@lst.de \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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