public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] block: remove BKL dependency from drivers/block/loop.c
@ 2006-12-27 11:52 Ingo Molnar
  2006-12-27 15:47 ` Ingo Molnar
  2007-01-03  7:32 ` Jens Axboe
  0 siblings, 2 replies; 3+ messages in thread
From: Ingo Molnar @ 2006-12-27 11:52 UTC (permalink / raw)
  To: linux-kernel; +Cc: Andrew Morton, Jens Axboe

Subject: [patch] block: remove BKL dependency from drivers/block/loop.c
From: Ingo Molnar <mingo@elte.hu>

the block loopback device is protected by lo->lo_ctl_mutex and it does 
not need to hold the BKL anywhere. Convert its ioctl to unlocked_ioctl 
and remove the BKL acquire/release from its compat_ioctl.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 drivers/block/loop.c |   20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

Index: linux/drivers/block/loop.c
===================================================================
--- linux.orig/drivers/block/loop.c
+++ linux/drivers/block/loop.c
@@ -1130,9 +1130,9 @@ 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 inode *inode = file->f_path.dentry->d_inode;
 	struct loop_device *lo = inode->i_bdev->bd_disk->private_data;
 	int err;
 
@@ -1291,8 +1291,7 @@ static long lo_compat_ioctl(struct file 
 	struct loop_device *lo = inode->i_bdev->bd_disk->private_data;
 	int err;
 
-	lock_kernel();
-	switch(cmd) {
+	switch (cmd) {
 	case LOOP_SET_STATUS:
 		mutex_lock(&lo->lo_ctl_mutex);
 		err = loop_set_status_compat(
@@ -1311,13 +1310,12 @@ 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;
 		break;
 	}
-	unlock_kernel();
 	return err;
 }
 #endif
@@ -1345,12 +1343,12 @@ static int lo_release(struct inode *inod
 }
 
 static struct block_device_operations lo_fops = {
-	.owner =	THIS_MODULE,
-	.open =		lo_open,
-	.release =	lo_release,
-	.ioctl =	lo_ioctl,
+	.owner =		THIS_MODULE,
+	.open =			lo_open,
+	.release =		lo_release,
+	.unlocked_ioctl =	lo_ioctl,
 #ifdef CONFIG_COMPAT
-	.compat_ioctl =	lo_compat_ioctl,
+	.compat_ioctl =		lo_compat_ioctl,
 #endif
 };
 

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

* Re: [patch] block: remove BKL dependency from drivers/block/loop.c
  2006-12-27 11:52 [patch] block: remove BKL dependency from drivers/block/loop.c Ingo Molnar
@ 2006-12-27 15:47 ` Ingo Molnar
  2007-01-03  7:32 ` Jens Axboe
  1 sibling, 0 replies; 3+ messages in thread
From: Ingo Molnar @ 2006-12-27 15:47 UTC (permalink / raw)
  To: linux-kernel; +Cc: Andrew Morton, Jens Axboe


* Ingo Molnar <mingo@elte.hu> wrote:

> Subject: [patch] block: remove BKL dependency from drivers/block/loop.c
> From: Ingo Molnar <mingo@elte.hu>
> 
> the block loopback device is protected by lo->lo_ctl_mutex and it does 
> not need to hold the BKL anywhere. Convert its ioctl to unlocked_ioctl 
> and remove the BKL acquire/release from its compat_ioctl.

hm, i must have messed up this bit:

> +static long lo_ioctl(struct file * file, unsigned int cmd, unsigned long arg)
>  {
> +	struct inode *inode = file->f_path.dentry->d_inode;
>  	struct loop_device *lo = inode->i_bdev->bd_disk->private_data;

because it now crashes there ... so forget this patch for now.

	Ingo

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

* Re: [patch] block: remove BKL dependency from drivers/block/loop.c
  2006-12-27 11:52 [patch] block: remove BKL dependency from drivers/block/loop.c Ingo Molnar
  2006-12-27 15:47 ` Ingo Molnar
@ 2007-01-03  7:32 ` Jens Axboe
  1 sibling, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2007-01-03  7:32 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: linux-kernel, Andrew Morton

On Wed, Dec 27 2006, Ingo Molnar wrote:
> Subject: [patch] block: remove BKL dependency from drivers/block/loop.c
> From: Ingo Molnar <mingo@elte.hu>
> 
> the block loopback device is protected by lo->lo_ctl_mutex and it does 
> not need to hold the BKL anywhere. Convert its ioctl to unlocked_ioctl 
> and remove the BKL acquire/release from its compat_ioctl.
> 
> Signed-off-by: Ingo Molnar <mingo@elte.hu>

Acked-by: Jens Axboe <jens.axboe@oracle.com>

-- 
Jens Axboe


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

end of thread, other threads:[~2007-01-03  7:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-12-27 11:52 [patch] block: remove BKL dependency from drivers/block/loop.c Ingo Molnar
2006-12-27 15:47 ` Ingo Molnar
2007-01-03  7:32 ` Jens Axboe

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