diff options
-rw-r--r-- | fs/inode.c | 2 | ||||
-rw-r--r-- | include/linux/fs.h | 20 |
2 files changed, 16 insertions, 6 deletions
diff --git a/fs/inode.c b/fs/inode.c index ecbb68dc7e2a..ee4e66b998f4 100644 --- a/fs/inode.c +++ b/fs/inode.c | |||
@@ -142,7 +142,7 @@ int inode_init_always(struct super_block *sb, struct inode *inode) | |||
142 | atomic_set(&inode->i_count, 1); | 142 | atomic_set(&inode->i_count, 1); |
143 | inode->i_op = &empty_iops; | 143 | inode->i_op = &empty_iops; |
144 | inode->i_fop = &empty_fops; | 144 | inode->i_fop = &empty_fops; |
145 | inode->i_nlink = 1; | 145 | inode->__i_nlink = 1; |
146 | inode->i_opflags = 0; | 146 | inode->i_opflags = 0; |
147 | inode->i_uid = 0; | 147 | inode->i_uid = 0; |
148 | inode->i_gid = 0; | 148 | inode->i_gid = 0; |
diff --git a/include/linux/fs.h b/include/linux/fs.h index 48c1f5fc7411..23467d768cab 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -768,7 +768,17 @@ struct inode { | |||
768 | 768 | ||
769 | /* Stat data, not accessed from path walking */ | 769 | /* Stat data, not accessed from path walking */ |
770 | unsigned long i_ino; | 770 | unsigned long i_ino; |
771 | unsigned int i_nlink; | 771 | /* |
772 | * Filesystems may only read i_nlink directly. They shall use the | ||
773 | * following functions for modification: | ||
774 | * | ||
775 | * (set|clear|inc|drop)_nlink | ||
776 | * inode_(inc|dec)_link_count | ||
777 | */ | ||
778 | union { | ||
779 | const unsigned int i_nlink; | ||
780 | unsigned int __i_nlink; | ||
781 | }; | ||
772 | dev_t i_rdev; | 782 | dev_t i_rdev; |
773 | loff_t i_size; | 783 | loff_t i_size; |
774 | struct timespec i_atime; | 784 | struct timespec i_atime; |
@@ -1764,7 +1774,7 @@ static inline void mark_inode_dirty_sync(struct inode *inode) | |||
1764 | */ | 1774 | */ |
1765 | static inline void set_nlink(struct inode *inode, unsigned int nlink) | 1775 | static inline void set_nlink(struct inode *inode, unsigned int nlink) |
1766 | { | 1776 | { |
1767 | inode->i_nlink = nlink; | 1777 | inode->__i_nlink = nlink; |
1768 | } | 1778 | } |
1769 | 1779 | ||
1770 | /** | 1780 | /** |
@@ -1777,7 +1787,7 @@ static inline void set_nlink(struct inode *inode, unsigned int nlink) | |||
1777 | */ | 1787 | */ |
1778 | static inline void inc_nlink(struct inode *inode) | 1788 | static inline void inc_nlink(struct inode *inode) |
1779 | { | 1789 | { |
1780 | inode->i_nlink++; | 1790 | inode->__i_nlink++; |
1781 | } | 1791 | } |
1782 | 1792 | ||
1783 | static inline void inode_inc_link_count(struct inode *inode) | 1793 | static inline void inode_inc_link_count(struct inode *inode) |
@@ -1799,7 +1809,7 @@ static inline void inode_inc_link_count(struct inode *inode) | |||
1799 | */ | 1809 | */ |
1800 | static inline void drop_nlink(struct inode *inode) | 1810 | static inline void drop_nlink(struct inode *inode) |
1801 | { | 1811 | { |
1802 | inode->i_nlink--; | 1812 | inode->__i_nlink--; |
1803 | } | 1813 | } |
1804 | 1814 | ||
1805 | /** | 1815 | /** |
@@ -1812,7 +1822,7 @@ static inline void drop_nlink(struct inode *inode) | |||
1812 | */ | 1822 | */ |
1813 | static inline void clear_nlink(struct inode *inode) | 1823 | static inline void clear_nlink(struct inode *inode) |
1814 | { | 1824 | { |
1815 | inode->i_nlink = 0; | 1825 | inode->__i_nlink = 0; |
1816 | } | 1826 | } |
1817 | 1827 | ||
1818 | static inline void inode_dec_link_count(struct inode *inode) | 1828 | static inline void inode_dec_link_count(struct inode *inode) |