block: Trivial fixes in offloading code
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
PATCH 1/4 qcow2: Drop unused cluster_data
--- block/qcow2.c | 2 -- 1 file changed, 2 deletions(-)
block/qcow2.c +0 -2
@@ -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
PATCH 2/4 file-posix: Fix fd_open check in raw_co_copy_range_to
In reply to Fam ZhengOne 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
@@ -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
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
@@ -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
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
@@ -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
Max Reitz
AppliedQuoted 6 lines · Fam Zheng
These are the low priority ones spotted by Kevin and Max last week.
Fam Zheng (4):
qcow2: Drop unusedcluster_data
file-posix: Fixfd_opencheck inraw_co_copy_range_to
qcow2: Drop unreachable break
Quoted 6 lines
raw: Drop superfluous semicolonblock/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
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 unusedcluster_data
file-posix: Fixfd_opencheck inraw_co_copy_range_to
qcow2: Drop unreachable breakQuoted 6 lines
raw: Drop superfluous semicolonblock/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:
Quoted 7 lines
Do you want to make
qcow2_co_copy_range_to()do something special onBDRV_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
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 unusedcluster_data
file-posix: Fixfd_opencheck inraw_co_copy_range_to
qcow2: Drop unreachable breakQuoted 6 lines
raw: Drop superfluous semicolonblock/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:
Quoted 7 lines
Do you want to make
qcow2_co_copy_range_to()do something special onBDRV_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 isif (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
Quoted 6 lines · Fam Zheng
These are the low priority ones spotted by Kevin and Max last week.
Fam Zheng (4):
qcow2: Drop unusedcluster_data
file-posix: Fixfd_opencheck inraw_co_copy_range_to
qcow2: Drop unreachable break
Quoted 11 lines
raw: Drop superfluous semicolonblock/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