2014-04-28 21:13:08

by Fabian Frédérick

[permalink] [raw]
Subject: [PATCH V3 2/2] fs/ext4/fsync.c: generic_file_fsync call based on barrier flag

generic_file_fsync has been updated to issue a flush for
older filesystems.

This patch tests for barrier flag in ext4 mount flags
and calls the right function.

Suggested-by: Jan Kara <[email protected]>
Suggested-by: Christoph Hellwig <[email protected]>
Cc: Jan Kara <[email protected]>
Cc: Christoph Hellwig <[email protected]>
Cc: Alexander Viro <[email protected]>
Cc: "Theodore Ts'o" <[email protected]>
Cc: Andrew Morton <[email protected]>
Signed-off-by: Fabian Frederick <[email protected]>
---
fs/ext4/fsync.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/fs/ext4/fsync.c b/fs/ext4/fsync.c
index a8bc47f..fa82c0a 100644
--- a/fs/ext4/fsync.c
+++ b/fs/ext4/fsync.c
@@ -108,6 +108,10 @@ int ext4_sync_file(struct file *file, loff_t start, loff_t end, int datasync)

if (!journal) {
ret = generic_file_fsync(file, start, end, datasync);
+ if (test_opt(inode->i_sb, BARRIER))
+ ret = generic_file_fsync(file, start, end, datasync);
+ else
+ ret = __generic_file_fsync(file, start, end, datasync);
if (!ret && !hlist_empty(&inode->i_dentry))
ret = ext4_sync_parent(inode);
goto out;
--
1.8.4.5


2014-04-29 16:19:51

by Jan Kara

[permalink] [raw]
Subject: Re: [PATCH V3 2/2] fs/ext4/fsync.c: generic_file_fsync call based on barrier flag

On Mon 28-04-14 23:15:08, Fabian Frederick wrote:
> generic_file_fsync has been updated to issue a flush for
> older filesystems.
>
> This patch tests for barrier flag in ext4 mount flags
> and calls the right function.
>
> Suggested-by: Jan Kara <[email protected]>
> Suggested-by: Christoph Hellwig <[email protected]>
> Cc: Jan Kara <[email protected]>
> Cc: Christoph Hellwig <[email protected]>
> Cc: Alexander Viro <[email protected]>
> Cc: "Theodore Ts'o" <[email protected]>
> Cc: Andrew Morton <[email protected]>
> Signed-off-by: Fabian Frederick <[email protected]>
The patch looks good. You can add:
Reviewed-by: Jan Kara <[email protected]>

Honza
> ---
> fs/ext4/fsync.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/fs/ext4/fsync.c b/fs/ext4/fsync.c
> index a8bc47f..fa82c0a 100644
> --- a/fs/ext4/fsync.c
> +++ b/fs/ext4/fsync.c
> @@ -108,6 +108,10 @@ int ext4_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
>
> if (!journal) {
> ret = generic_file_fsync(file, start, end, datasync);
> + if (test_opt(inode->i_sb, BARRIER))
> + ret = generic_file_fsync(file, start, end, datasync);
> + else
> + ret = __generic_file_fsync(file, start, end, datasync);
> if (!ret && !hlist_empty(&inode->i_dentry))
> ret = ext4_sync_parent(inode);
> goto out;
> --
> 1.8.4.5
>
--
Jan Kara <[email protected]>
SUSE Labs, CR