aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/fs.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/fs.h')
-rw-r--r--include/linux/fs.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h
index b3ae77cccbb6..6a41f4cab14c 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1211,6 +1211,14 @@ static inline void mark_inode_dirty_sync(struct inode *inode)
1211 __mark_inode_dirty(inode, I_DIRTY_SYNC); 1211 __mark_inode_dirty(inode, I_DIRTY_SYNC);
1212} 1212}
1213 1213
1214/**
1215 * inc_nlink - directly increment an inode's link count
1216 * @inode: inode
1217 *
1218 * This is a low-level filesystem helper to replace any
1219 * direct filesystem manipulation of i_nlink. Currently,
1220 * it is only here for parity with dec_nlink().
1221 */
1214static inline void inc_nlink(struct inode *inode) 1222static inline void inc_nlink(struct inode *inode)
1215{ 1223{
1216 inode->i_nlink++; 1224 inode->i_nlink++;
@@ -1222,11 +1230,30 @@ static inline void inode_inc_link_count(struct inode *inode)
1222 mark_inode_dirty(inode); 1230 mark_inode_dirty(inode);
1223} 1231}
1224 1232
1233/**
1234 * drop_nlink - directly drop an inode's link count
1235 * @inode: inode
1236 *
1237 * This is a low-level filesystem helper to replace any
1238 * direct filesystem manipulation of i_nlink. In cases
1239 * where we are attempting to track writes to the
1240 * filesystem, a decrement to zero means an imminent
1241 * write when the file is truncated and actually unlinked
1242 * on the filesystem.
1243 */
1225static inline void drop_nlink(struct inode *inode) 1244static inline void drop_nlink(struct inode *inode)
1226{ 1245{
1227 inode->i_nlink--; 1246 inode->i_nlink--;
1228} 1247}
1229 1248
1249/**
1250 * clear_nlink - directly zero an inode's link count
1251 * @inode: inode
1252 *
1253 * This is a low-level filesystem helper to replace any
1254 * direct filesystem manipulation of i_nlink. See
1255 * drop_nlink() for why we care about i_nlink hitting zero.
1256 */
1230static inline void clear_nlink(struct inode *inode) 1257static inline void clear_nlink(struct inode *inode)
1231{ 1258{
1232 inode->i_nlink = 0; 1259 inode->i_nlink = 0;