Skip to contentSkip to conversation

block: Trivial fixes in offloading code

PATCH Applied Fam Zheng 3 participants 9 messages Jul 2, 2018 – Jul 4, 2018 Block layer

lore
Share & tools
lore

Fam Zheng

author
#0 lore raw

cover block: Trivial fixes in offloading code

These are the low priority ones spotted by Kevin and Max last week.

Fam Zheng (4):
qcow2: Drop unused cluster_data
file-posix: Fix fd_open check in raw_co_copy_range_to
qcow2: Drop unreachable break

  raw: Drop superfluous semicolon
 block/file-posix.c | 2 +-
 block/qcow2.c      | 3 ---
 block/raw-format.c | 2 +-
 3 files changed, 2 insertions(+), 5 deletions(-)
Signature · 1 line
2.17.1
author
#1 lore raw

PATCH 1/4 qcow2: Drop unused cluster_data

---
 block/qcow2.c | 2 --
 1 file changed, 2 deletions(-)
block/qcow2.c +0 -2
index 2f9e58e0c4..3177c72de0 100644
@@ -3338,7 +3338,6 @@ qcow2_co_copy_range_to(BlockDriverState *bs,
     int ret;
     unsigned int cur_bytes; /* number of sectors in current iteration */
     uint64_t cluster_offset;
-    uint8_t *cluster_data = NULL;
     QCowL2Meta *l2meta = NULL;
 
     assert(!bs->encrypted);
@@ -3397,7 +3396,6 @@ fail:
 
     qemu_co_mutex_unlock(&s->lock);
 
-    qemu_vfree(cluster_data);
     trace_qcow2_writev_done_req(qemu_coroutine_self(), ret);
 
     return ret;
Signature · 1 line
2.17.1
author
#2 lore raw

PATCH 2/4 file-posix: Fix fd_open check in raw_co_copy_range_to

In reply to Fam Zheng

One of them is a typo. But update both to be more readable.

---
 block/file-posix.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
block/file-posix.c +1 -1
index 829ee538d8..e04e464e72 100644
@@ -2600,7 +2600,7 @@ static int coroutine_fn raw_co_copy_range_to(BlockDriverState *bs,
     }
 
     src_s = src->bs->opaque;
-    if (fd_open(bs) < 0 || fd_open(bs) < 0) {
+    if (fd_open(src->bs) < 0 || fd_open(dst->bs) < 0) {
         return -EIO;
     }
     return paio_submit_co_full(bs, src_s->fd, src_offset, s->fd, dst_offset,
Signature · 1 line
2.17.1
author
#3 lore raw

PATCH 3/4 qcow2: Drop unreachable break

In reply to Fam Zheng
---
 block/qcow2.c | 1 -
 1 file changed, 1 deletion(-)
block/qcow2.c +0 -1
index 3177c72de0..1a2e498a3c 100644
@@ -3292,7 +3292,6 @@ qcow2_co_copy_range_from(BlockDriverState *bs,
         case QCOW2_CLUSTER_COMPRESSED:
             ret = -ENOTSUP;
             goto out;
-            break;
 
         case QCOW2_CLUSTER_NORMAL:
             child = bs->file;
Signature · 1 line
2.17.1
author
#4 lore raw

PATCH 4/4 raw: Drop superfluous semicolon

In reply to Fam Zheng
---
 block/raw-format.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
block/raw-format.c +1 -1
index b78da564d4..8e648a5666 100644
@@ -177,7 +177,7 @@ static inline int raw_adjust_offset(BlockDriverState *bs, uint64_t *offset,
         /* There's not enough space for the write, or the read request is
          * out-of-range. Don't read/write anything to prevent leaking out of
          * the size specified in options. */
-        return is_write ? -ENOSPC : -EINVAL;;
+        return is_write ? -ENOSPC : -EINVAL;
     }
 
     if (*offset > INT64_MAX - s->offset) {
Signature · 1 line
2.17.1
Applied
#5 lore raw
In reply to Fam Zheng
Quoted 6 lines · Fam Zheng

These are the low priority ones spotted by Kevin and Max last week.

Fam Zheng (4):
qcow2: Drop unused cluster_data
file-posix: Fix fd_open check in raw_co_copy_range_to
qcow2: Drop unreachable break

Quoted 6 lines
  raw: Drop superfluous semicolon
 block/file-posix.c | 2 +-
 block/qcow2.c      | 3 ---
 block/raw-format.c | 2 +-
 3 files changed, 2 insertions(+), 5 deletions(-)

Thanks, applied to my block branch:

https://git.xanclic.moe/XanClic/qemu/commits/branch/block

Do you want to make qcow2_co_copy_range_to() do something special on BDRV_REQ_ZERO_WRITE? To me, it seems natural, but on the other hand maybe it wouldn't bring anything. If the protocol layer supports copy offloading, then it'll probably do that zero write efficiently anyway. If it doesn't, qemu-img convert will just fall back to the usual implementation which involves writing zeroes when zeroes are read, so...
What's your opinion?

Max

author
#6 lore raw
Quoted 19 lines · Max Reitz
Quoted 6 lines · Fam Zheng

These are the low priority ones spotted by Kevin and Max last week.

Fam Zheng (4):
qcow2: Drop unused cluster_data
file-posix: Fix fd_open check in raw_co_copy_range_to
qcow2: Drop unreachable break

Quoted 6 lines
  raw: Drop superfluous semicolon
 block/file-posix.c | 2 +-
 block/qcow2.c      | 3 ---
 block/raw-format.c | 2 +-
 3 files changed, 2 insertions(+), 5 deletions(-)

Thanks, applied to my block branch:

https://git.xanclic.moe/XanClic/qemu/commits/branch/block

Quoted 7 lines

Do you want to make qcow2_co_copy_range_to() do something special on BDRV_REQ_ZERO_WRITE? To me, it seems natural, but on the other hand maybe it wouldn't bring anything. If the protocol layer supports copy offloading, then it'll probably do that zero write efficiently anyway. If it doesn't, qemu-img convert will just fall back to the usual implementation which involves writing zeroes when zeroes are read, so...
What's your opinion?

In bdrv_co_copy_range_internal() there is

    if (flags & BDRV_REQ_ZERO_WRITE) {
        return bdrv_co_pwrite_zeroes(dst, dst_offset, bytes, flags);
    }

before calling driver .bdrv_co_copy_range_to() callback. I think this is enough?

Fam

#7 lore raw
Quoted 28 lines · Fam Zheng
Quoted 19 lines · Max Reitz
Quoted 6 lines · Fam Zheng

These are the low priority ones spotted by Kevin and Max last week.

Fam Zheng (4):
qcow2: Drop unused cluster_data
file-posix: Fix fd_open check in raw_co_copy_range_to
qcow2: Drop unreachable break

Quoted 6 lines
  raw: Drop superfluous semicolon
 block/file-posix.c | 2 +-
 block/qcow2.c      | 3 ---
 block/raw-format.c | 2 +-
 3 files changed, 2 insertions(+), 5 deletions(-)

Thanks, applied to my block branch:

https://git.xanclic.moe/XanClic/qemu/commits/branch/block

Quoted 7 lines

Do you want to make qcow2_co_copy_range_to() do something special on BDRV_REQ_ZERO_WRITE? To me, it seems natural, but on the other hand maybe it wouldn't bring anything. If the protocol layer supports copy offloading, then it'll probably do that zero write efficiently anyway. If it doesn't, qemu-img convert will just fall back to the usual implementation which involves writing zeroes when zeroes are read, so...
What's your opinion?

Quoted 7 lines

In bdrv_co_copy_range_internal() there is

    if (flags & BDRV_REQ_ZERO_WRITE) {
        return bdrv_co_pwrite_zeroes(dst, dst_offset, bytes, flags);
    }

before calling driver .bdrv_co_copy_range_to() callback. I think this is enough?

Ah, right... Yep, that's enough. :-)

Max

Reviewed-by on the v1 series
#8 lore raw
In reply to Fam Zheng
Quoted 6 lines · Fam Zheng

These are the low priority ones spotted by Kevin and Max last week.

Fam Zheng (4):
qcow2: Drop unused cluster_data
file-posix: Fix fd_open check in raw_co_copy_range_to
qcow2: Drop unreachable break

Quoted 11 lines
  raw: Drop superfluous semicolon
 block/file-posix.c | 2 +-
 block/qcow2.c      | 3 ---
 block/raw-format.c | 2 +-
 3 files changed, 2 insertions(+), 5 deletions(-)
Signature · 1 line
2.17.1