|
@@ -1686,24 +1686,20 @@ static int f2fs_ioc_start_atomic_write(struct file *filp)
|
|
|
if (ret)
|
|
|
goto out;
|
|
|
|
|
|
- set_inode_flag(inode, FI_ATOMIC_FILE);
|
|
|
- set_inode_flag(inode, FI_HOT_DATA);
|
|
|
- f2fs_update_time(F2FS_I_SB(inode), REQ_TIME);
|
|
|
-
|
|
|
if (!get_dirty_pages(inode))
|
|
|
- goto inc_stat;
|
|
|
+ goto skip_flush;
|
|
|
|
|
|
f2fs_msg(F2FS_I_SB(inode)->sb, KERN_WARNING,
|
|
|
"Unexpected flush for atomic writes: ino=%lu, npages=%u",
|
|
|
inode->i_ino, get_dirty_pages(inode));
|
|
|
ret = filemap_write_and_wait_range(inode->i_mapping, 0, LLONG_MAX);
|
|
|
- if (ret) {
|
|
|
- clear_inode_flag(inode, FI_ATOMIC_FILE);
|
|
|
- clear_inode_flag(inode, FI_HOT_DATA);
|
|
|
+ if (ret)
|
|
|
goto out;
|
|
|
- }
|
|
|
+skip_flush:
|
|
|
+ set_inode_flag(inode, FI_HOT_DATA);
|
|
|
+ set_inode_flag(inode, FI_ATOMIC_FILE);
|
|
|
+ f2fs_update_time(F2FS_I_SB(inode), REQ_TIME);
|
|
|
|
|
|
-inc_stat:
|
|
|
F2FS_I(inode)->inmem_task = current;
|
|
|
stat_inc_atomic_write(inode);
|
|
|
stat_update_max_atomic_write(inode);
|