summaryrefslogtreecommitdiff
path: root/fs/inode.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2010-10-23 11:11:40 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2010-10-25 21:26:11 -0400
commit7de9c6ee3ecffd99e1628e81a5ea5468f7581a1f (patch)
tree88787e77ba8a253d0a26aeda4bd5e58532d592e0 /fs/inode.c
parent646ec4615cd05972581c9c5342ed7a1e77df17bb (diff)
new helper: ihold()
Clones an existing reference to inode; caller must already hold one. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/inode.c')
-rw-r--r--fs/inode.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/fs/inode.c b/fs/inode.c
index 430d70f2abe7..05ea293d5f32 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -320,6 +320,15 @@ void __iget(struct inode *inode)
atomic_inc(&inode->i_count);
}
+/*
+ * get additional reference to inode; caller must already hold one.
+ */
+void ihold(struct inode *inode)
+{
+ WARN_ON(atomic_inc_return(&inode->i_count) < 2);
+}
+EXPORT_SYMBOL(ihold);
+
static void inode_lru_list_add(struct inode *inode)
{
if (list_empty(&inode->i_list)) {