On Wed, Sep 20, 2017 at 02:40:58PM -0400, Jeff King wrote:
> > +enum mmap_strategy {
> > + /*
> > + * Don't use mmap() at all for reading `packed-refs`.
> > + */
> > + MMAP_NONE,
> > +
> > + /*
> > + * Can use mmap() for reading `packed-refs`, but the file must
> > + * not remain mmapped. This is the usual option on Windows,
> > + * where you cannot rename a new version of a file onto a file
> > + * that is currently mmapped.
> > + */
> > + MMAP_TEMPORARY,
>
> I suspect you originally distinguished these cases so that NO_MMAP does
> not read into a fake-mmap buffer, followed by us copying it into another
> buffer. But AFAICT we handle the "NONE" and "TEMPORARY" cases exactly
> the same (by just doing a read_in_full() into our own buffer). Do we
> actually need separate strategies?
In case you are reading these sequentially, I think I talked myself into
the utility of this during the next patch. ;)
-Peff