ruby-changes:21602
From: usa <ko1@a...>
Date: Mon, 7 Nov 2011 20:08:50 +0900 (JST)
Subject: [ruby-changes:21602] usa:r33651 (trunk): * io.c (io_fflush): remove fsync().
usa 2011-11-07 20:08:39 +0900 (Mon, 07 Nov 2011) New Revision: 33651 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=33651 Log: * io.c (io_fflush): remove fsync(). * io.c (rb_io_flush, rb_io_rewind): fsync() here. these changes reduces fsync() calls to improve performance. first reported at [ruby-list:48515] by ak7 at mail.goo.ne.jp . [Bug #5585] Modified files: trunk/ChangeLog trunk/io.c Index: ChangeLog =================================================================== --- ChangeLog (revision 33650) +++ ChangeLog (revision 33651) @@ -1,3 +1,13 @@ +Mon Nov 7 20:05:16 2011 NAKAMURA Usaku <usa@r...> + + * io.c (io_fflush): remove fsync(). + + * io.c (rb_io_flush, rb_io_rewind): fsync() here. + + these changes reduces fsync() calls to improve performance. + first reported at [ruby-list:48515] by ak7 at mail.goo.ne.jp . + [Bug #5585] + Mon Nov 7 19:43:10 2011 Tanaka Akira <akr@f...> * io.c (rb_close_before_exec): use F_MAXFD if available. Index: io.c =================================================================== --- io.c (revision 33650) +++ io.c (revision 33651) @@ -837,11 +837,6 @@ return -1; rb_io_check_closed(fptr); } -#ifdef _WIN32 - if (GetFileType((HANDLE)rb_w32_get_osfhandle(fptr->fd)) == FILE_TYPE_DISK) { - fsync(fptr->fd); - } -#endif return 0; } @@ -1223,6 +1218,11 @@ if (fptr->mode & FMODE_WRITABLE) { if (io_fflush(fptr) < 0) rb_sys_fail(0); +#ifdef _WIN32 + if (GetFileType((HANDLE)rb_w32_get_osfhandle(fptr->fd)) == FILE_TYPE_DISK) { + fsync(fptr->fd); + } +#endif } if (fptr->mode & FMODE_READABLE) { io_unread(fptr); @@ -1355,6 +1355,11 @@ GetOpenFile(io, fptr); if (io_seek(fptr, 0L, 0) < 0 && errno) rb_sys_fail_path(fptr->pathv); +#ifdef _WIN32 + if (GetFileType((HANDLE)rb_w32_get_osfhandle(fptr->fd)) == FILE_TYPE_DISK) { + fsync(fptr->fd); + } +#endif if (io == ARGF.current_file) { ARGF.lineno -= fptr->lineno; } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/