Commit 71c42157 authored by Dave Hansen's avatar Dave Hansen Committed by Linus Torvalds

document nlink function

These should have been documented from the beginning.  Fix it.
Signed-off-by: default avatarDave Hansen <haveblue@us.ibm.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 0faa4548
...@@ -1211,6 +1211,14 @@ static inline void mark_inode_dirty_sync(struct inode *inode) ...@@ -1211,6 +1211,14 @@ static inline void mark_inode_dirty_sync(struct inode *inode)
__mark_inode_dirty(inode, I_DIRTY_SYNC); __mark_inode_dirty(inode, I_DIRTY_SYNC);
} }
/**
* inc_nlink - directly increment an inode's link count
* @inode: inode
*
* This is a low-level filesystem helper to replace any
* direct filesystem manipulation of i_nlink. Currently,
* it is only here for parity with dec_nlink().
*/
static inline void inc_nlink(struct inode *inode) static inline void inc_nlink(struct inode *inode)
{ {
inode->i_nlink++; inode->i_nlink++;
...@@ -1222,11 +1230,30 @@ static inline void inode_inc_link_count(struct inode *inode) ...@@ -1222,11 +1230,30 @@ static inline void inode_inc_link_count(struct inode *inode)
mark_inode_dirty(inode); mark_inode_dirty(inode);
} }
/**
* drop_nlink - directly drop an inode's link count
* @inode: inode
*
* This is a low-level filesystem helper to replace any
* direct filesystem manipulation of i_nlink. In cases
* where we are attempting to track writes to the
* filesystem, a decrement to zero means an imminent
* write when the file is truncated and actually unlinked
* on the filesystem.
*/
static inline void drop_nlink(struct inode *inode) static inline void drop_nlink(struct inode *inode)
{ {
inode->i_nlink--; inode->i_nlink--;
} }
/**
* clear_nlink - directly zero an inode's link count
* @inode: inode
*
* This is a low-level filesystem helper to replace any
* direct filesystem manipulation of i_nlink. See
* drop_nlink() for why we care about i_nlink hitting zero.
*/
static inline void clear_nlink(struct inode *inode) static inline void clear_nlink(struct inode *inode)
{ {
inode->i_nlink = 0; inode->i_nlink = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment