From 24d75f2238f7539421473c94f4b8aaa8f01af9b7 Mon Sep 17 00:00:00 2001 From: Erez Zadok Date: Tue, 1 Jan 2008 22:02:28 -0500 Subject: [PATCH] Unionfs: use VFS helpers to manipulate i_nlink Signed-off-by: Erez Zadok --- fs/unionfs/compat.h | 10 ++++++++++ fs/unionfs/unlink.c | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/fs/unionfs/compat.h b/fs/unionfs/compat.h index 71ebb816a0f..3d93798f39b 100644 --- a/fs/unionfs/compat.h +++ b/fs/unionfs/compat.h @@ -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_ */ diff --git a/fs/unionfs/unlink.c b/fs/unionfs/unlink.c index a1c82b6d2d8..1e370a1f21d 100644 --- a/fs/unionfs/unlink.c +++ b/fs/unionfs/unlink.c @@ -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)) -- 2.43.0