From: "Shawn O. Pearce" <spearce@spearce.org>
To: Andy Whitcroft <apw@shadowen.org>
Cc: "Stefan-W. Hahn" <stefan.hahn@s-hahn.de>, git@vger.kernel.org
Subject: Re: [PATCH] Replacing the system call pread() with lseek()/xread()/lseek() sequence.
Date: Tue, 9 Jan 2007 18:25:41 -0500 [thread overview]
Message-ID: <20070109232540.GA30023@spearce.org> (raw)
In-Reply-To: <45A40C15.1070200@shadowen.org>
Andy Whitcroft <apw@shadowen.org> wrote:
> Stefan-W. Hahn wrote:
> > Using cygwin with cygwin.dll before 1.5.22 the system call pread() is buggy.
> > This patch introduces NO_PREAD. If NO_PREAD is set git uses a sequence of
> > lseek()/xread()/lseek() to emulate pread.
> > +
> > + rc=read_in_full(fd, buf, count);
>
> Seems to be style inconsistancy between current_offset = and rc= I
> believe the former is preferred.
With the exception of this style difference, the patch looked
pretty good. Nice work Stefan. Andy's right, we do tend to prefer
"rc = read_in_full" over "rc=read_in_full". Quite a bit actually,
though Junio is the final decider on all such matters as he gets
to choose to accept or reject the patch. ;-)
> > +
> > + if (current_offset != lseek(fd, current_offset, SEEK_SET))
> > + return -1;
>
> How likely are we ever to be in the right place here? Seems vanishingly
> small putting us firmly in the four syscalls per call space. I wonder
> if git ever actually cares about the seek location. ie if we could stop
> reading and resetting it. Probabally not worth working it out I guess
> as any _sane_ system has one.
Andy's right actually. If we are using pread() we aren't relying
on the current file pointer. Which means its unnecessary to get
the current pointer before seeking to the requested offset, and its
unnecessary to restore it before the git_pread() function returns.
Though its a possibly unnecessary optimization as like Andy points
out, most sane systems already have a working pread() implementation.
And those that don't, well, probably should be made to be sane.
But we don't need to make Git suffer there if we don't have to.
--
Shawn.
next prev parent reply other threads:[~2007-01-09 23:25 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <11683766523955-git-send-email->
2007-01-09 21:04 ` [PATCH] Replacing the system call pread() with lseek()/xread()/lseek() sequence Stefan-W. Hahn
[not found] ` <11683766521544-git-send-email->
2007-01-09 21:41 ` Andy Whitcroft
2007-01-09 23:25 ` Shawn O. Pearce [this message]
2007-01-10 0:21 ` Junio C Hamano
2007-01-10 0:30 ` Johannes Schindelin
2007-01-10 1:12 ` Nicolas Pitre
2007-01-09 23:42 ` Johannes Schindelin
2007-01-10 0:59 ` Nicolas Pitre
2007-01-09 21:04 Stefan-W. Hahn
[not found] <11683687161816-git-send-email-@videotron.ca>
[not found] ` <11683687162492-git-send-email-@videotron.ca>
[not found] ` <11683687161239-git-send-email-@videotron.ca>
2007-01-09 19:48 ` Nicolas Pitre
[not found] <11683687161816-git-send-email->
[not found] ` <11683687162492-git-send-email->
2007-01-07 16:36 ` [PATCH] Replacing the system call pread() with real mmap() Stefan-W. Hahn
2007-01-09 18:51 ` [PATCH] Replacing the system call pread() with lseek()/xread()/lseek() sequence Stefan-W. Hahn
2007-01-09 20:21 ` Junio C Hamano
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=20070109232540.GA30023@spearce.org \
--to=spearce@spearce.org \
--cc=apw@shadowen.org \
--cc=git@vger.kernel.org \
--cc=stefan.hahn@s-hahn.de \
/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 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.