User: Password:
Subscribe / Log in / New account

Supporting transactions in btrfs

Supporting transactions in btrfs

Posted Nov 12, 2009 11:01 UTC (Thu) by (guest, #38022)
Parent article: Supporting transactions in btrfs

About the fsync() problem, I wonder if tagging every write operation with a sequence number (one sequence number per device) would be a good solution:
The device driver can re-order any write with the same sequence number.
Each time a fsync() is done, it increment the sequence number of that device by 1.
Maybe a function call wait_until_current_sequence_number_reached(device);
Wouldn't that be a good and simple compromise?

(Log in to post comments)

Supporting transactions in btrfs

Posted Nov 12, 2009 16:30 UTC (Thu) by dtlin (✭ supporter ✭, #36537) [Link]

Say you have a text editor which only wants to fsync one file and a
background task which is continuously writing lots of files.

How do you propose to implement fsync such that when your text editor's
requests it, only that one file and not too much else is flushed?

Supporting transactions in btrfs

Posted Nov 12, 2009 23:27 UTC (Thu) by masoncl (subscriber, #47138) [Link]

Btrfs actually already does this. When you fsync a file the metadata is written to a dedicated logging tree, and that file's data blocks go to disk along with the metadata for the dedicated tree.

The end result is that we only write data and metadata for the one file we're sending to fsync.

Copyright © 2017, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds