[stgt] [PATCH] SSC: dont fsync() on each written block. Do one single fsync() when file is closed in FILEMARK

ronnie sahlberg ronniesahlberg at gmail.com
Sat Jan 21 11:25:55 CET 2012

Tomo, list,

Please find attached a patch to SSC which changes when it performs fsync().
With this patch fsync will not be called for normal block writes but
only for the final "write a filemark" that is issued when a full
session writing to the tape has finished.

The patch does improve performance significantly, especially on
slow/low-end/dodgy hardware where fsync is expensive.

As for data safety, I think this is ok.
We dont guarantee that the data is all destaged to physical media
until WRITE-FILEMARK command has completed successfully.

Imho if the system crashes during the write session but before it has
completed (==WRITE-FILEMARK) then all bets are off ?

Maybe Mark and some of the other tape people can speak up if this is
valid or dodgy reasoning?
If so maybe I could add a attribute "buffered write = Yes|No" where
fsync() on every write vs fsync() one the backup is complete
can be controlled.

Performance improvement is significant on slow hw!

ronnie sahlberg
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-SSC-dont-do-fsync-on-every-write-only-fsync-at-the-e.patch.gz
Type: application/x-gzip
Size: 499 bytes
Desc: not available
URL: <http://lists.wpkg.org/pipermail/stgt/attachments/20120121/c72c2731/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-SSC-dont-do-fsync-on-every-write-only-fsync-at-the-e.patch
Type: text/x-diff
Size: 739 bytes
Desc: not available
URL: <http://lists.wpkg.org/pipermail/stgt/attachments/20120121/c72c2731/attachment-0001.patch>

More information about the stgt mailing list