linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ext4: respect the nobarrier mount option in nojournal mode
@ 2016-06-08  2:47 Theodore Ts'o
  2016-06-08  3:23 ` Eric Sandeen
  0 siblings, 1 reply; 4+ messages in thread
From: Theodore Ts'o @ 2016-06-08  2:47 UTC (permalink / raw)
  To: Ext4 Developers List; +Cc: Theodore Ts'o

Also, if we are going to issue the barrier, we should do this after we
write out the parent directories if necessary.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
 fs/ext4/fsync.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/fs/ext4/fsync.c b/fs/ext4/fsync.c
index 8850254..011863e 100644
--- a/fs/ext4/fsync.c
+++ b/fs/ext4/fsync.c
@@ -106,9 +106,11 @@ 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);
+		ret = __generic_file_fsync(file, start, end, datasync);
 		if (!ret && !hlist_empty(&inode->i_dentry))
 			ret = ext4_sync_parent(inode);
+		if (journal->j_flags & JBD2_BARRIER)
+			goto issue_flush;
 		goto out;
 	}
 
@@ -140,6 +142,7 @@ int ext4_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
 		needs_barrier = true;
 	ret = jbd2_complete_transaction(journal, commit_tid);
 	if (needs_barrier) {
+	issue_flush:
 		err = blkdev_issue_flush(inode->i_sb->s_bdev, GFP_KERNEL, NULL);
 		if (!ret)
 			ret = err;
-- 
2.5.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] ext4: respect the nobarrier mount option in nojournal mode
  2016-06-08  2:47 [PATCH] ext4: respect the nobarrier mount option in nojournal mode Theodore Ts'o
@ 2016-06-08  3:23 ` Eric Sandeen
  2016-06-10 18:44   ` [PATCH -v2] " Theodore Ts'o
  0 siblings, 1 reply; 4+ messages in thread
From: Eric Sandeen @ 2016-06-08  3:23 UTC (permalink / raw)
  To: Theodore Ts'o, Ext4 Developers List

On 6/7/16 9:47 PM, Theodore Ts'o wrote:
> Also, if we are going to issue the barrier, we should do this after we
> write out the parent directories if necessary.
> 
> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
> ---
>  fs/ext4/fsync.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/ext4/fsync.c b/fs/ext4/fsync.c
> index 8850254..011863e 100644
> --- a/fs/ext4/fsync.c
> +++ b/fs/ext4/fsync.c
> @@ -106,9 +106,11 @@ 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);
> +		ret = __generic_file_fsync(file, start, end, datasync);
>  		if (!ret && !hlist_empty(&inode->i_dentry))
>  			ret = ext4_sync_parent(inode);
> +		if (journal->j_flags & JBD2_BARRIER)
> +			goto issue_flush;

So in the "if (!journal)" case you test journal->j_flags?

Confused...

-Eric

>  		goto out;
>  	}
>  
> @@ -140,6 +142,7 @@ int ext4_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
>  		needs_barrier = true;
>  	ret = jbd2_complete_transaction(journal, commit_tid);
>  	if (needs_barrier) {
> +	issue_flush:
>  		err = blkdev_issue_flush(inode->i_sb->s_bdev, GFP_KERNEL, NULL);
>  		if (!ret)
>  			ret = err;
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH -v2] ext4: respect the nobarrier mount option in nojournal mode
  2016-06-08  3:23 ` Eric Sandeen
@ 2016-06-10 18:44   ` Theodore Ts'o
  2016-06-16 18:07     ` Jan Kara
  0 siblings, 1 reply; 4+ messages in thread
From: Theodore Ts'o @ 2016-06-10 18:44 UTC (permalink / raw)
  To: Ext4 Developers List; +Cc: Theodore Ts'o

Also, if we are going to issue the barrier, we should do this after we
write out the parent directories if necessary.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
 fs/ext4/fsync.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/fs/ext4/fsync.c b/fs/ext4/fsync.c
index 8850254..5c43725 100644
--- a/fs/ext4/fsync.c
+++ b/fs/ext4/fsync.c
@@ -106,9 +106,11 @@ 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);
+		ret = __generic_file_fsync(file, start, end, datasync);
 		if (!ret && !hlist_empty(&inode->i_dentry))
 			ret = ext4_sync_parent(inode);
+		if (test_opt(inode->i_sb, BARRIER))
+			goto issue_flush;
 		goto out;
 	}
 
@@ -140,6 +142,7 @@ int ext4_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
 		needs_barrier = true;
 	ret = jbd2_complete_transaction(journal, commit_tid);
 	if (needs_barrier) {
+	issue_flush:
 		err = blkdev_issue_flush(inode->i_sb->s_bdev, GFP_KERNEL, NULL);
 		if (!ret)
 			ret = err;
-- 
2.5.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH -v2] ext4: respect the nobarrier mount option in nojournal mode
  2016-06-10 18:44   ` [PATCH -v2] " Theodore Ts'o
@ 2016-06-16 18:07     ` Jan Kara
  0 siblings, 0 replies; 4+ messages in thread
From: Jan Kara @ 2016-06-16 18:07 UTC (permalink / raw)
  To: Theodore Ts'o; +Cc: Ext4 Developers List

On Fri 10-06-16 14:44:50, Ted Tso wrote:
> Also, if we are going to issue the barrier, we should do this after we
> write out the parent directories if necessary.
> 
> Signed-off-by: Theodore Ts'o <tytso@mit.edu>

The patch looks good. You can add:

Reviewed-by: Jan Kara <jack@suse.cz>

								Honza

> ---
>  fs/ext4/fsync.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/ext4/fsync.c b/fs/ext4/fsync.c
> index 8850254..5c43725 100644
> --- a/fs/ext4/fsync.c
> +++ b/fs/ext4/fsync.c
> @@ -106,9 +106,11 @@ 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);
> +		ret = __generic_file_fsync(file, start, end, datasync);
>  		if (!ret && !hlist_empty(&inode->i_dentry))
>  			ret = ext4_sync_parent(inode);
> +		if (test_opt(inode->i_sb, BARRIER))
> +			goto issue_flush;
>  		goto out;
>  	}
>  
> @@ -140,6 +142,7 @@ int ext4_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
>  		needs_barrier = true;
>  	ret = jbd2_complete_transaction(journal, commit_tid);
>  	if (needs_barrier) {
> +	issue_flush:
>  		err = blkdev_issue_flush(inode->i_sb->s_bdev, GFP_KERNEL, NULL);
>  		if (!ret)
>  			ret = err;
> -- 
> 2.5.0
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-06-16 18:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-08  2:47 [PATCH] ext4: respect the nobarrier mount option in nojournal mode Theodore Ts'o
2016-06-08  3:23 ` Eric Sandeen
2016-06-10 18:44   ` [PATCH -v2] " Theodore Ts'o
2016-06-16 18:07     ` Jan Kara

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).