[前][次][番号順一覧][スレッド一覧]

ruby-changes:22402

From: kosaki <ko1@a...>
Date: Tue, 7 Feb 2012 05:19:44 +0900 (JST)
Subject: [ruby-changes:22402] kosaki:r34451 (ruby_1_9_3): merge revision(s) r33826:

kosaki	2012-02-07 05:19:29 +0900 (Tue, 07 Feb 2012)

  New Revision: 34451

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=34451

  Log:
    merge revision(s) r33826:
    
    * io.c (rb_io_fsync,rb_io_fdatasync): release GVL during fsync().
      fsync() and fdatasync() may take a long time on slow disks and/or
      if there is much dirty data.
      Patch by Eric Wong. [Feature #5665] [ruby-core:41247]

  Modified files:
    branches/ruby_1_9_3/ChangeLog
    branches/ruby_1_9_3/io.c
    branches/ruby_1_9_3/version.h

Index: ruby_1_9_3/ChangeLog
===================================================================
--- ruby_1_9_3/ChangeLog	(revision 34450)
+++ ruby_1_9_3/ChangeLog	(revision 34451)
@@ -1,3 +1,10 @@
+Mon Feb  6 15:19:17 2012  KOSAKI Motohiro  <kosaki.motohiro@g...>
+
+	* io.c (rb_io_fsync,rb_io_fdatasync): release GVL during fsync().
+	  fsync() and fdatasync() may take a long time on slow disks and/or
+	  if there is much dirty data.
+	  Patch by Eric Wong. [Feature #5665] [ruby-core:41247]
+
 Mon Feb  6 15:01:55 2012  Nobuyoshi Nakada  <nobu@r...>
 
 	* vm_eval.c (vm_call0): should pass block to enumerators.  patched
Index: ruby_1_9_3/io.c
===================================================================
--- ruby_1_9_3/io.c	(revision 34450)
+++ ruby_1_9_3/io.c	(revision 34451)
@@ -1358,6 +1358,13 @@
 }
 
 #ifdef HAVE_FSYNC
+static VALUE nogvl_fsync(void *ptr)
+{
+    rb_io_t *fptr = ptr;
+
+    return (VALUE)fsync(fptr->fd);
+}
+
 /*
  *  call-seq:
  *     ios.fsync   -> 0 or nil
@@ -1383,7 +1390,7 @@
     if (io_fflush(fptr) < 0)
         rb_sys_fail(0);
 #ifndef _WIN32	/* already called in io_fflush() */
-    if (fsync(fptr->fd) < 0)
+    if ((int)rb_thread_io_blocking_region(nogvl_fsync, fptr, fptr->fd) < 0)
 	rb_sys_fail_path(fptr->pathv);
 #endif
     return INT2FIX(0);
@@ -1393,6 +1400,13 @@
 #endif
 
 #ifdef HAVE_FDATASYNC
+static VALUE nogvl_fdatasync(void *ptr)
+{
+    rb_io_t *fptr = ptr;
+
+    return (VALUE)fdatasync(fptr->fd);
+}
+
 /*
  *  call-seq:
  *     ios.fdatasync   -> 0 or nil
@@ -1415,7 +1429,7 @@
     if (io_fflush(fptr) < 0)
         rb_sys_fail(0);
 
-    if (fdatasync(fptr->fd) == 0)
+    if ((int)rb_thread_io_blocking_region(nogvl_fdatasync, fptr, fptr->fd) == 0)
 	return INT2FIX(0);
 
     /* fall back */
Index: ruby_1_9_3/version.h
===================================================================
--- ruby_1_9_3/version.h	(revision 34450)
+++ ruby_1_9_3/version.h	(revision 34451)
@@ -1,5 +1,5 @@
 #define RUBY_VERSION "1.9.3"
-#define RUBY_PATCHLEVEL 44
+#define RUBY_PATCHLEVEL 45
 
 #define RUBY_RELEASE_DATE "2012-02-07"
 #define RUBY_RELEASE_YEAR 2012

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]