git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Fix checkout of large files to network shares under Windows XP

From
ADAlbert Dvornik <dvornik+git@gmail.com>
Date
Apr 19, 2010, 22:46 UTC
Message-ID
<z2l9f74dc2c1004191546n5562759an54342e3efdaa9539@mail.gmail.com>
In-Reply-To
<4BCCC05E.4030206@lsrfire.ath.cx>
On Mon, Apr 19, 2010 at 4:43 PM, René Scharfe
<rene.scharfe@lsrfire.ath.cx> wrote:
  [...]
Show 8 quoted lines
>> +                     if (total + size > count)
>> +                             size = count - total;
>> +             }
>> +     }
>
> Shouldn't the loop be left in the successful case, too?  write(2) is
> allowed to write less than requested, so the caller already needs to
> deal with that case anyway.

That's what I thought initially, since the code would be cleaner, but I don't like the fact that you could actually end up making a lot more failed write() calls that way, since you restart the size search on each call to mingw_write().

For example, suppose you were calling mingw_write() with a count that was exactly 11.5 times bigger than whatever maximum size write() was willing to accept. If you only did one write() per mingw_write(), letting the caller restart, this will result in 47 failed writes and 16 successes. Letting mingw_write() do the restart (as in the existing code) will end up with 4 failed writes and 16 successes. Now, I assume (wait, this is Windows-- I'd *like to hope*) that a failed write() is a lot cheaper than a successful one, but this still rubs me the wrong way.

Of course, if we know (or can guess) the maximum size write() will take, that would be best.

--bert
Previous: René ScharfeNext: Johannes Sixt
Message 5 of 15 in “Fix checkout of large files to network shares under Windows XP”
  1. Fix checkout of large files to network shares under Windows XPSebastian Schuberth, Apr 19, 2010
  2. Junio C HamanoApr 19, 2010
  3. Johannes SchindelinApr 20, 2010
  4. René ScharfeApr 19, 2010
  5. Albert DvornikApr 19, 2010
  6. Johannes SixtApr 20, 2010
  7. Sebastian SchuberthApr 20, 2010
  8. Johannes SixtApr 20, 2010
  9. Sebastian SchuberthApr 20, 2010
  10. René ScharfeApr 20, 2010
  11. René ScharfeApr 29, 2010
  12. Johannes SixtApr 30, 2010
  13. Sebastian SchuberthApr 30, 2010
  14. René ScharfeOct 16, 2010
  15. Dmitry PotapovOct 17, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.