[PATCH v2 1/2] qcow2: rename update_refcount_discard to queue_discard

Jean-Louis Dupond posted 2 patches 6 months ago
Maintainers: Kevin Wolf <kwolf@redhat.com>, Hanna Reitz <hreitz@redhat.com>
[PATCH v2 1/2] qcow2: rename update_refcount_discard to queue_discard
Posted by Jean-Louis Dupond 6 months ago
The function just queues discards, and doesn't do any refcount change.
So let's change the function name to align with its function.

Signed-off-by: Jean-Louis Dupond <jean-louis@dupond.be>
---
 block/qcow2-refcount.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c
index 0266542cee..8fb210501c 100644
--- a/block/qcow2-refcount.c
+++ b/block/qcow2-refcount.c
@@ -754,8 +754,8 @@ void qcow2_process_discards(BlockDriverState *bs, int ret)
     }
 }
 
-static void update_refcount_discard(BlockDriverState *bs,
-                                    uint64_t offset, uint64_t length)
+static void queue_discard(BlockDriverState *bs,
+                          uint64_t offset, uint64_t length)
 {
     BDRVQcow2State *s = bs->opaque;
     Qcow2DiscardRegion *d, *p, *next;
@@ -902,7 +902,7 @@ update_refcount(BlockDriverState *bs, int64_t offset, int64_t length,
             }
 
             if (s->discard_passthrough[type]) {
-                update_refcount_discard(bs, cluster_offset, s->cluster_size);
+                queue_discard(bs, cluster_offset, s->cluster_size);
             }
         }
     }
@@ -3619,7 +3619,7 @@ qcow2_discard_refcount_block(BlockDriverState *bs, uint64_t discard_block_offs)
         /* discard refblock from the cache if refblock is cached */
         qcow2_cache_discard(s->refcount_block_cache, refblock);
     }
-    update_refcount_discard(bs, discard_block_offs, s->cluster_size);
+    queue_discard(bs, discard_block_offs, s->cluster_size);
 
     return 0;
 }
-- 
2.49.0
Re: [PATCH v2 1/2] qcow2: rename update_refcount_discard to queue_discard
Posted by Eric Blake 6 months ago
On Tue, May 13, 2025 at 03:26:27PM +0200, Jean-Louis Dupond wrote:
> The function just queues discards, and doesn't do any refcount change.
> So let's change the function name to align with its function.
> 
> Signed-off-by: Jean-Louis Dupond <jean-louis@dupond.be>
> ---

Reviewed-by: Eric Blake <eblake@redhat.com>

>  block/qcow2-refcount.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c
> index 0266542cee..8fb210501c 100644
> --- a/block/qcow2-refcount.c
> +++ b/block/qcow2-refcount.c
> @@ -754,8 +754,8 @@ void qcow2_process_discards(BlockDriverState *bs, int ret)
>      }
>  }
>  
> -static void update_refcount_discard(BlockDriverState *bs,
> -                                    uint64_t offset, uint64_t length)
> +static void queue_discard(BlockDriverState *bs,
> +                          uint64_t offset, uint64_t length)
>  {
>      BDRVQcow2State *s = bs->opaque;
>      Qcow2DiscardRegion *d, *p, *next;
> @@ -902,7 +902,7 @@ update_refcount(BlockDriverState *bs, int64_t offset, int64_t length,
>              }
>  
>              if (s->discard_passthrough[type]) {
> -                update_refcount_discard(bs, cluster_offset, s->cluster_size);
> +                queue_discard(bs, cluster_offset, s->cluster_size);
>              }
>          }
>      }
> @@ -3619,7 +3619,7 @@ qcow2_discard_refcount_block(BlockDriverState *bs, uint64_t discard_block_offs)
>          /* discard refblock from the cache if refblock is cached */
>          qcow2_cache_discard(s->refcount_block_cache, refblock);
>      }
> -    update_refcount_discard(bs, discard_block_offs, s->cluster_size);
> +    queue_discard(bs, discard_block_offs, s->cluster_size);
>  
>      return 0;
>  }
> -- 
> 2.49.0
> 
> 

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.
Virtualization:  qemu.org | libguestfs.org