linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ext4: Ensure writecache to disk in no journal mode
@ 2010-03-26 16:21 Surbhi Palande
  2010-03-26 16:37 ` Dmitry Monakhov
  0 siblings, 1 reply; 4+ messages in thread
From: Surbhi Palande @ 2010-03-26 16:21 UTC (permalink / raw)
  To: linux-ext4; +Cc: Theodore Tso

Ensure that in the no journal mode the write cache is flushed to the disk by
calling a blkdev_issue_flush() which issues a WRITE_BARRIER if necessary.

Signed-off-by: Surbhi Palande <surbhi.palande@canonical.com>
---
 fs/ext4/fsync.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/fs/ext4/fsync.c b/fs/ext4/fsync.c
index d6049e4..1d73a50 100644
--- a/fs/ext4/fsync.c
+++ b/fs/ext4/fsync.c
@@ -67,8 +67,12 @@ int ext4_sync_file(struct file *file, struct dentry *dentry, int datasync)
 	if (ret < 0)
 		return ret;
 
-	if (!journal)
-		return simple_fsync(file, dentry, datasync);
+	if (!journal) {
+		ret = simple_fsync(file, dentry, datasync);
+		if (test_opt(inode->i_sb, BARRIER))
+			blkdev_issue_flush(inode->i_sb->s_bdev, NULL);
+		return ret;
+	}
 
 	/*
 	 * data=writeback,ordered:
-- 
1.6.3.3


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

* Re: [PATCH] ext4: Ensure writecache to disk in no journal mode
  2010-03-26 16:21 [PATCH] ext4: Ensure writecache to disk in no journal mode Surbhi Palande
@ 2010-03-26 16:37 ` Dmitry Monakhov
  2010-03-26 17:16   ` Ric Wheeler
  0 siblings, 1 reply; 4+ messages in thread
From: Dmitry Monakhov @ 2010-03-26 16:37 UTC (permalink / raw)
  To: Surbhi Palande; +Cc: linux-ext4, Theodore Tso

Surbhi Palande <surbhi.palande@canonical.com> writes:

> Ensure that in the no journal mode the write cache is flushed to the disk by
> calling a blkdev_issue_flush() which issues a WRITE_BARRIER if necessary.
As soon as i understand, nojournal mode is assumed to be used for
fail-free block devices(raid + UPS). So we don't have to worry about
blkdev's wcache vs persistent storage correctness.
>
> Signed-off-by: Surbhi Palande <surbhi.palande@canonical.com>
> ---
>  fs/ext4/fsync.c |    8 ++++++--
>  1 files changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/fs/ext4/fsync.c b/fs/ext4/fsync.c
> index d6049e4..1d73a50 100644
> --- a/fs/ext4/fsync.c
> +++ b/fs/ext4/fsync.c
> @@ -67,8 +67,12 @@ int ext4_sync_file(struct file *file, struct dentry *dentry, int datasync)
>  	if (ret < 0)
>  		return ret;
>  
> -	if (!journal)
> -		return simple_fsync(file, dentry, datasync);
> +	if (!journal) {
> +		ret = simple_fsync(file, dentry, datasync);
> +		if (test_opt(inode->i_sb, BARRIER))
> +			blkdev_issue_flush(inode->i_sb->s_bdev, NULL);
> +		return ret;
> +	}
>  
>  	/*
>  	 * data=writeback,ordered:

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

* Re: [PATCH] ext4: Ensure writecache to disk in no journal mode
  2010-03-26 16:37 ` Dmitry Monakhov
@ 2010-03-26 17:16   ` Ric Wheeler
  2010-03-26 17:40     ` Eric Sandeen
  0 siblings, 1 reply; 4+ messages in thread
From: Ric Wheeler @ 2010-03-26 17:16 UTC (permalink / raw)
  To: Dmitry Monakhov; +Cc: Surbhi Palande, linux-ext4, Theodore Tso

On 03/26/2010 12:37 PM, Dmitry Monakhov wrote:
> Surbhi Palande<surbhi.palande@canonical.com>  writes:
>
>    
>> Ensure that in the no journal mode the write cache is flushed to the disk by
>> calling a blkdev_issue_flush() which issues a WRITE_BARRIER if necessary.
>>      
> As soon as i understand, nojournal mode is assumed to be used for
> fail-free block devices(raid + UPS). So we don't have to worry about
> blkdev's wcache vs persistent storage correctness.
>    

I don't think that is a safe assumption. If users want that behavior, 
they can mount with fs without barriers...

ric

>> Signed-off-by: Surbhi Palande<surbhi.palande@canonical.com>
>> ---
>>   fs/ext4/fsync.c |    8 ++++++--
>>   1 files changed, 6 insertions(+), 2 deletions(-)
>>
>> diff --git a/fs/ext4/fsync.c b/fs/ext4/fsync.c
>> index d6049e4..1d73a50 100644
>> --- a/fs/ext4/fsync.c
>> +++ b/fs/ext4/fsync.c
>> @@ -67,8 +67,12 @@ int ext4_sync_file(struct file *file, struct dentry *dentry, int datasync)
>>   	if (ret<  0)
>>   		return ret;
>>
>> -	if (!journal)
>> -		return simple_fsync(file, dentry, datasync);
>> +	if (!journal) {
>> +		ret = simple_fsync(file, dentry, datasync);
>> +		if (test_opt(inode->i_sb, BARRIER))
>> +			blkdev_issue_flush(inode->i_sb->s_bdev, NULL);
>> +		return ret;
>> +	}
>>
>>   	/*
>>   	 * data=writeback,ordered:
>>      
> --
> 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
>    


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

* Re: [PATCH] ext4: Ensure writecache to disk in no journal mode
  2010-03-26 17:16   ` Ric Wheeler
@ 2010-03-26 17:40     ` Eric Sandeen
  0 siblings, 0 replies; 4+ messages in thread
From: Eric Sandeen @ 2010-03-26 17:40 UTC (permalink / raw)
  To: Ric Wheeler; +Cc: Dmitry Monakhov, Surbhi Palande, linux-ext4, Theodore Tso

On 03/26/2010 12:16 PM, Ric Wheeler wrote:
> On 03/26/2010 12:37 PM, Dmitry Monakhov wrote:
>> Surbhi Palande<surbhi.palande@canonical.com>  writes:
>>
>>    
>>> Ensure that in the no journal mode the write cache is flushed to the disk by
>>> calling a blkdev_issue_flush() which issues a WRITE_BARRIER if necessary.
>>>      
>> As soon as i understand, nojournal mode is assumed to be used for
>> fail-free block devices(raid + UPS). So we don't have to worry about
>> blkdev's wcache vs persistent storage correctness.

No, I don't think so - even with "fail-free" storage, a system crash
still results in an inconsistent filesystem; with nojournalling you've
made the decision to either fsck or re-mkfs after that event.

> I don't think that is a safe assumption. If users want that behavior, 
> they can mount with fs without barriers...

yes, I agree with Ric - even if you don't have journalling, the proper
sequence of sync calls should still result in data permanently on disk
by default.  (though I think using mount -o nobarrier for this purpose,
in absence of journalling, overloads the option a little...)

-Eric

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

end of thread, other threads:[~2010-03-26 17:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-26 16:21 [PATCH] ext4: Ensure writecache to disk in no journal mode Surbhi Palande
2010-03-26 16:37 ` Dmitry Monakhov
2010-03-26 17:16   ` Ric Wheeler
2010-03-26 17:40     ` Eric Sandeen

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).