git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Fix random fast-import errors when compiled with NO_MMAP

From
Shawn O. Pearce <spearce@spearce.org>
Date
Jan 21, 2008, 04:10 UTC
Message-ID
<20080121041031.GF24004@spearce.org>
In-Reply-To
<7vtzlbirz0.fsf@gitster.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> wrote:
Show 6 quoted lines
> "Shawn O. Pearce" <spearce@spearce.org> writes:
> 
> > +extern void close_pack_windows(struct packed_git *, int);
> 
> Nobody seems to pass anything but true in retain_fd parameter.
> Is it worth it?

Hmm, well, I originally wrote something like what you fixed it to be, then thought that at some point in the future someone may try to invoke the method and expect different semantics than it implemented. :-)

In short I made the implementation I gave you way too complex.
 
Show 17 quoted lines
> So I'd prefer something much simpler like this one instead...
> 
> void close_pack_windows(struct packed_git *p)
> {
> 	while (p->windows) {
> 		struct pack_window *w = p->windows;
> 
> 		if (w->inuse_cnt)
> 			die("pack '%s' still has outstanding windows",
> 				p->pack_name)
> 		munmap(w->base, w->len);
> 		pack_mapped -= w->len;
> 		pack_open_windows--;
> 		p->windows = w->next;
> 		free(w);
> 	}
> }

Me too. Thank you for the sanity check, and for fixing the code to actually be somewhat sane.

-- 
Shawn.
Previous: Junio C HamanoNext: Johannes Sixt
Message 8 of 13 in “Re: [PATCH] Fix random fast-import errors when compiled with NO_MMAP”
  1. Linus TorvaldsJan 18, 2008
  2. Charles BaileyJan 18, 2008
  3. Linus TorvaldsJan 18, 2008
  4. Junio C HamanoJan 19, 2008
  5. Linus TorvaldsJan 19, 2008
  6. Shawn O. PearceJan 21, 2008
  7. Junio C HamanoJan 18, 2008
  8. Shawn O. PearceJan 21, 2008
  9. Johannes SixtJan 18, 2008
  10. Charles BaileyJan 18, 2008
  11. Junio C HamanoJan 18, 2008
  12. Charles BaileyJan 18, 2008
  13. Junio C HamanoJan 18, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.