From 3c9f03968c09df9a39d66076345de61a5f3d3a78 Mon Sep 17 00:00:00 2001 From: elad Date: Fri, 8 Mar 2019 18:07:14 +0200 Subject: [PATCH] Yield before flushing io buffers in fsync (sys_fs) (#5506) --- rpcs3/Emu/Cell/Modules/cellFs.cpp | 8 ++++---- rpcs3/Emu/Cell/lv2/sys_fs.cpp | 9 +++++---- rpcs3/Emu/Cell/lv2/sys_fs.h | 4 ++-- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/rpcs3/Emu/Cell/Modules/cellFs.cpp b/rpcs3/Emu/Cell/Modules/cellFs.cpp index 1931b3940c..2f6b44128f 100644 --- a/rpcs3/Emu/Cell/Modules/cellFs.cpp +++ b/rpcs3/Emu/Cell/Modules/cellFs.cpp @@ -206,18 +206,18 @@ error_code cellFsLseek(u32 fd, s64 offset, u32 whence, vm::ptr pos) return sys_fs_lseek(fd, offset, whence, pos); } -error_code cellFsFdatasync(u32 fd) +error_code cellFsFdatasync(ppu_thread& ppu, u32 fd) { cellFs.trace("cellFsFdatasync(fd=%d)", fd); - return sys_fs_fdatasync(fd); + return sys_fs_fdatasync(ppu, fd); } -error_code cellFsFsync(u32 fd) +error_code cellFsFsync(ppu_thread& ppu, u32 fd) { cellFs.trace("cellFsFsync(fd=%d)", fd); - return sys_fs_fsync(fd); + return sys_fs_fsync(ppu, fd); } error_code cellFsFGetBlockSize(u32 fd, vm::ptr sector_size, vm::ptr block_size) diff --git a/rpcs3/Emu/Cell/lv2/sys_fs.cpp b/rpcs3/Emu/Cell/lv2/sys_fs.cpp index 0f22241a2f..475aa3155c 100644 --- a/rpcs3/Emu/Cell/lv2/sys_fs.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_fs.cpp @@ -1,4 +1,5 @@ #include "stdafx.h" +#include "sys_sync.h" #include "sys_fs.h" #include @@ -1287,7 +1288,7 @@ error_code sys_fs_lseek(u32 fd, s64 offset, s32 whence, vm::ptr pos) return CELL_OK; } -error_code sys_fs_fdatasync(u32 fd) +error_code sys_fs_fdatasync(ppu_thread& ppu, u32 fd) { sys_fs.trace("sys_fs_fdadasync(fd=%d)", fd); @@ -1298,12 +1299,12 @@ error_code sys_fs_fdatasync(u32 fd) return CELL_EBADF; } + lv2_obj::sleep(ppu); file->file.sync(); - return CELL_OK; } -error_code sys_fs_fsync(u32 fd) +error_code sys_fs_fsync(ppu_thread& ppu, u32 fd) { sys_fs.trace("sys_fs_fsync(fd=%d)", fd); @@ -1314,8 +1315,8 @@ error_code sys_fs_fsync(u32 fd) return CELL_EBADF; } + lv2_obj::sleep(ppu); file->file.sync(); - return CELL_OK; } diff --git a/rpcs3/Emu/Cell/lv2/sys_fs.h b/rpcs3/Emu/Cell/lv2/sys_fs.h index fc0898953c..f1c67b7909 100644 --- a/rpcs3/Emu/Cell/lv2/sys_fs.h +++ b/rpcs3/Emu/Cell/lv2/sys_fs.h @@ -374,8 +374,8 @@ error_code sys_fs_unlink(vm::cptr path); error_code sys_fs_access(vm::cptr path, s32 mode); error_code sys_fs_fcntl(u32 fd, u32 op, vm::ptr arg, u32 size); error_code sys_fs_lseek(u32 fd, s64 offset, s32 whence, vm::ptr pos); -error_code sys_fs_fdatasync(u32 fd); -error_code sys_fs_fsync(u32 fd); +error_code sys_fs_fdatasync(ppu_thread& ppu, u32 fd); +error_code sys_fs_fsync(ppu_thread& ppu, u32 fd); error_code sys_fs_fget_block_size(u32 fd, vm::ptr sector_size, vm::ptr block_size, vm::ptr arg4, vm::ptr arg5); error_code sys_fs_get_block_size(vm::cptr path, vm::ptr sector_size, vm::ptr block_size, vm::ptr arg4); error_code sys_fs_truncate(vm::cptr path, u64 size);