Joseph Mocker wrote:
Nicolas Williams wrote:
The big question though is: how to snapshot file versions when they are
touched/created by applications that are not aware of FV?
Certainly not with every write(2). At fsync(2), close(2), open(2) for
write/append? What if an application deals in multiple files? Etc...
Automatically capturing file versions isn't possible in the general case
with applications that aren't aware of FV.
Don't snapshots have the same problem. A snapshot could potentially be
taken when a file is partially written or updated, no?
For example, I start to write a large file, zfs's buffers fill up and
it flushes them to disk during the middle of the file I'm writing. If
a snapshot came along at about the same time, the file would be
incomplete/corrupt, no?
The developers can answer this definitively, but I believe the answer to
your questions is NO. That is, if there is anything in the buffer
waiting to be written when a snapshot request comes along, the buffer is
written out so that the file is consistent with the last write(). So,
snapshotting should NEVER cause a file corruption in this matter. That
said, if you are doing the following:
1. App issues write() for data A
2. snapshot request
3. App issues write for data B
Then yes, the snapshot file will only contain data A, and not data B,
which might lead to an inconsistency in the app's behavior, if both A
and B were important to be written together. But if that were the case,
then the app should have written A and B atomically.
So, if you are writing to a file, it works better to write everything at
once in a stream, rather than a character (or byte) at a time. :-)
-Erik
_______________________________________________
zfs-discuss mailing list
zfs-discuss@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/zfs-discuss