From: "Jörn Engel" <joern@lazybastard.org>
To: linux-fsdevel@vger.kernel.org
Cc: Anton Altaparmakov <aia21@cam.ac.uk>, David Chinner <dgc@sgi.com>,
Dave Kleikamp <shaggy@linux.vnet.ibm.com>,
Al Viro <viro@ftp.linux.org.uk>,
Christoph Hellwig <hch@infradead.org>
Subject: [PATCH] [NTFS] Remove ilookup5_nowait and convert users to ilookup5
Date: Wed, 21 Feb 2007 18:55:32 +0000 [thread overview]
Message-ID: <20070221185531.GD3219@lazybastard.org> (raw)
In-Reply-To: <20070221130956.GB464@lazybastard.org>
After seperating I_LOCK and I_SYNC, the deadlock in NTFS that caused
the creation of ilookup5_nowait can no longer happen. Remove
ilookup5_nowait, as it has become pointless.
---
fs/inode.c | 41 ++++-------------------------------------
fs/ntfs/mft.c | 12 ++----------
include/linux/fs.h | 3 ---
3 files changed, 6 insertions(+), 50 deletions(-)
diff --git a/fs/inode.c b/fs/inode.c
index 5abb097..5cfc6eb 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -731,7 +731,6 @@ EXPORT_SYMBOL(igrab);
* @head: the head of the list to search
* @test: callback used for comparisons between inodes
* @data: opaque data pointer to pass to @test
- * @wait: if true wait for the inode to be unlocked, if false do not
*
* ifind() searches for the inode specified by @data in the inode
* cache. This is a generalized version of ifind_fast() for file systems where
@@ -746,7 +745,7 @@ EXPORT_SYMBOL(igrab);
*/
static struct inode *ifind(struct super_block *sb,
struct hlist_head *head, int (*test)(struct inode *, void *),
- void *data, const int wait)
+ void *data)
{
struct inode *inode;
@@ -755,8 +754,7 @@ static struct inode *ifind(struct super_
if (inode) {
__iget(inode);
spin_unlock(&inode_lock);
- if (likely(wait))
- wait_on_inode(inode);
+ wait_on_inode(inode);
return inode;
}
spin_unlock(&inode_lock);
@@ -796,37 +794,6 @@ static struct inode *ifind_fast(struct s
}
/**
- * ilookup5_nowait - search for an inode in the inode cache
- * @sb: super block of file system to search
- * @hashval: hash value (usually inode number) to search for
- * @test: callback used for comparisons between inodes
- * @data: opaque data pointer to pass to @test
- *
- * ilookup5() uses ifind() to search for the inode specified by @hashval and
- * @data in the inode cache. This is a generalized version of ilookup() for
- * file systems where the inode number is not sufficient for unique
- * identification of an inode.
- *
- * If the inode is in the cache, the inode is returned with an incremented
- * reference count. Note, the inode lock is not waited upon so you have to be
- * very careful what you do with the returned inode. You probably should be
- * using ilookup5() instead.
- *
- * Otherwise NULL is returned.
- *
- * Note, @test is called with the inode_lock held, so can't sleep.
- */
-struct inode *ilookup5_nowait(struct super_block *sb, unsigned long hashval,
- int (*test)(struct inode *, void *), void *data)
-{
- struct hlist_head *head = inode_hashtable + hash(sb, hashval);
-
- return ifind(sb, head, test, data, 0);
-}
-
-EXPORT_SYMBOL(ilookup5_nowait);
-
-/**
* ilookup5 - search for an inode in the inode cache
* @sb: super block of file system to search
* @hashval: hash value (usually inode number) to search for
@@ -850,7 +817,7 @@ struct inode *ilookup5(struct super_bloc
{
struct hlist_head *head = inode_hashtable + hash(sb, hashval);
- return ifind(sb, head, test, data, 1);
+ return ifind(sb, head, test, data);
}
EXPORT_SYMBOL(ilookup5);
@@ -907,7 +874,7 @@ struct inode *iget5_locked(struct super_
struct hlist_head *head = inode_hashtable + hash(sb, hashval);
struct inode *inode;
- inode = ifind(sb, head, test, data, 1);
+ inode = ifind(sb, head, test, data);
if (inode)
return inode;
/*
diff --git a/fs/ntfs/mft.c b/fs/ntfs/mft.c
index 2ad5c8b..62d659b 100644
--- a/fs/ntfs/mft.c
+++ b/fs/ntfs/mft.c
@@ -956,14 +956,7 @@ bool ntfs_may_write_mft_record(ntfs_volu
vi = igrab(mft_vi);
BUG_ON(vi != mft_vi);
} else {
- /*
- * Have to use ilookup5_nowait() since ilookup5() waits for the
- * inode lock which causes ntfs to deadlock when a concurrent
- * inode write via the inode dirty code paths and the page
- * dirty code path of the inode dirty code path when writing
- * $MFT occurs.
- */
- vi = ilookup5_nowait(sb, mft_no, (test_t)ntfs_test_inode, &na);
+ vi = ilookup5(sb, mft_no, (test_t)ntfs_test_inode, &na);
}
if (vi) {
ntfs_debug("Base inode 0x%lx is in icache.", mft_no);
@@ -1024,8 +1017,7 @@ bool ntfs_may_write_mft_record(ntfs_volu
vi = igrab(mft_vi);
BUG_ON(vi != mft_vi);
} else
- vi = ilookup5_nowait(sb, na.mft_no, (test_t)ntfs_test_inode,
- &na);
+ vi = ilookup5(sb, na.mft_no, (test_t)ntfs_test_inode, &na);
if (!vi) {
/*
* The base inode is not in icache, write this extent mft
diff --git a/include/linux/fs.h b/include/linux/fs.h
index f9eb221..8ee5810 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1660,9 +1660,6 @@ extern int inode_needs_sync(struct inode
extern void generic_delete_inode(struct inode *inode);
extern void generic_drop_inode(struct inode *inode);
-extern struct inode *ilookup5_nowait(struct super_block *sb,
- unsigned long hashval, int (*test)(struct inode *, void *),
- void *data);
extern struct inode *ilookup5(struct super_block *sb, unsigned long hashval,
int (*test)(struct inode *, void *), void *data);
extern struct inode *ilookup(struct super_block *sb, unsigned long ino);
--
1.4.2.3
next prev parent reply other threads:[~2007-02-21 18:58 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-02-21 13:09 [RFC] The many faces of the I_LOCK Jörn Engel
2007-02-21 18:29 ` David Chinner
2007-02-21 18:47 ` Jörn Engel
2007-02-21 18:57 ` Jörn Engel
2007-02-21 18:54 ` [PATCH 1/3] Replace I_LOCK with I_SYNC for fs/fs-writeback.c uses Jörn Engel
2007-02-21 18:55 ` Jörn Engel [this message]
2007-02-21 18:56 ` [PATCH 3/3] Replace I_LOCK with I_SYNC in XFS Jörn Engel
2007-02-22 11:40 ` [RFC] The many faces of the I_LOCK Jörn Engel
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=20070221185531.GD3219@lazybastard.org \
--to=joern@lazybastard.org \
--cc=aia21@cam.ac.uk \
--cc=dgc@sgi.com \
--cc=hch@infradead.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=shaggy@linux.vnet.ibm.com \
--cc=viro@ftp.linux.org.uk \
/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).