git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] fsck: print progress
Date: Wed, 2 Nov 2011 23:33:25 -0400	[thread overview]
Message-ID: <20111103033325.GA10230@sigill.intra.peff.net> (raw)
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:

> +		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

  reply	other threads:[~2011-11-03  3:33 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-02 12:06 long fsck time Nguyen Thai Ngoc Duy
2011-11-02 12:10 ` Nguyen Thai Ngoc Duy
2011-11-02 21:33   ` Jeff King
2011-11-03  1:36     ` Nguyen Thai Ngoc Duy
2011-11-03  3:21       ` [PATCH] fsck: print progress Nguyễn Thái Ngọc Duy
2011-11-03  3:33         ` Jeff King [this message]
2011-11-03  8:50           ` Nguyễn Thái Ngọc Duy
2011-11-03 19:38             ` Jeff King
2011-11-03 19:43               ` Junio C Hamano
2011-11-03 19:51                 ` Jeff King
2011-11-03 20:28                   ` Junio C Hamano
2011-11-03 20:29                     ` Jeff King
2011-11-03 20:56                       ` Junio C Hamano
2011-11-03 21:18                         ` Jeff King
2011-11-04  3:10                           ` Nguyễn Thái Ngọc Duy
2011-11-05  7:53                             ` Stephen Boyd
2011-11-05  9:02                               ` Nguyen Thai Ngoc Duy
2011-11-05 19:15                                 ` Stephen Boyd
2011-11-05 23:59                               ` Junio C Hamano
2011-11-06  2:37                                 ` Nguyen Thai Ngoc Duy
2011-11-06  6:05                                   ` Junio C Hamano

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

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

  git send-email \
    --in-reply-to=20111103033325.GA10230@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=pclouds@gmail.com \
    /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.
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 NNTP newsgroup(s).