From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?utf-8?B?SsO2cm4=?= Engel Subject: [PATCH] [NTFS] Remove ilookup5_nowait and convert users to ilookup5 Date: Wed, 21 Feb 2007 18:55:32 +0000 Message-ID: <20070221185531.GD3219@lazybastard.org> References: <20070221130956.GB464@lazybastard.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Cc: Anton Altaparmakov , David Chinner , Dave Kleikamp , Al Viro , Christoph Hellwig To: linux-fsdevel@vger.kernel.org Return-path: Received: from lazybastard.de ([212.112.238.170]:56470 "EHLO longford.lazybastard.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751252AbXBUS62 (ORCPT ); Wed, 21 Feb 2007 13:58:28 -0500 Content-Disposition: inline In-Reply-To: <20070221130956.GB464@lazybastard.org> Sender: linux-fsdevel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.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