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

Re: [PATCH] fsck: print progress

From
Jeff King <peff@peff.net>
Date
Nov 3, 2011, 03:33 UTC
Message-ID
<20111103033325.GA10230@sigill.intra.peff.net>
In-Reply-To
<1320290513-8878-1-git-send-email-pclouds@gmail.com>
On Thu, Nov 03, 2011 at 10:21:53AM +0700, Nguyen Thai Ngoc Duy wrote:
> fsck is usually a long process and it would be nice if it prints
> progress from time to time.
The output looks good to me. Code looks sane overall, with one comment:
Show 20 quoted lines
> +		for (i = 1, p = packed_git; p; p = p->next, i++) {
> +			if (show_progress) {
> +				char buf[32];
> +				snprintf(buf, sizeof(buf), "Verifying pack %d/%d",
> +					 i, nr_packs);
> +				if (open_pack_index(p))
> +					continue;
> +				progress = start_progress(buf, p->num_objects);
> +			}
>  			/* verify gives error messages itself */
> -			verify_pack(p);
> +			verify_pack(p, progress);
> +
> +			/*
> +			 * we do not stop progress here, let the next
> +			 * progress line overwrite the current one for
> +			 * the next pack.
> +			 */
> +		}
> +		stop_progress(&progress);

We're actually leaking some memory here, since stop_progress will also free() the progress object and any associated resources. It's not a lot, but it's kind of ugly.

Perhaps there should be a special version of stop_progress that handles this better? Or perhaps we could even come up with a total object count before starting. I guess it would involve mapping each pack index simultaneously, though by my reading of the code, I think we do that anyway (the opened index is cached in the pack object).

-Peff
Previous: Nguyễn Thái Ngọc DuyNext: Nguyễn Thái Ngọc Duy
Message 6 of 21 in “long fsck time”
  1. Nguyen Thai Ngoc DuyNov 2, 2011
  2. Nguyen Thai Ngoc DuyNov 2, 2011
  3. Jeff KingNov 2, 2011
  4. Nguyen Thai Ngoc DuyNov 3, 2011
  5. fsck: print progressNguyễn Thái Ngọc Duy, Nov 3, 2011
  6. Jeff KingNov 3, 2011
  7. fsck: print progressNguyễn Thái Ngọc Duy, Nov 3, 2011
  8. Jeff KingNov 3, 2011
  9. Junio C HamanoNov 3, 2011
  10. Jeff KingNov 3, 2011
  11. Junio C HamanoNov 3, 2011
  12. Jeff KingNov 3, 2011
  13. Junio C HamanoNov 3, 2011
  14. Jeff KingNov 3, 2011
  15. fsck: print progressNguyễn Thái Ngọc Duy, Nov 4, 2011
  16. Stephen BoydNov 5, 2011
  17. Nguyen Thai Ngoc DuyNov 5, 2011
  18. Stephen BoydNov 5, 2011
  19. Junio C HamanoNov 5, 2011
  20. Nguyen Thai Ngoc DuyNov 6, 2011
  21. Junio C HamanoNov 6, 2011

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.