提交 61e0f2d0 编写于 作者: J Jaegeuk Kim

f2fs: test before set/clear bits

If the bit is already set, we don't need to reset it, and vice versa.
Because we don't need to make the caches dirty for that.
Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
上级 01229f5e
......@@ -1003,7 +1003,8 @@ enum {
static inline void set_inode_flag(struct f2fs_inode_info *fi, int flag)
{
set_bit(flag, &fi->flags);
if (!test_bit(flag, &fi->flags))
set_bit(flag, &fi->flags);
}
static inline int is_inode_flag_set(struct f2fs_inode_info *fi, int flag)
......@@ -1013,7 +1014,8 @@ static inline int is_inode_flag_set(struct f2fs_inode_info *fi, int flag)
static inline void clear_inode_flag(struct f2fs_inode_info *fi, int flag)
{
clear_bit(flag, &fi->flags);
if (test_bit(flag, &fi->flags))
clear_bit(flag, &fi->flags);
}
static inline void set_acl_inode(struct f2fs_inode_info *fi, umode_t mode)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册