Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/hch/vfs-queue
* 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/hch/vfs-queue: vfs: add d_prune dentry operation vfs: protect i_nlink filesystems: add set_nlink() filesystems: add missing nlink wrappers logfs: remove unnecessary nlink setting ocfs2: remove unnecessary nlink setting jfs: remove unnecessary nlink setting hypfs: remove unnecessary nlink setting vfs: ignore error on forced remount readlinkat: ensure we return ENOENT for the empty pathname for normal lookups vfs: fix dentry leak in simple_fill_super()
This commit is contained in:
@ -768,7 +768,17 @@ struct inode {
|
||||
|
||||
/* Stat data, not accessed from path walking */
|
||||
unsigned long i_ino;
|
||||
unsigned int i_nlink;
|
||||
/*
|
||||
* Filesystems may only read i_nlink directly. They shall use the
|
||||
* following functions for modification:
|
||||
*
|
||||
* (set|clear|inc|drop)_nlink
|
||||
* inode_(inc|dec)_link_count
|
||||
*/
|
||||
union {
|
||||
const unsigned int i_nlink;
|
||||
unsigned int __i_nlink;
|
||||
};
|
||||
dev_t i_rdev;
|
||||
struct timespec i_atime;
|
||||
struct timespec i_mtime;
|
||||
@ -1754,6 +1764,19 @@ static inline void mark_inode_dirty_sync(struct inode *inode)
|
||||
__mark_inode_dirty(inode, I_DIRTY_SYNC);
|
||||
}
|
||||
|
||||
/**
|
||||
* set_nlink - directly set an inode's link count
|
||||
* @inode: inode
|
||||
* @nlink: new nlink (should be non-zero)
|
||||
*
|
||||
* This is a low-level filesystem helper to replace any
|
||||
* direct filesystem manipulation of i_nlink.
|
||||
*/
|
||||
static inline void set_nlink(struct inode *inode, unsigned int nlink)
|
||||
{
|
||||
inode->__i_nlink = nlink;
|
||||
}
|
||||
|
||||
/**
|
||||
* inc_nlink - directly increment an inode's link count
|
||||
* @inode: inode
|
||||
@ -1764,7 +1787,7 @@ static inline void mark_inode_dirty_sync(struct inode *inode)
|
||||
*/
|
||||
static inline void inc_nlink(struct inode *inode)
|
||||
{
|
||||
inode->i_nlink++;
|
||||
inode->__i_nlink++;
|
||||
}
|
||||
|
||||
static inline void inode_inc_link_count(struct inode *inode)
|
||||
@ -1786,7 +1809,7 @@ static inline void inode_inc_link_count(struct inode *inode)
|
||||
*/
|
||||
static inline void drop_nlink(struct inode *inode)
|
||||
{
|
||||
inode->i_nlink--;
|
||||
inode->__i_nlink--;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1799,7 +1822,7 @@ static inline void drop_nlink(struct inode *inode)
|
||||
*/
|
||||
static inline void clear_nlink(struct inode *inode)
|
||||
{
|
||||
inode->i_nlink = 0;
|
||||
inode->__i_nlink = 0;
|
||||
}
|
||||
|
||||
static inline void inode_dec_link_count(struct inode *inode)
|
||||
|
Reference in New Issue
Block a user