linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC] reduce BKL contention in block device ->open/->release
@ 2003-02-05  0:54 Christoph Hellwig
  0 siblings, 0 replies; only message in thread
From: Christoph Hellwig @ 2003-02-05  0:54 UTC (permalink / raw)
  To: linux-fsdevel

I looked through the callchain carefully, but it can't find anything
that needs BKL protection but the actual LLDD methods.


===========================================================================
Index: linux/fs/block_dev.c
===========================================================================

--- /usr/tmp/TmpDir.1943-0/linux/fs/block_dev.c_1.35	Mon Feb  3 18:36:20 2003
+++ linux/fs/block_dev.c	Mon Feb  3 18:31:49 2003
@@ -560,15 +560,17 @@
 	kdev_t dev = to_kdev_t(bdev->bd_dev);
 
 	down(&bdev->bd_sem);
-	lock_kernel();
 	if (!bdev->bd_op)
 		bdev->bd_op = get_blkfops(MAJOR(dev));
 	if (bdev->bd_op) {
 		ret = 0;
 		if (bdev->bd_op->owner)
 			__MOD_INC_USE_COUNT(bdev->bd_op->owner);
-		if (bdev->bd_op->open)
+		if (bdev->bd_op->open) {
+			lock_kernel();
 			ret = bdev->bd_op->open(inode, file);
+			unlock_kernel();
+		}
 		if (!ret) {
 			bdev->bd_openers++;
 			bdev->bd_inode->i_size = blkdev_size(dev);
@@ -580,7 +582,6 @@
 				bdev->bd_op = NULL;
 		}
 	}
-	unlock_kernel();
 	up(&bdev->bd_sem);
 	if (ret)
 		bdput(bdev);
@@ -630,20 +631,21 @@
 	struct inode *bd_inode = bdev->bd_inode;
 
 	down(&bdev->bd_sem);
-	lock_kernel();
 	if (kind == BDEV_FILE && bdev->bd_openers == 1)
 		__block_fsync(bd_inode);
 	else if (kind == BDEV_FS)
 		fsync_no_super(rdev);
 	if (!--bdev->bd_openers)
 		kill_bdev(bdev);
-	if (bdev->bd_op->release)
+	if (bdev->bd_op->release) {
+		lock_kernel();
 		ret = bdev->bd_op->release(bd_inode, NULL);
+		unlock_kernel();
+	}
 	if (bdev->bd_op->owner)
 		__MOD_DEC_USE_COUNT(bdev->bd_op->owner);
 	if (!bdev->bd_openers)
 		bdev->bd_op = NULL;
-	unlock_kernel();
 	up(&bdev->bd_sem);
 	bdput(bdev);
 	return ret;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-02-04 17:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-02-05  0:54 [RFC] reduce BKL contention in block device ->open/->release Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).