Hi,

On Saturday, 11 August 2007 00:32, Couriousous wrote:
> Hello
> 
> Here is an easy way to speed up the image writing. It simply tell the kernel 
> to 
> immediatly start writing the data to disk asynchronously and not to do the 
> traditional 
> buffering.
> 
> Mesurement:
> System: pentium D820, Harddisk ~58Mo/s, image size 500Mo
> Time of suspend to disk, average of 3 run.
> 
> Compression enabled:
> Without patch: 35 sec.
> With patch: 27 sec.
> Speedup: 22%
> 
> Compression disabled:
> Without patch: 17 sec.
> With patch: 14 sec.
> Speedup: 18%

OK, thanks.

Still, I think we should only sync if we have called write(), no?

---
 suspend.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Index: suspend/suspend.c
===================================================================
--- suspend.orig/suspend.c
+++ suspend/suspend.c
@@ -236,8 +236,12 @@ static int write_area(int fd, void *buf,
        ssize_t cnt = 0;
 
        if (offset) {
-               if (lseek64(fd, offset, SEEK_SET) == offset)
+               if (lseek64(fd, offset, SEEK_SET) == offset) {
                        cnt = write(fd, buf, size);
+                       /* Ask kernel to immediatly start writing the data */
+                       sync_file_range(fd, offset, size,
+                                       SYNC_FILE_RANGE_WRITE);
+               }
                if (cnt == size)
                        res = 0;
                else

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Suspend-devel mailing list
Suspend-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/suspend-devel

Reply via email to