All of lore.kernel.org
 help / color / mirror / Atom feed
From: Juan Quintela <quintela@redhat.com>
To: Sanidhya Kashyap <sanidhya.iiith@gmail.com>
Cc: qemu list <qemu-devel@nongnu.org>,
	"Dr. David Alan Gilbert" <dgilbert@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v2 2/8] bitmap dump code via QAPI framework
Date: Wed, 04 Jun 2014 12:18:56 +0200	[thread overview]
Message-ID: <87zjhtrn8v.fsf@troll.troll> (raw)
In-Reply-To: <1401863911-5947-3-git-send-email-sanidhya.iiith@gmail.com> (Sanidhya Kashyap's message of "Wed, 4 Jun 2014 12:08:25 +0530")

Sanidhya Kashyap <sanidhya.iiith@gmail.com> wrote:
> Following are the changes made with respect to the previous version:
> Chen's advice
> 1) Replaced DIRTY_MEMORY_LOG_BITMAP with DIRTY_MEMORY_MIGRATION and
> completely removed the DIRTY_MEMORY_LOG_BITMAP flag.
>
> Eric's advice
> 2) Replaced FILE pointer with file descriptor.
> 3) Replaced fopen/fclose with qemu_open / qemu_close.
> 4) Removed text format, output only in machine-readable format.
> 5) Defined constants.



> +
> +static inline bool check_value(int64_t value, int64_t min_value,
> +                               const char *str, Error **errp)

If you pass min_value, you should also pass max_value, no?

> +{
> +    if (value < min_value) {
> +        error_setg(errp, "%s's value must be greater than %ld",
> +                         str, min_value);
> +        return false;
> +    }
> +    if (value > LOG_SIZE_MAX) {
> +        error_setg(errp, "%s's value must be less than %ld",
> +                         str, LOG_SIZE_MAX);

You use it for more things that LOG, right?

Name of the function can be changed:

   value_in_range()?


> +    g_free(logging_bitmap);
> +    qemu_close(b->fd);
> +    logging_bitmap = NULL;

Change orders of this line with previous one?

> +    b = NULL;

Why?  b is a local variable.
Do you mean:

	b->fd = -1;?

> +     */
> + log_thread_end:
> +    logging_bitmap_close(b);
> +    if (b->state == LOG_BITMAP_STATE_ACTIVE) {
> +        logging_state_set_status(b, LOG_BITMAP_STATE_ACTIVE,
> +                                    LOG_BITMAP_STATE_COMPLETED);
> +    } else if (b->state == LOG_BITMAP_STATE_CANCELING) {
> +        logging_state_set_status(b, LOG_BITMAP_STATE_CANCELING,
> +                                    LOG_BITMAP_STATE_COMPLETED);
> +    } else if (b->state == LOG_BITMAP_STATE_ERROR) {
> +        logging_state_set_status(b, LOG_BITMAP_STATE_ERROR,
> +                                    LOG_BITMAP_STATE_COMPLETED);
> +    }

can you use a switch here, please?

> +{
> +    int fd = -1;
> +    BitmapLogState *b = logging_current_state();
> +    Error *local_err = NULL;
> +    if (b->state == LOG_BITMAP_STATE_ACTIVE ||
> +            b->state == LOG_BITMAP_STATE_SETUP ||
> +            b->state == LOG_BITMAP_STATE_CANCELING) {
> +        b = NULL;

Not needed.  This is repeated in more places.

> +    b->total_epochs = epochs;
> +    b->current_frequency = frequency;

I would have written it as:

	if (has_epochs) {
             b->total_epochs = epochs;
        } else {
             b->total_epochs IN_EPOCH_VALUE;
        }

The same with current frequency.

Thanks, Juan.

  parent reply	other threads:[~2014-06-04 10:19 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-04  6:38 [Qemu-devel] [PATCH v2 0/8] Obtain dirty bitmap via VM logging Sanidhya Kashyap
2014-06-04  6:38 ` [Qemu-devel] [PATCH v2 1/8] enable sharing of the function between migration and bitmap dump Sanidhya Kashyap
2014-06-04 10:07   ` Juan Quintela
2014-06-04 10:16     ` Sanidhya Kashyap
2014-06-04 11:29       ` Juan Quintela
2014-06-04 11:43         ` Sanidhya Kashyap
2014-06-04  6:38 ` [Qemu-devel] [PATCH v2 2/8] bitmap dump code via QAPI framework Sanidhya Kashyap
2014-06-04 10:12   ` Dr. David Alan Gilbert
2014-06-04 10:18   ` Juan Quintela [this message]
2014-06-04  6:38 ` [Qemu-devel] [PATCH v2 3/8] RunState: added two new flags for bitmap dump and migration process Sanidhya Kashyap
2014-06-04 10:08   ` Dr. David Alan Gilbert
2014-06-04  6:38 ` [Qemu-devel] [PATCH v2 4/8] bitmap dump process with runstates Sanidhya Kashyap
2014-06-04  6:38 ` [Qemu-devel] [PATCH v2 5/8] hmp interface for dirty bitmap dump Sanidhya Kashyap
2014-06-04  6:38 ` [Qemu-devel] [PATCH v2 6/8] cancel mechanism for an already running dump bitmap process Sanidhya Kashyap
2014-06-04  6:38 ` [Qemu-devel] [PATCH v2 7/8] set the frequency of the " Sanidhya Kashyap
2014-06-04  6:38 ` [Qemu-devel] [PATCH v2 8/8] python script for extracting bitmap from a binary file Sanidhya Kashyap

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=87zjhtrn8v.fsf@troll.troll \
    --to=quintela@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=sanidhya.iiith@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.