[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-block] [Qemu-devel] [PATCH v4 12/20] qed: Switch to .bdrv_co_b

From: Eric Blake
Subject: Re: [Qemu-block] [Qemu-devel] [PATCH v4 12/20] qed: Switch to .bdrv_co_block_status()
Date: Thu, 30 Nov 2017 17:17:14 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0

On 11/30/2017 04:27 AM, Vladimir Sementsov-Ogievskiy wrote:
12.10.2017 21:59, Eric Blake wrote:
We are gradually moving away from sector-based interfaces, towards
byte-based.  Update the qed driver accordingly, taking the opportunity
to inline qed_is_allocated_cb() into its lone caller (the callback
used to be important, until we switched qed to coroutines).  There is
no intent to optimize based on the want_zero flag for this format.

Signed-off-by: Eric Blake <address@hidden>

      BDRVQEDState *s = bs->opaque;
-    size_t len = (size_t)nb_sectors * BDRV_SECTOR_SIZE;
-    QEDIsAllocatedCB cb = {
-        .bs = bs,
-        .pos = (uint64_t)sector_num * BDRV_SECTOR_SIZE,
-        .status = BDRV_BLOCK_OFFSET_MASK,
-        .pnum = pnum,
-        .file = file,
-    };
+    size_t len;

size_t len = bytes;

Or rather, size_t len = MIN(bytes, SIZE_MAX); thanks to 32-bit platforms.

with that:
Reviewed-by: Vladimir Sementsov-Ogievskiy <address@hidden>

+    int status;
      QEDRequest request = { .l2_table = NULL };
      uint64_t offset;
      int ret;

-    ret = qed_find_cluster(s, &request, cb.pos, &len, &offset);
-    qed_is_allocated_cb(&cb, ret, offset, len);
+    ret = qed_find_cluster(s, &request, pos, &len, &offset);

len is in-out parameter, you can't use it uninitialized.

Good catch.

Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

reply via email to

[Prev in Thread] Current Thread [Next in Thread]