summaryrefslogtreecommitdiffstats
path: root/fs/f2fs/file.c
diff options
context:
space:
mode:
authorChao Yu <yuchao0@huawei.com>2017-01-07 11:50:26 +0100
committerJaegeuk Kim <jaegeuk@kernel.org>2017-02-23 03:48:48 +0100
commit5fe457430e554a2f5188f13c1a2e36ad845640c5 (patch)
treeb20d30d298e89235c3d55fe3a1ef7835d834bcd5 /fs/f2fs/file.c
parentf2fs: clean up with list_{first, last}_entry (diff)
downloadlinux-5fe457430e554a2f5188f13c1a2e36ad845640c5.tar.xz
linux-5fe457430e554a2f5188f13c1a2e36ad845640c5.zip
f2fs: introduce FI_ATOMIC_COMMIT
This patch introduces a new flag to indicate inode status of doing atomic write committing, so that, we can keep atomic write status for inode during atomic committing, then we can skip GCing pages of atomic write inode, that avoids random GCed datas being mixed with current transaction, so isolation of transaction can be kept. Signed-off-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/file.c')
-rw-r--r--fs/f2fs/file.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index 6c335180b9d8..e45522115b1c 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -1569,14 +1569,15 @@ static int f2fs_ioc_commit_atomic_write(struct file *filp)
goto err_out;
if (f2fs_is_atomic_file(inode)) {
- clear_inode_flag(inode, FI_ATOMIC_FILE);
ret = commit_inmem_pages(inode);
- if (ret) {
- set_inode_flag(inode, FI_ATOMIC_FILE);
+ if (ret)
goto err_out;
- }
+
ret = f2fs_do_sync_file(filp, 0, LLONG_MAX, 0, true);
- stat_dec_atomic_write(inode);
+ if (!ret) {
+ clear_inode_flag(inode, FI_ATOMIC_FILE);
+ stat_dec_atomic_write(inode);
+ }
} else {
ret = f2fs_do_sync_file(filp, 0, LLONG_MAX, 0, true);
}