all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: forum2@sprucehead.com
Cc: 6237@debbugs.gnu.org
Subject: bug#6237: 23.2; INSUFFICIENT RESOURCES writing file via CIFS
Date: Sat, 22 May 2010 12:39:41 +0300	[thread overview]
Message-ID: <83aarsp95u.fsf@gnu.org> (raw)
In-Reply-To: <83bpc8pbzo.fsf@gnu.org>

> Date: Sat, 22 May 2010 11:38:35 +0300
> From: Eli Zaretskii <eliz@gnu.org>
> Cc: 6237@debbugs.gnu.org
> 
> > I know nothing about Windows internals, but it would seem that some
> > downstream WinNT I/O routine can't handle 32MB or larger writes, so
> > perhaps write-region could segment the write?  The annotations hair
> > makes it hard for me to see if this is easy.
> 
> The breaking of writes into smaller chunks should be in Windows
> specific code, i.e. in w32.c:sys_write.  And that is very easy.

If you can build Emacs yourself from sources, could you please try the
following patch?  It incorporates the info I found in the git mailing
list thread pointed out by Andreas (thanks!).


=== modified file 'src/w32.c'
--- src/w32.c	2010-05-01 18:28:00 +0000
+++ src/w32.c	2010-05-22 09:33:53 +0000
@@ -5700,7 +5700,34 @@ sys_write (int fd, const void * buffer, 
     }
   else
 #endif
-    nchars = _write (fd, buffer, count);
+    {
+      /* Some networked filesystems don't like too large writes, so
+	 break them into smaller chunks.  See the Comments section of
+	 the MSDN documentation of WriteFile for details behind the
+	 choice of the value of CHUNK below.  See also the thread
+	 http://thread.gmane.org/gmane.comp.version-control.git/145294
+	 in the git mailing list.  */
+      const unsigned char *p = buffer;
+      const unsigned chunk = 30 * 1024 * 1024;
+
+      nchars = 0;
+      while (count > 0)
+	{
+	  unsigned this_chunk = count < chunk ? count : chunk;
+	  int n = _write (fd, p, this_chunk);
+
+	  nchars += n;
+	  if (n < 0)
+	    {
+	      nchars = n;
+	      break;
+	    }
+	  else if (n < this_chunk)
+	    break;
+	  count -= n;
+	  p += n;
+	}
+    }
 
   return nchars;
 }






  reply	other threads:[~2010-05-22  9:39 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-21  2:57 bug#6237: 23.2; INSUFFICIENT RESOURCES writing file via CIFS Jack Holloway
2010-05-22  1:51 ` Stefan Monnier
2010-05-22  2:12   ` Jack Holloway
2010-05-22  6:31     ` Eli Zaretskii
2010-05-22  7:49       ` Jack Holloway
2010-05-22  8:38         ` Eli Zaretskii
2010-05-22  9:39           ` Eli Zaretskii [this message]
2010-05-22 19:13             ` Eli Zaretskii
2010-05-22  8:08     ` Andreas Schwab

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83aarsp95u.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=6237@debbugs.gnu.org \
    --cc=forum2@sprucehead.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.