git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Albert Dvornik <dvornik+git@gmail.com>
To: "René Scharfe" <rene.scharfe@lsrfire.ath.cx>
Cc: Sebastian Schuberth <sschuberth@gmail.com>,
	git@vger.kernel.org, msysgit@googlegroups.com
Subject: Re: [PATCH] Fix checkout of large files to network shares under  Windows XP
Date: Mon, 19 Apr 2010 18:46:52 -0400	[thread overview]
Message-ID: <z2l9f74dc2c1004191546n5562759an54342e3efdaa9539@mail.gmail.com> (raw)
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:
  [...]
>> +                     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

  reply	other threads:[~2010-04-19 22:47 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-19 12:45 [PATCH] Fix checkout of large files to network shares under Windows XP Sebastian Schuberth
2010-04-19 20:41 ` Junio C Hamano
2010-04-20  9:15   ` Johannes Schindelin
2010-04-19 20:43 ` René Scharfe
2010-04-19 22:46   ` Albert Dvornik [this message]
2010-04-20  8:18   ` Johannes Sixt
2010-04-20 12:42   ` Sebastian Schuberth
2010-04-20 12:57     ` Johannes Sixt
2010-04-20 14:21       ` Sebastian Schuberth
2010-04-20 20:49     ` René Scharfe
2010-04-29 20:01       ` René Scharfe
2010-04-30  8:46         ` Johannes Sixt
2010-04-30  9:08         ` Sebastian Schuberth
     [not found]         ` <290b11b5-5dd5-4b83-a6f5-217797ebd5af@t8g2000yqk.googlegroups.com>
2010-10-16 17:23           ` René Scharfe
2010-10-17 10:54             ` Dmitry Potapov

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=z2l9f74dc2c1004191546n5562759an54342e3efdaa9539@mail.gmail.com \
    --to=dvornik+git@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=msysgit@googlegroups.com \
    --cc=rene.scharfe@lsrfire.ath.cx \
    --cc=sschuberth@gmail.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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).