From: Johannes Sixt <j.sixt@viscovery.net>
To: kusmabite@gmail.com
Cc: Nguyen Thai Ngoc Duy <pclouds@gmail.com>,
Ramsay Jones <ramsay@ramsay1.demon.co.uk>,
Junio C Hamano <gitster@pobox.com>,
Git Mailing List <git@vger.kernel.org>
Subject: Re: What's cooking in git.git (Apr 2012, #06; Sun, 15)
Date: Thu, 19 Apr 2012 15:48:47 +0200 [thread overview]
Message-ID: <4F9017BF.90702@viscovery.net> (raw)
In-Reply-To: <CABPQNSb9BSfmGu2bYtZUndgkTom=r+Ho_CKsDr7wo=jfxiXEjA@mail.gmail.com>
Am 4/19/2012 15:31, schrieb Erik Faye-Lund:
> int main(int argc, const char *argv[])
> {
> int i, fd = open(__FILE__, O_RDONLY);
> for (i = 0; i < 2; ++i) {
> char buf[11] = {0};
> mingw_pread(fd, buf, 10, 0);
> printf("buf = '%10s'\n", buf);
> }
> return 0;
> }
The test is flawed. It shows only that pread can read twice the same file
location. But it must not update the file pointer, whereas the
documentation of ReadFile says (quoting the paragraph that is relevant for
us):
If hFile is not opened with FILE_FLAG_OVERLAPPED and lpOverlapped is
not NULL, the read operation starts at the offset that is specified in
the OVERLAPPED structure. ReadFile does not return until the read
operation is complete, and then the system updates the file pointer.
Hence, your mingw_pread() looks like a workable solution for our purposes,
but is still not a 100% correct emulation of pread(). (Testing all this
will have to wait for another 18 hours or so.)
> Yeah. Other platforms are still an issue. You didn't address those
> either in your patch, even though it would be possible to modify it to
> deal with them by checking the NO_PREAD and NO_PTHREADS defines.
>
> But they would still have the problem with the file-pointer racing for
> non-pread operations. Perhaps simply disabling threading is the better
> choice for these?
I think it is better to keep threading on in general, but only disable it
for index-pack. Why should existing users take a performance hit?
-- Hannes
next prev parent reply other threads:[~2012-04-19 13:49 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-16 6:44 What's cooking in git.git (Apr 2012, #06; Sun, 15) Junio C Hamano
2012-04-16 9:07 ` Nelson Benitez Leon
2012-04-16 8:20 ` Junio C Hamano
2012-04-16 11:24 ` Nelson Benitez Leon
2012-04-16 15:03 ` Junio C Hamano
2012-04-18 7:15 ` Johannes Sixt
2012-04-18 19:53 ` Ramsay Jones
2012-04-19 6:16 ` Johannes Sixt
2012-04-19 6:45 ` Johannes Sixt
2012-04-19 7:02 ` Nguyen Thai Ngoc Duy
2012-04-19 9:36 ` Nguyen Thai Ngoc Duy
2012-04-19 12:58 ` Erik Faye-Lund
2012-04-19 13:18 ` Nguyen Thai Ngoc Duy
2012-04-19 13:31 ` Erik Faye-Lund
2012-04-19 13:38 ` Nguyen Thai Ngoc Duy
2012-04-19 13:48 ` Johannes Sixt [this message]
2012-04-19 13:52 ` Erik Faye-Lund
2012-04-21 3:00 ` Nguyen Thai Ngoc Duy
2012-04-21 5:46 ` Nguyen Thai Ngoc Duy
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=4F9017BF.90702@viscovery.net \
--to=j.sixt@viscovery.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=kusmabite@gmail.com \
--cc=pclouds@gmail.com \
--cc=ramsay@ramsay1.demon.co.uk \
/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).