Web lists-archives.com

Re: [PATCH] mru: Replace mru.[ch] with list.h implementation

On Sun, Nov 12, 2017 at 12:49:17PM +0000, Gargi Sharma wrote:

> > Sort of a side note, but seeing these two list pointers together makes
> > me wonder what we should do with the list created by the "next" pointer.
> > It seems like there are three options:
> >
> >   1. Convert it to "struct list_head", too, for consistency.
> >
> >   2. Leave it as-is. We never delete from the list nor do any fancy
> >      manipulation, so it doesn't benefit from the reusable code.
> >
> >   3. I wonder if we could drop it entirely, and just keep a single list
> >      of packs, ordered by mru. I'm not sure if anybody actually cares
> >      about accessing them in the "original" order. That order is
> >      reverse-chronological (by prepare_packed_git()), but I think that
> >      was mostly out of a sense that recent packs would be accessed more
> >      than older ones (but having a real mru strategy replaces that
> >      anyway).
> >
> > What do you think?
> I think in the long run, it'll be easier if there is only a single
> list of packs given
> that no one needs to access the list in order.

Yeah, it's that "given..." that makes me just a little nervous that I'm
missing something.

> If we go down road 1/3, would it be better if I sent an entirely
> different patch or
> a patch series with patch 1 as removing mru[.ch] and patch 2 as removing
> next pointer from the struct?

I think you could do it as a 2-patch series like that, or you could send
the first patch now (since I think it stands on its own merits) and do
the other one later on top.

> > This matches the original code, which did the clear/re-create, resetting
> > the mru to the "original" pack order. But I do wonder if that's actually
> > necessary. Could we skip that and just add any new packs to the list?
> But if we do not clear the older entries from the list, wouldn't there be a
> problem when you access packed_git_mru->next, since that will be populated
> instead of being empty? Or am I misunderstanding something here?

What I mean is that instead of clearing and re-adding all of the packs
(including any new ones we picked up by rescanning the directory), we
would _just_ add new ones to the list.

So I think we'd scrap this whole "set up the mru" preparation here and
just teach install_packed_git() to add the new pack to the MRU list.