linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Blunck <jblunck@suse.de>
To: linux-fsdevel@vger.kernel.org,
	Christoph Hellwig <hch@infradead.org>,
	Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: "Linux-Kernel Mailinglist" <linux-kernel@vger.kernel.org>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"Thomas Gleixner" <tglx@linutronix.de>,
	jkacur@redhat.com, "Arnd Bergmann" <arnd@arndb.de>,
	"Frédéric Weisbecker" <fweisbec@gmail.com>,
	"Jamie Lokier" <jamie@shareable.org>,
	"Jan Blunck" <jblunck@suse.de>, "H. Peter Anvin" <hpa@zytor.com>,
	"Christoph Hellwig" <hch@infradead.org>,
	"Petr Vandrovec" <vandrove@vc.cvut.cz>,
	"Anders Larsen" <al@alarsen.net>, "Jan Kara" <jack@suse.cz>
Subject: [PATCH 13/15] Do not fallback to default_llseek() when readdir() uses BKL
Date: Fri, 20 Nov 2009 17:40:43 +0100	[thread overview]
Message-ID: <1258735245-25826-14-git-send-email-jblunck@suse.de> (raw)
In-Reply-To: <1258735245-25826-1-git-send-email-jblunck@suse.de>

Do not use the fallback default_llseek() if the readdir operation of the
filesystem still uses the big kernel lock. Since llseek() modifies
file->f_pos of the directory directly it may need locking to not confuse
readdir which usually uses file->f_pos directly as well. Since the special
characteristics of the BKL (unlocked on schedule) are not necessary in this
case, the inode mutex can be used for locking as provided by
generic_file_llseek(). This is only possible since all filesystems, except
reiserfs, either use a directory as a flat file or with disk address
offsets. Reiserfs on the other hand uses a 32bit hash off the filename as
the offset so generic_file_llseek() can get used as well since the hash is
always smaller than sb->s_maxbytes (= (512 << 32) - blocksize).

Signed-off-by: Jan Blunck <jblunck@suse.de>
---
 fs/autofs/root.c          |    1 +
 fs/freevxfs/vxfs_lookup.c |    2 ++
 fs/isofs/dir.c            |    1 +
 fs/ncpfs/dir.c            |    1 +
 fs/qnx4/dir.c             |    1 +
 fs/reiserfs/dir.c         |    1 +
 fs/smbfs/dir.c            |    1 +
 fs/udf/dir.c              |    1 +
 8 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/fs/autofs/root.c b/fs/autofs/root.c
index 4a1401c..d3aec77 100644
--- a/fs/autofs/root.c
+++ b/fs/autofs/root.c
@@ -30,6 +30,7 @@ const struct file_operations autofs_root_operations = {
 	.read		= generic_read_dir,
 	.readdir	= autofs_root_readdir,
 	.ioctl		= autofs_root_ioctl,
+	.llseek		= generic_file_llseek,
 };
 
 const struct inode_operations autofs_root_inode_operations = {
diff --git a/fs/freevxfs/vxfs_lookup.c b/fs/freevxfs/vxfs_lookup.c
index aee049c..0ec7bb2 100644
--- a/fs/freevxfs/vxfs_lookup.c
+++ b/fs/freevxfs/vxfs_lookup.c
@@ -57,6 +57,8 @@ const struct inode_operations vxfs_dir_inode_ops = {
 };
 
 const struct file_operations vxfs_dir_operations = {
+	.llseek =		generic_file_llseek,
+	.read =			generic_read_dir,
 	.readdir =		vxfs_readdir,
 };
 
diff --git a/fs/isofs/dir.c b/fs/isofs/dir.c
index 8ba5441..4816bd3 100644
--- a/fs/isofs/dir.c
+++ b/fs/isofs/dir.c
@@ -271,6 +271,7 @@ static int isofs_readdir(struct file *filp,
 
 const struct file_operations isofs_dir_operations =
 {
+	.llseek = generic_file_llseek,
 	.read = generic_read_dir,
 	.readdir = isofs_readdir,
 };
diff --git a/fs/ncpfs/dir.c b/fs/ncpfs/dir.c
index b8b5b30..c9cad9a 100644
--- a/fs/ncpfs/dir.c
+++ b/fs/ncpfs/dir.c
@@ -50,6 +50,7 @@ extern int ncp_symlink(struct inode *, struct dentry *, const char *);
 		      
 const struct file_operations ncp_dir_operations =
 {
+	.llseek		= generic_file_llseek,
 	.read		= generic_read_dir,
 	.readdir	= ncp_readdir,
 	.ioctl		= ncp_ioctl,
diff --git a/fs/qnx4/dir.c b/fs/qnx4/dir.c
index 86cc39c..da40f9b 100644
--- a/fs/qnx4/dir.c
+++ b/fs/qnx4/dir.c
@@ -77,6 +77,7 @@ out:
 
 const struct file_operations qnx4_dir_operations =
 {
+	.llseek		= generic_file_llseek,
 	.read		= generic_read_dir,
 	.readdir	= qnx4_readdir,
 	.fsync		= simple_fsync,
diff --git a/fs/reiserfs/dir.c b/fs/reiserfs/dir.c
index 6d2668f..fa616a1 100644
--- a/fs/reiserfs/dir.c
+++ b/fs/reiserfs/dir.c
@@ -17,6 +17,7 @@ static int reiserfs_dir_fsync(struct file *filp, struct dentry *dentry,
 			      int datasync);
 
 const struct file_operations reiserfs_dir_operations = {
+	.llseek = generic_file_llseek,
 	.read = generic_read_dir,
 	.readdir = reiserfs_readdir,
 	.fsync = reiserfs_dir_fsync,
diff --git a/fs/smbfs/dir.c b/fs/smbfs/dir.c
index 3e4803b..cd11c54 100644
--- a/fs/smbfs/dir.c
+++ b/fs/smbfs/dir.c
@@ -37,6 +37,7 @@ static int smb_link(struct dentry *, struct inode *, struct dentry *);
 
 const struct file_operations smb_dir_operations =
 {
+	.llseek		= generic_file_llseek,
 	.read		= generic_read_dir,
 	.readdir	= smb_readdir,
 	.ioctl		= smb_ioctl,
diff --git a/fs/udf/dir.c b/fs/udf/dir.c
index 61d9a76..475cc49 100644
--- a/fs/udf/dir.c
+++ b/fs/udf/dir.c
@@ -207,6 +207,7 @@ static int udf_readdir(struct file *filp, void *dirent, filldir_t filldir)
 
 /* readdir and lookup functions */
 const struct file_operations udf_dir_operations = {
+	.llseek			= generic_file_llseek,
 	.read			= generic_read_dir,
 	.readdir		= udf_readdir,
 	.ioctl			= udf_ioctl,
-- 
1.6.4.2

  parent reply	other threads:[~2009-11-20 16:40 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-20 16:40 [PATCH 00/15] Remove BKL from default_llseek() and other issues (v2) Jan Blunck
2009-11-20 16:40 ` [PATCH 01/15] Introduce noop_llseek() Jan Blunck
2009-11-20 17:05   ` Jamie Lokier
2009-11-20 17:11     ` Jan Blunck
2009-11-21 16:56       ` Arnd Bergmann
2009-11-20 16:40 ` [PATCH 02/15] osst: Use noop_llseek() instead of default_llseek() Jan Blunck
2009-11-20 17:09   ` Jamie Lokier
2009-11-20 17:25     ` Jan Blunck
2009-11-20 16:40 ` [PATCH 03/15] osst: Update ppos instead of using file->f_pos Jan Blunck
2009-11-20 17:13   ` Jamie Lokier
2009-11-20 17:16     ` Jamie Lokier
2009-11-20 16:40 ` [PATCH 04/15] s390: tape_char should update " Jan Blunck
2009-11-20 16:40 ` [PATCH 05/15] flash_read should update ppos instead of file->f_pos Jan Blunck
2009-11-20 16:40 ` [PATCH 06/15] eeprom_read()/eeprom_write() " Jan Blunck
2009-11-20 16:40 ` [PATCH 07/15] sched_feat_write: Update " Jan Blunck
2009-11-20 16:40 ` [PATCH 08/15] airo: Use " Jan Blunck
2009-11-20 16:40 ` [PATCH 09/15] frv: remove "struct file *" argument from sysctl ->proc_handler Jan Blunck
2009-11-20 16:40 ` [PATCH 10/15] mISDN: Remove unnecessary test on f_pos Jan Blunck
2009-11-20 16:40 ` [PATCH 11/15] zcrypt: Use nonseekable_open() Jan Blunck
2009-11-20 16:40 ` [PATCH 12/15] rtc-m41t80: " Jan Blunck
2009-11-20 16:40 ` Jan Blunck [this message]
2009-11-20 21:27   ` [PATCH 13/15] Do not fallback to default_llseek() when readdir() uses BKL Jan Kara
2009-11-21 18:03   ` Anders Larsen
2009-11-20 16:40 ` [PATCH 14/15] BKL: Remove BKL from default_llseek() Jan Blunck
2009-11-20 16:40 ` [PATCH 15/15] BKL: Update documentation on llseek( \b) Jan Blunck
2009-11-20 17:02   ` [PATCH 15/15] BKL: Update documentation on llseek(\b) Alan Cox

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=1258735245-25826-14-git-send-email-jblunck@suse.de \
    --to=jblunck@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=al@alarsen.net \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=arnd@arndb.de \
    --cc=fweisbec@gmail.com \
    --cc=hch@infradead.org \
    --cc=hpa@zytor.com \
    --cc=jack@suse.cz \
    --cc=jamie@shareable.org \
    --cc=jkacur@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=vandrove@vc.cvut.cz \
    /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).