Skip to contentSkip to conversation

block: add missing coroutine_fn to bdrv_sum_allocated_file_size()

PATCH Superseded Stefan Hajnoczi 2 participants 2 messages Mar 8, 2023 – Mar 9, 2023

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 block: add missing coroutine_fn to bdrv_sum_allocated_file_size()

Not a coroutine_fn, you say?

  static int64_t bdrv_sum_allocated_file_size(BlockDriverState *bs)
  {
      BdrvChild *child;
      int64_t child_size, sum = 0;
      QLIST_FOREACH(child, &bs->children, next) {
          if (child->role & (BDRV_CHILD_DATA | BDRV_CHILD_METADATA |
                             BDRV_CHILD_FILTERED))
          {
              child_size = bdrv_co_get_allocated_file_size(child->bs);
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Well what do we have here?!

I rest my case, your honor.

---
 block.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
block.c +1 -1
index 0dd604d0f6..a79297f99b 100644
@@ -5749,7 +5749,7 @@ exit:
  * sums the size of all data-bearing children.  (This excludes backing
  * children.)
  */
-static int64_t bdrv_sum_allocated_file_size(BlockDriverState *bs)
+static int64_t coroutine_fn bdrv_sum_allocated_file_size(BlockDriverState *bs)
 {
     BdrvChild *child;
     int64_t child_size, sum = 0;
Signature · 1 line
2.39.2
#1 lore raw
Quoted 28 lines · Stefan Hajnoczi

Not a coroutine_fn, you say?

   static int64_t bdrv_sum_allocated_file_size(BlockDriverState *bs)
   {
       BdrvChild *child;
       int64_t child_size, sum = 0;
       QLIST_FOREACH(child, &bs->children, next) {
           if (child->role & (BDRV_CHILD_DATA | BDRV_CHILD_METADATA |
                              BDRV_CHILD_FILTERED))
           {
               child_size = bdrv_co_get_allocated_file_size(child->bs);
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Well what do we have here?!

I rest my case, your honor.

---
  block.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
block.c +0 -0
index 0dd604d0f6..a79297f99b 100644

block.c exit: · line 5755

Quoted 8 lines
block.c +1 -1
@@ -5749,7 +5749,7 @@ exit:
   * sums the size of all data-bearing children.  (This excludes backing
   * children.)
   */
-static int64_t bdrv_sum_allocated_file_size(BlockDriverState *bs)
+static int64_t coroutine_fn bdrv_sum_allocated_file_size(BlockDriverState *bs)
  {
      BdrvChild *child;
      int64_t child_size, sum = 0;

Since there is only 1 call site, maybe worth renaming as bdrv_co_sum_allocated_file_size() in the same patch?