mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-18 19:21:26 +00:00
scst pr: Use fdatasync() instead of fsync()
Synchronizing the file contents is sufficient - it is not necessary to synchronize metadata like atime and mtime after having saved persistent reservation information. A more clear explanation of what "datasync" means can be found here http://linux.die.net/man/2/fdatasync: <quote> fdatasync() is similar to fsync(), but does not flush modified metadata unless that metadata is needed in order to allow a subsequent data retrieval to be correctly handled. For example, changes to st_atime or st_mtime (respectively, time of last access and time of last modification; see stat(2)) do not require flushing because they are not necessary for a subsequent data read to be handled correctly. On the other hand, a change to the file size (st_size, as made by say ftruncate(2)), would require a metadata flush. The aim of fdatasync() is to reduce disk activity for applications that do not require all metadata to be synchronized with the disk. </quote> Signed-off-by: Bart Van Assche <bvanassche@acm.org> git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4332 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
@@ -1079,9 +1079,9 @@ void scst_pr_sync_device_file(struct scst_tgt_dev *tgt_dev, struct scst_cmd *cmd
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 29)
|
||||
res = scst_pr_vfs_fsync(file, 0, pos);
|
||||
#elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 35)
|
||||
res = vfs_fsync(file, file->f_path.dentry, 0);
|
||||
res = vfs_fsync(file, file->f_path.dentry, 1);
|
||||
#else
|
||||
res = vfs_fsync(file, 0);
|
||||
res = vfs_fsync(file, 1);
|
||||
#endif
|
||||
if (res != 0) {
|
||||
PRINT_ERROR("fsync() of the PR file failed: %d", res);
|
||||
@@ -1097,9 +1097,9 @@ void scst_pr_sync_device_file(struct scst_tgt_dev *tgt_dev, struct scst_cmd *cmd
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 29)
|
||||
res = scst_pr_vfs_fsync(file, 0, sizeof(sign));
|
||||
#elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 35)
|
||||
res = vfs_fsync(file, file->f_path.dentry, 0);
|
||||
res = vfs_fsync(file, file->f_path.dentry, 1);
|
||||
#else
|
||||
res = vfs_fsync(file, 0);
|
||||
res = vfs_fsync(file, 1);
|
||||
#endif
|
||||
if (res != 0) {
|
||||
PRINT_ERROR("fsync() of the PR file failed: %d", res);
|
||||
|
||||
Reference in New Issue
Block a user