Unionfs: use VFS helpers to manipulate i_nlink
authorErez Zadok <ezk@cs.sunysb.edu>
Wed, 2 Jan 2008 03:02:28 +0000 (22:02 -0500)
committerErez Zadok <ezk@cs.sunysb.edu>
Wed, 2 Jan 2008 03:02:28 +0000 (22:02 -0500)
Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
fs/unionfs/compat.h
fs/unionfs/unlink.c

index 71ebb816a0faead4425d27fbfbcee8b04f194904..3d93798f39bee9be7dd761d804fce078d8515d54 100644 (file)
@@ -94,4 +94,14 @@ static inline loff_t page_offset(struct page *page)
        return ((loff_t)page->index) << PAGE_CACHE_SHIFT;
 }
 
+/* from include/linux/fs.h on 2.6.18+ */
+static inline void drop_nlink(struct inode *inode)
+{
+       inode->i_nlink--;
+}
+static inline void inode_dec_link_count(struct inode *inode)
+{
+       drop_nlink(inode);
+       mark_inode_dirty(inode);
+}
 #endif /* _UNIONFS_COMPAT_H_ */
index a1c82b6d2d8e08d0e25dfe1f52409ee2193a801e..1e370a1f21d3806412e63dc514e317b57f538857 100644 (file)
@@ -79,7 +79,7 @@ static int unionfs_unlink_whiteout(struct inode *dir, struct dentry *dentry)
 
 out:
        if (!err)
-               dentry->d_inode->i_nlink--;
+               inode_dec_link_count(dentry->d_inode);
 
        /* We don't want to leave negative leftover dentries for revalidate. */
        if (!err && (dbopaque(dentry) != -1))