[Devel,vz7] fuse: no mtime flush on fdatasync

Submitted by Maxim Patlasov on Dec. 1, 2016, 10:40 p.m.

Details

Message ID 148063192535.7664.5600617157124824473.stgit@maxim-thinkpad
State New
Series "fuse: no mtime flush on fdatasync"
Headers show

Commit Message

Maxim Patlasov Dec. 1, 2016, 10:40 p.m.
fuse_fsync_common() may skip fuse_flush_mtime() if datasync=1 because
mtime is pure metadata and the content of file doesn't depend on it.

https://jira.sw.ru/browse/PSBM-55919

Signed-off-by: Maxim Patlasov <mpatlasov@virtuozzo.com>
---
 fs/fuse/file.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 559dfd9..e5c4778 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -684,8 +684,8 @@  int fuse_fsync_common(struct file *file, loff_t start, loff_t end,
 	if (err)
 		goto out;
 
-	if (test_bit(FUSE_I_MTIME_UPDATED,
-		     &get_fuse_inode(inode)->state)) {
+	if (!datasync && test_bit(FUSE_I_MTIME_UPDATED,
+				  &get_fuse_inode(inode)->state)) {
 		err = fuse_flush_mtime(file, false);
 		if (err)
 			goto out;

Comments

Dmitry Monakhov Dec. 2, 2016, 2:09 p.m.
Maxim Patlasov <mpatlasov@virtuozzo.com> writes:

> fuse_fsync_common() may skip fuse_flush_mtime() if datasync=1 because
> mtime is pure metadata and the content of file doesn't depend on it.
>
> https://jira.sw.ru/browse/PSBM-55919
>
> Signed-off-by: Maxim Patlasov <mpatlasov@virtuozzo.com>
ACK.
> ---
>  fs/fuse/file.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/fuse/file.c b/fs/fuse/file.c
> index 559dfd9..e5c4778 100644
> --- a/fs/fuse/file.c
> +++ b/fs/fuse/file.c
> @@ -684,8 +684,8 @@ int fuse_fsync_common(struct file *file, loff_t start, loff_t end,
>  	if (err)
>  		goto out;
>  
> -	if (test_bit(FUSE_I_MTIME_UPDATED,
> -		     &get_fuse_inode(inode)->state)) {
> +	if (!datasync && test_bit(FUSE_I_MTIME_UPDATED,
> +				  &get_fuse_inode(inode)->state)) {
>  		err = fuse_flush_mtime(file, false);
>  		if (err)
>  			goto out;