From: Christoph Hellwig <hch@sgi.com>
To: linux-fsdevel@vger.kernel.org
Subject: [RFC] reduce BKL contention in block device ->open/->release
Date: Tue, 4 Feb 2003 19:54:05 -0500 [thread overview]
Message-ID: <20030204195405.B17131@sgi.com> (raw)
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;
reply other threads:[~2003-02-04 17:49 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20030204195405.B17131@sgi.com \
--to=hch@sgi.com \
--cc=linux-fsdevel@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;
as well as URLs for NNTP newsgroup(s).