qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Max Reitz <mreitz@redhat.com>
To: Eric Blake <eblake@redhat.com>, qemu-devel@nongnu.org
Cc: qemu-block@nongnu.org, kwolf@redhat.com
Subject: Re: [Qemu-devel] [PATCH v13 05/12] qcow2: Name typedef for cluster type
Date: Mon, 8 May 2017 17:45:24 +0200	[thread overview]
Message-ID: <537ffb45-1126-e4cf-7b74-35865f7a8387@redhat.com> (raw)
In-Reply-To: <54dddadc-42a3-0256-09ee-03e8d4d5d0bc@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 2169 bytes --]

On 08.05.2017 17:43, Max Reitz wrote:
> On 07.05.2017 02:05, Eric Blake wrote:
>> Although it doesn't add all that much type safety (this is C, after
>> all), it does add a bit of legibility to use the name QCow2ClusterType
>> instead of a plain int.
>>
>> In particular, qcow2_get_cluster_offset() has an overloaded return
>> type; a QCow2ClusterType on success, and -errno on failure; keeping
>> the cluster type in a separate variable makes it slightly easier for
>> the next patch to make further computations based on the type.
>>
>> Suggested-by: Max Reitz <mreitz@redhat.com>
>> Signed-off-by: Eric Blake <eblake@redhat.com>
>>
>> ---
>> v13: new patch
>> ---
>>  block/qcow2.h          |  6 +++---
>>  block/qcow2-cluster.c  | 17 +++++++++--------
>>  block/qcow2-refcount.c |  2 +-
>>  3 files changed, 13 insertions(+), 12 deletions(-)
> 
> [...]
> 
>> diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c
>> index f3bfce6..ed78a30 100644
>> --- a/block/qcow2-cluster.c
>> +++ b/block/qcow2-cluster.c
> 
> Above this hunk, there is count_contiguous_clusters() with a variable
> "first_cluster_type" that could be a QCow2ClusterType as well.
> 
>> @@ -340,7 +340,7 @@ static int count_contiguous_clusters(int nb_clusters, int cluster_size,
>>   */
>>  static int count_contiguous_clusters_unallocated(int nb_clusters,
>>                                                   uint64_t *l2_table,
>> -                                                 int wanted_type)
>> +                                                 QCow2ClusterType wanted_type)
>>  {
>>      int i;
>>
> 
> And some lines below this (in this function), there is a "type" variable
> that (c|sh)ould be a QCow2ClusterType, too.

I see you're doing this in the next patch... Well, that's not really
where it belongs, though.

> Although it's quite a functional change, I would be willing to change
> both when applying, if you allowed me to.

I guess I'm extending my offer to handle the rebase fallout of the next
patch, too...?

Max

> (Once again, "no good deed shall go unpunished", as Markus likes to say :-))
> 
> Max
> 



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 512 bytes --]

  reply	other threads:[~2017-05-08 15:45 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-07  0:05 [Qemu-devel] [PATCH v13 00/12] qcow2 zero-cluster tweaks [was add blkdebug tests] Eric Blake
2017-05-07  0:05 ` [Qemu-devel] [PATCH v13 01/12] qcow2: Nicer variable names in qcow2_update_snapshot_refcount() Eric Blake
2017-05-08 15:27   ` Max Reitz
2017-05-08 15:36     ` Eric Blake
2017-05-08 15:37       ` Max Reitz
2017-05-07  0:05 ` [Qemu-devel] [PATCH v13 02/12] qcow2: Use consistent switch indentation Eric Blake
2017-05-07  0:05 ` [Qemu-devel] [PATCH v13 03/12] block: Update comments on BDRV_BLOCK_* meanings Eric Blake
2017-05-07  0:05 ` [Qemu-devel] [PATCH v13 04/12] qcow2: Correctly report status of preallocated zero clusters Eric Blake
2017-05-07  0:05 ` [Qemu-devel] [PATCH v13 05/12] qcow2: Name typedef for cluster type Eric Blake
2017-05-08 15:43   ` Max Reitz
2017-05-08 15:45     ` Max Reitz [this message]
2017-05-08 16:24     ` Eric Blake
2017-05-07  0:05 ` [Qemu-devel] [PATCH v13 06/12] qcow2: Make distinction between zero cluster types obvious Eric Blake
2017-05-08 15:54   ` Max Reitz
2017-05-08 17:15     ` Eric Blake
2017-05-08 18:39       ` Max Reitz
2017-05-07  0:05 ` [Qemu-devel] [PATCH v13 07/12] qcow2: Optimize zero_single_l2() to minimize L2 churn Eric Blake
2017-05-07  0:05 ` [Qemu-devel] [PATCH v13 08/12] iotests: Improve _filter_qemu_img_map Eric Blake
2017-05-07  0:05 ` [Qemu-devel] [PATCH v13 09/12] iotests: Add test 179 to cover write zeroes with unmap Eric Blake
2017-05-07  0:05 ` [Qemu-devel] [PATCH v13 10/12] qcow2: Optimize write zero of unaligned tail cluster Eric Blake
2017-05-07  0:05 ` [Qemu-devel] [PATCH v13 11/12] qcow2: Assert that cluster operations are aligned Eric Blake
2017-05-07  0:05 ` [Qemu-devel] [PATCH v13 12/12] qcow2: Discard/zero clusters by byte count Eric Blake
2017-05-08 16:26 ` [Qemu-devel] [PATCH v13 00/12] qcow2 zero-cluster tweaks [was add blkdebug tests] Max Reitz

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=537ffb45-1126-e4cf-7b74-35865f7a8387@redhat.com \
    --to=mreitz@redhat.com \
    --cc=eblake@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /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).