On Fri, Jan 7, 2011 at 2:55 PM, Mike Fleetwood <mike.fleetw...@googlemail.com> wrote: > On 6 January 2011 20:01, Olaf van der Spek <olafvds...@gmail.com> wrote: >> Hi, >> >> Does btrfs support atomic file data replaces? > > Hi Olaf, > > Yes btrfs does support atomic replace, since kernel 2.6.30 circa June 2009. > [1] > > Special handling was added to ext3, ext4, btrfs (and probably other > Linux FSs) for your replace-via-truncate and the alternative > replace-via-rename application patterns. Try reading "Delayed > allocation and the zero-length file problem" article and comments by > Ted Ts'o for further discussion. [2]
According to Ted, via-truncate and via-rename are unsafe. Only fsync, rename is safe. Disadvantage of rename is resetting file owner (if non-root), having issues with meta-data and other stuff. My proposal was for an open flag, O_ATOMIC, to be introduced to tell the FS the whole file update should be done atomically. Ted says this is too hard in ext4, so I was wondering if this would be possible in btrfs. Olaf -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html