Source
2086
2086
* of caution.
2087
2087
*
2088
2088
* In the long run, i_mutex is overkill, and we should probably look
2089
2089
* at using the i_lock spinlock to protect i_flags, and then make sure
2090
2090
* it is so documented in include/linux/fs.h and that all code follows
2091
2091
* the locking convention!!
2092
2092
*/
2093
2093
void inode_set_flags(struct inode *inode, unsigned int flags,
2094
2094
unsigned int mask)
2095
2095
{
2096
-
unsigned int old_flags, new_flags;
2097
-
2098
2096
WARN_ON_ONCE(flags & ~mask);
2099
-
do {
2100
-
old_flags = READ_ONCE(inode->i_flags);
2101
-
new_flags = (old_flags & ~mask) | flags;
2102
-
} while (unlikely(cmpxchg(&inode->i_flags, old_flags,
2103
-
new_flags) != old_flags));
2097
+
set_mask_bits(&inode->i_flags, mask, flags);
2104
2098
}
2105
2099
EXPORT_SYMBOL(inode_set_flags);
2106
2100
2107
2101
void inode_nohighmem(struct inode *inode)
2108
2102
{
2109
2103
mapping_set_gfp_mask(inode->i_mapping, GFP_USER);
2110
2104
}
2111
2105
EXPORT_SYMBOL(inode_nohighmem);
2112
2106
2113
2107
/**