git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Cc: "Michael Haggerty" <mhagger@alum.mit.edu>,
	"Jeff King" <peff@peff.net>,
	"Torsten Bögershausen" <tboegi@web.de>,
	"Johannes Sixt" <j6t@kdbg.org>,
	"Shawn O. Pearce" <spearce@spearce.org>,
	mlevedahl@gmail.com, dpotapov@gmail.com,
	"GIT Mailing-list" <git@vger.kernel.org>
Subject: Re: [RFC/PATCH 0/1] cygwin: Remove the Win32 l/stat() functions
Date: Sun, 30 Jun 2013 12:50:41 -0700	[thread overview]
Message-ID: <7v4ncfjs32.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <51D06AC8.70206@ramsay1.demon.co.uk> (Ramsay Jones's message of "Sun, 30 Jun 2013 18:28:40 +0100")

Ramsay Jones <ramsay@ramsay1.demon.co.uk> writes:

> Ramsay Jones wrote:
>> Michael Haggerty wrote:
>>> On 06/27/2013 12:35 AM, Jeff King wrote:
>> [ ... ]
>>>> I think Michael's assessment above is missing one thing.
>>>
>>> Peff is absolutely right; for some unknown reason I was thinking of the
>>> consistency check as having been already fixed.
>> 
>> Well, the "cygwin: Remove the Win32 l/stat() functions" patch *does* fix
>> the problem. :-D It's just a pity we can't use it on performance grounds. :(
>> 
>>>> [...#ifdef out consistency check on cygwin when lock is held...]
>>>
>>> Yes, this would work.
>>>
>>> But, taking a step back, I think it is a bad idea to have an unreliable
>>> stat() masquerading as a real stat().  If we want to allow the use of an
>>> unreliable stat for certain purposes, let's have two stat() interfaces:
>>>
>>> * the true stat() (in this case I guess cygwin's slow-but-correct
>>> implementation)
>>>
>>> * some fast_but_maybe_unreliable_stat(), which would map to stat() on
>>> most platforms but might map to the Windows stat() on cygwin when so
>>> configured.
>>>
>>> By default the true stat() would always be used.  It should have to be a
>>> conscious decision, taken only in specific, vetted scenarios, to use the
>>> unreliable stat.
>>  ...

I like the part that gets rid of that "get-mode-bits" but at the
same time, I find this part wanting a reasonable in-code comment.

At least, with the earlier get-mode-bits, it was clear why we are
doing something special in that codepath, both from the name of the
helper function/macro and the comment attached to it describing how
the "regular" one is cheating.

We must say why this "fast" is not used everywhere and what criteria
you should apply when deciding to use it (or not use it).  And the
"fast" name is much less descriptive.

I suspect (without thinking it through) that the rule would be
something like:

    The "fast" variant is to be used to read from the filesystem the
    "stat" bits that are stuffed into the index for quick "touch
    detection" (aka "cached stat info") and/or that are compared
    with the cached stat info, and should not be used anywhere else.

But then we always use lstat(2) and not stat(2) for that, so...

> +#ifndef GIT_FAST_STAT
> +static inline int fast_stat(const char *path, struct stat *st)
> +{
> +	return stat(path, st);
> +}
> +static inline int fast_lstat(const char *path, struct stat *st)
> +{
> +	return lstat(path, st);
> +}
> +#endif

  reply	other threads:[~2013-06-30 19:50 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <51C5FD28.1070004@ramsay1.demon.co.uk>
     [not found] ` <51C7A875.6020205@gmail.com>
     [not found]   ` <7va9mf6txq.fsf@alter.siamese.dyndns.org>
2013-06-25 19:23     ` [RFC/PATCH 0/1] cygwin: Remove the Win32 l/stat() functions Johannes Sixt
2013-06-25 20:23       ` Torsten Bögershausen
2013-06-25 21:18       ` Junio C Hamano
2013-06-26 14:19         ` Torsten Bögershausen
2013-06-26 21:54           ` Ramsay Jones
2013-06-27 15:19             ` Torsten Bögershausen
2013-06-27 23:18               ` Ramsay Jones
2013-06-27  2:37           ` Mark Levedahl
     [not found] ` <51C6BC4B.9030905@web.de>
     [not found]   ` <51C8BF2C.2050203@ramsay1.demon.co.uk>
     [not found]     ` <7vy59y4w3r.fsf@alter.siamese.dyndns.org>
2013-06-26 21:39       ` Ramsay Jones
     [not found]       ` <51C94425.7050006@alum.mit.edu>
2013-06-26 21:45         ` Ramsay Jones
2013-06-26 22:35           ` Jeff King
2013-06-26 22:43             ` Jeff King
2013-06-27 22:58               ` Ramsay Jones
2013-06-28  2:31                 ` Mark Levedahl
2013-06-27  5:51             ` Michael Haggerty
2013-06-27 19:58               ` Jeff King
2013-06-27 21:04                 ` Junio C Hamano
2013-06-27 23:09               ` Ramsay Jones
2013-06-30 17:28                 ` Ramsay Jones
2013-06-30 19:50                   ` Junio C Hamano [this message]
2013-07-04 18:18                     ` Ramsay Jones
2013-07-09 11:02                   ` Torsten Bögershausen
2013-07-11 17:31                     ` Ramsay Jones
2013-06-27 22:17             ` Ramsay Jones

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=7v4ncfjs32.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=dpotapov@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=j6t@kdbg.org \
    --cc=mhagger@alum.mit.edu \
    --cc=mlevedahl@gmail.com \
    --cc=peff@peff.net \
    --cc=ramsay@ramsay1.demon.co.uk \
    --cc=spearce@spearce.org \
    --cc=tboegi@web.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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).