mirror of
https://github.com/torvalds/linux.git
synced 2024-11-23 12:42:02 +00:00
f2fs: add fsync_mode=nobarrier for non-atomic files
For non-atomic files, this patch adds an option to give nobarrier which doesn't issue flush commands to the device. Reviewed-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
parent
9a997188ff
commit
d6290814b0
@ -182,13 +182,15 @@ whint_mode=%s Control which write hints are passed down to block
|
|||||||
passes down hints with its policy.
|
passes down hints with its policy.
|
||||||
alloc_mode=%s Adjust block allocation policy, which supports "reuse"
|
alloc_mode=%s Adjust block allocation policy, which supports "reuse"
|
||||||
and "default".
|
and "default".
|
||||||
fsync_mode=%s Control the policy of fsync. Currently supports "posix"
|
fsync_mode=%s Control the policy of fsync. Currently supports "posix",
|
||||||
and "strict". In "posix" mode, which is default, fsync
|
"strict", and "nobarrier". In "posix" mode, which is
|
||||||
will follow POSIX semantics and does a light operation
|
default, fsync will follow POSIX semantics and does a
|
||||||
to improve the filesystem performance. In "strict" mode,
|
light operation to improve the filesystem performance.
|
||||||
fsync will be heavy and behaves in line with xfs, ext4
|
In "strict" mode, fsync will be heavy and behaves in line
|
||||||
and btrfs, where xfstest generic/342 will pass, but the
|
with xfs, ext4 and btrfs, where xfstest generic/342 will
|
||||||
performance will regress.
|
pass, but the performance will regress. "nobarrier" is
|
||||||
|
based on "posix", but doesn't issue flush command for
|
||||||
|
non-atomic files likewise "nobarrier" mount option.
|
||||||
test_dummy_encryption Enable dummy encryption, which provides a fake fscrypt
|
test_dummy_encryption Enable dummy encryption, which provides a fake fscrypt
|
||||||
context. The fake fscrypt context is used by xfstests.
|
context. The fake fscrypt context is used by xfstests.
|
||||||
|
|
||||||
|
@ -1082,6 +1082,7 @@ enum {
|
|||||||
enum fsync_mode {
|
enum fsync_mode {
|
||||||
FSYNC_MODE_POSIX, /* fsync follows posix semantics */
|
FSYNC_MODE_POSIX, /* fsync follows posix semantics */
|
||||||
FSYNC_MODE_STRICT, /* fsync behaves in line with ext4 */
|
FSYNC_MODE_STRICT, /* fsync behaves in line with ext4 */
|
||||||
|
FSYNC_MODE_NOBARRIER, /* fsync behaves nobarrier based on posix */
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef CONFIG_F2FS_FS_ENCRYPTION
|
#ifdef CONFIG_F2FS_FS_ENCRYPTION
|
||||||
|
@ -306,7 +306,7 @@ sync_nodes:
|
|||||||
remove_ino_entry(sbi, ino, APPEND_INO);
|
remove_ino_entry(sbi, ino, APPEND_INO);
|
||||||
clear_inode_flag(inode, FI_APPEND_WRITE);
|
clear_inode_flag(inode, FI_APPEND_WRITE);
|
||||||
flush_out:
|
flush_out:
|
||||||
if (!atomic)
|
if (!atomic && F2FS_OPTION(sbi).fsync_mode != FSYNC_MODE_NOBARRIER)
|
||||||
ret = f2fs_issue_flush(sbi, inode->i_ino);
|
ret = f2fs_issue_flush(sbi, inode->i_ino);
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
remove_ino_entry(sbi, ino, UPDATE_INO);
|
remove_ino_entry(sbi, ino, UPDATE_INO);
|
||||||
|
@ -740,6 +740,10 @@ static int parse_options(struct super_block *sb, char *options)
|
|||||||
} else if (strlen(name) == 6 &&
|
} else if (strlen(name) == 6 &&
|
||||||
!strncmp(name, "strict", 6)) {
|
!strncmp(name, "strict", 6)) {
|
||||||
F2FS_OPTION(sbi).fsync_mode = FSYNC_MODE_STRICT;
|
F2FS_OPTION(sbi).fsync_mode = FSYNC_MODE_STRICT;
|
||||||
|
} else if (strlen(name) == 9 &&
|
||||||
|
!strncmp(name, "nobarrier", 9)) {
|
||||||
|
F2FS_OPTION(sbi).fsync_mode =
|
||||||
|
FSYNC_MODE_NOBARRIER;
|
||||||
} else {
|
} else {
|
||||||
kfree(name);
|
kfree(name);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
Loading…
Reference in New Issue
Block a user