Results 1 to 4 of 4

Thread: BTRFS sync writes

  1. #1

    Default BTRFS sync writes

    I would like to know how can I ensure the writes on BTRFS is always synchronized. It means the write operation returns when the filesystem has indeed committed the writes to the persistent block storage? I know in ZFS I can set the sync = always to ensure this. But on BTRFS, even though I have mounted the volume with ‘barrier’ and ‘flushoncommit’ options, the writes are still cached in the memory. I know this because the write speed is 1.9GB/s where as my block devices has a maximum throughput of 500MB/s. I found that it has something to do with delayed allocation, and on EXT4 there is option ‘nodelalloc’ to mount it without caching. However I could not find something similar for BTRFS to ensure the writes being synchronized Any help will be appreciated!!!

  2. #2
    Join Date
    Sep 2012
    Posts
    5,129

    Default Re: BTRFS sync writes

    Quote Originally Posted by fei1986 View Post
    I know in ZFS I can set the sync = always to ensure this. But on BTRFS, even though I have mounted the volume with ‘barrier’ and ‘flushoncommit’ options, the writes are still cached in the memory.

    Both ZFS and btrfs are using intent logging (write ahead logging) to store synchronous writes. There is no fundamental difference here.
    I found that it has something to do with delayed allocation
    Filesystems had been caching writes long before delayed allocations were invented.

  3. #3

    Default Re: BTRFS sync writes

    Quote Originally Posted by arvidjaar View Post
    Both ZFS and btrfs are using intent logging (write ahead logging) to store synchronous writes. There is no fundamental difference here.

    Filesystems had been caching writes long before delayed allocations were invented.
    Hi Thank you for the response. As I mentioned I could enforce the sync writes in ZFS by setting 'sync' option to 'always'. As result, the write is always synchronized no matter if the program explicitly ask for sync. How ever in BTRFS, it seems that the only way to make sync writes is to explicitly call fsync() operation. Am I missing something?

  4. #4
    Join Date
    Sep 2012
    Posts
    5,129

    Default Re: BTRFS sync writes

    Quote Originally Posted by fei1986 View Post
    Am I missing something?
    Probably
    Code:
    mount -o sync ...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •