All of lore.kernel.org
 help / color / mirror / Atom feed
* fsync and journal_async_commit mount options
@ 2015-08-16 11:42 Alexey Skidanov
  2015-08-16 12:24 ` Theodore Ts'o
  0 siblings, 1 reply; 5+ messages in thread
From: Alexey Skidanov @ 2015-08-16 11:42 UTC (permalink / raw)
  To: linux-fsdevel@vger.kernel.org; +Cc: alexey.skidanov@gmail.com

Hi,

Some partition on my device is mounted with  journal_async_commit option. I paid attention that fsync() system call doesn't cause to flush request to be sent. Looking in the source code of ext4_sync_file I understand that only if the barrier option is on the flush request will be issued:

        if (journal->j_flags & JBD2_BARRIER &&
            !jbd2_trans_will_send_data_barrier(journal, commit_tid))
                needs_barrier = true;
                ...
        if (needs_barrier) {
                err = blkdev_issue_flush(inode->i_sb->s_bdev, GFP_KERNEL, NULL);
                               ...
        }

The fsync mainly used to ensure the data is actually written on backing device. The man page says:

fsync() transfers ("flushes") all modified in-core data of (i.e., modified buffer cache pages for) the file referred to by the file descriptor fd to the disk device (or other permanent storage device) so that all changed information can be retrieved even after the system crashed or was rebooted. This includes writing through or flushing a disk cache if present.

The barrier is a mount option imposing some ordering on journaling transactions - journaling content and journaling commit. So why  the flush request is issued only if the journal ordering is imposed by barrier option?

Thanks
Alexey

^ permalink raw reply	[flat|nested] 5+ messages in thread
* fsync and journal_async_commit mount options
@ 2015-08-13 13:47 Alexey Skidanov
  0 siblings, 0 replies; 5+ messages in thread
From: Alexey Skidanov @ 2015-08-13 13:47 UTC (permalink / raw)
  To: linux-ext4@vger.kernel.org; +Cc: alexey.skidanov@gmail.com

Hi,

Some partition on my device is mounted with  journal_async_commit option. I paid attention that fsync() system call doesn't cause to flush request to be sent. Looking in the source code of ext4_sync_file I understand that only if the barrier option is on the flush request will be issued:

	if (journal->j_flags & JBD2_BARRIER &&
	    !jbd2_trans_will_send_data_barrier(journal, commit_tid))
		needs_barrier = true;
                ...
	if (needs_barrier) {
		err = blkdev_issue_flush(inode->i_sb->s_bdev, GFP_KERNEL, NULL);
                               ...
	}

The fsync mainly used to ensure the data is actually written on backing device. The man page says:

fsync() transfers ("flushes") all modified in-core data of (i.e., modified buffer cache pages for) the file referred to by the file descriptor fd to the disk device (or other permanent storage device) so that all changed information can be retrieved even after the system crashed or was rebooted. This includes writing through or flushing a disk cache if present.

The barrier is a mount option imposing some ordering on journaling transactions - journaling content and journaling commit. So why  the flush request is issued only if the journal ordering is imposed by barrier option?

Thanks
Alexey

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

end of thread, other threads:[~2015-08-18 16:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-16 11:42 fsync and journal_async_commit mount options Alexey Skidanov
2015-08-16 12:24 ` Theodore Ts'o
2015-08-18  9:59   ` Alexey Skidanov
2015-08-18 16:25     ` tytso
  -- strict thread matches above, loose matches on Subject: below --
2015-08-13 13:47 Alexey Skidanov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.