return ofs == XATTR_NODE_OFFSET;
}
+static inline void f2fs_i_blocks_write(struct inode *, blkcnt_t, bool);
static inline bool inc_valid_block_count(struct f2fs_sb_info *sbi,
struct inode *inode, blkcnt_t *count)
{
}
}
/* *count can be recalculated */
- inode->i_blocks += *count;
+ f2fs_i_blocks_write(inode, *count, true);
sbi->total_valid_block_count =
sbi->total_valid_block_count + (block_t)(*count);
spin_unlock(&sbi->stat_lock);
spin_lock(&sbi->stat_lock);
f2fs_bug_on(sbi, sbi->total_valid_block_count < (block_t) count);
f2fs_bug_on(sbi, inode->i_blocks < count);
- inode->i_blocks -= count;
+ f2fs_i_blocks_write(inode, count, false);
sbi->total_valid_block_count -= (block_t)count;
spin_unlock(&sbi->stat_lock);
}
}
if (inode)
- inode->i_blocks++;
+ f2fs_i_blocks_write(inode, 1, true);
sbi->total_valid_node_count++;
sbi->total_valid_block_count++;
f2fs_bug_on(sbi, !sbi->total_valid_node_count);
f2fs_bug_on(sbi, !inode->i_blocks);
- inode->i_blocks--;
+ f2fs_i_blocks_write(inode, 1, false);
sbi->total_valid_node_count--;
sbi->total_valid_block_count--;
set_inode_flag(inode, FI_ACL_MODE);
}
+static inline void f2fs_i_blocks_write(struct inode *inode,
+ blkcnt_t diff, bool add)
+{
+ inode->i_blocks = add ? inode->i_blocks + diff :
+ inode->i_blocks - diff;
+ mark_inode_dirty_sync(inode);
+}
+
static inline void f2fs_i_size_write(struct inode *inode, loff_t i_size)
{
if (i_size_read(inode) == i_size)