From patchwork Mon Mar 28 01:56:00 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan Mallon X-Patchwork-Id: 667031 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p2S1uh6k012718 for ; Mon, 28 Mar 2011 01:56:43 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753459Ab1C1B4N (ORCPT ); Sun, 27 Mar 2011 21:56:13 -0400 Received: from mail.bluewatersys.com ([202.124.120.130]:16141 "EHLO hayes.bluewaternz.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753282Ab1C1Bzq (ORCPT ); Sun, 27 Mar 2011 21:55:46 -0400 Received: (qmail 7148 invoked by uid 89); 28 Mar 2011 01:56:10 -0000 Received: from unknown (HELO localhost.localdomain) (ryan@192.168.2.96) by 0 with ESMTPA; 28 Mar 2011 01:56:10 -0000 From: Ryan Mallon To: viro@zeniv.linux.org.uk, dchinner@redhat.com, Trond.Myklebust@netapp.com Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-nfs@vger.kernel.org, Ryan Mallon Subject: [RFC PATCH 1/2] Add unlocked version of igrab. Date: Mon, 28 Mar 2011 14:56:00 +1300 Message-Id: <1301277361-9453-2-git-send-email-ryan@bluewatersys.com> X-Mailer: git-send-email 1.5.5.1 In-Reply-To: <1301277361-9453-1-git-send-email-ryan@bluewatersys.com> References: <1301277361-9453-1-git-send-email-ryan@bluewatersys.com> Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Mon, 28 Mar 2011 01:56:43 +0000 (UTC) diff --git a/fs/inode.c b/fs/inode.c index 05a1f75..bdcfbba 100644 --- a/fs/inode.c +++ b/fs/inode.c @@ -1134,14 +1134,11 @@ ino_t iunique(struct super_block *sb, ino_t max_reserved) } EXPORT_SYMBOL(iunique); -struct inode *igrab(struct inode *inode) +struct inode *__igrab(struct inode *inode) { - spin_lock(&inode->i_lock); if (!(inode->i_state & (I_FREEING|I_WILL_FREE))) { __iget(inode); - spin_unlock(&inode->i_lock); } else { - spin_unlock(&inode->i_lock); /* * Handle the case where s_op->clear_inode is not been * called yet, and somebody is calling igrab @@ -1149,6 +1146,17 @@ struct inode *igrab(struct inode *inode) */ inode = NULL; } + + return inode; +} +EXPORT_SYMBOL(__igrab); + +struct inode *igrab(struct inode *inode) +{ + spin_lock(&inode->i_lock); + inode = __igrab(inode); + spin_unlock(&inode->i_lock); + return inode; } EXPORT_SYMBOL(igrab); diff --git a/include/linux/fs.h b/include/linux/fs.h index b677bd7..32c4bc5 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -2240,6 +2240,7 @@ extern void inode_init_once(struct inode *); extern void address_space_init_once(struct address_space *mapping); extern void ihold(struct inode * inode); extern void iput(struct inode *); +extern struct inode *__igrab(struct inode *inode); extern struct inode * igrab(struct inode *); extern ino_t iunique(struct super_block *, ino_t); extern int inode_needs_sync(struct inode *inode);