cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
0a122b
From 0e36c36c95c2616d020321782d4c8164c561eaec Mon Sep 17 00:00:00 2001
0a122b
Message-Id: <0e36c36c95c2616d020321782d4c8164c561eaec.1389014116.git.minovotn@redhat.com>
0a122b
In-Reply-To: <c8cc35838d42aa286242772d97e3a9be7bb786ba.1389014116.git.minovotn@redhat.com>
0a122b
References: <c8cc35838d42aa286242772d97e3a9be7bb786ba.1389014116.git.minovotn@redhat.com>
0a122b
From: Paolo Bonzini <pbonzini@redhat.com>
0a122b
Date: Mon, 9 Dec 2013 14:09:14 +0100
0a122b
Subject: [PATCH 26/50] block: add bdrv_aio_write_zeroes
0a122b
0a122b
RH-Author: Paolo Bonzini <pbonzini@redhat.com>
0a122b
Message-id: <1386598178-11845-29-git-send-email-pbonzini@redhat.com>
0a122b
Patchwork-id: 56065
0a122b
O-Subject: [RHEL 7.0 qemu-kvm PATCH 28/52] block: add bdrv_aio_write_zeroes
0a122b
Bugzilla: 1007815
0a122b
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
0a122b
RH-Acked-by: Fam Zheng <famz@redhat.com>
0a122b
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
0a122b
0a122b
This will be used by the SCSI layer.
0a122b
0a122b
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
0a122b
Reviewed-by: Peter Lieven <pl@kamp.de>
0a122b
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
0a122b
(cherry picked from commit d5ef94d43da8c57a2d597efbdec3d9a54d97fdf7)
0a122b
---
0a122b
 block.c               | 11 +++++++++++
0a122b
 include/block/block.h |  3 +++
0a122b
 trace-events          |  1 +
0a122b
 3 files changed, 15 insertions(+)
0a122b
0a122b
Signed-off-by: Michal Novotny <minovotn@redhat.com>
0a122b
---
0a122b
 block.c               | 11 +++++++++++
0a122b
 include/block/block.h |  3 +++
0a122b
 trace-events          |  1 +
0a122b
 3 files changed, 15 insertions(+)
0a122b
0a122b
diff --git a/block.c b/block.c
0a122b
index c6cad55..fc15370 100644
0a122b
--- a/block.c
0a122b
+++ b/block.c
0a122b
@@ -3690,6 +3690,17 @@ BlockDriverAIOCB *bdrv_aio_writev(BlockDriverState *bs, int64_t sector_num,
0a122b
                                  cb, opaque, true);
0a122b
 }
0a122b
 
0a122b
+BlockDriverAIOCB *bdrv_aio_write_zeroes(BlockDriverState *bs,
0a122b
+        int64_t sector_num, int nb_sectors, BdrvRequestFlags flags,
0a122b
+        BlockDriverCompletionFunc *cb, void *opaque)
0a122b
+{
0a122b
+    trace_bdrv_aio_write_zeroes(bs, sector_num, nb_sectors, flags, opaque);
0a122b
+
0a122b
+    return bdrv_co_aio_rw_vector(bs, sector_num, NULL, nb_sectors,
0a122b
+                                 BDRV_REQ_ZERO_WRITE | flags,
0a122b
+                                 cb, opaque, true);
0a122b
+}
0a122b
+
0a122b
 
0a122b
 typedef struct MultiwriteCB {
0a122b
     int error;
0a122b
diff --git a/include/block/block.h b/include/block/block.h
0a122b
index 6042e10..bcf71e2 100644
0a122b
--- a/include/block/block.h
0a122b
+++ b/include/block/block.h
0a122b
@@ -218,6 +218,9 @@ int bdrv_write(BlockDriverState *bs, int64_t sector_num,
0a122b
                const uint8_t *buf, int nb_sectors);
0a122b
 int bdrv_write_zeroes(BlockDriverState *bs, int64_t sector_num,
0a122b
                int nb_sectors, BdrvRequestFlags flags);
0a122b
+BlockDriverAIOCB *bdrv_aio_write_zeroes(BlockDriverState *bs, int64_t sector_num,
0a122b
+                                        int nb_sectors, BdrvRequestFlags flags,
0a122b
+                                        BlockDriverCompletionFunc *cb, void *opaque);
0a122b
 int bdrv_make_zero(BlockDriverState *bs, BdrvRequestFlags flags);
0a122b
 int bdrv_writev(BlockDriverState *bs, int64_t sector_num, QEMUIOVector *qiov);
0a122b
 int bdrv_pread(BlockDriverState *bs, int64_t offset,
0a122b
diff --git a/trace-events b/trace-events
0a122b
index fa5a65c..40d4312 100644
0a122b
--- a/trace-events
0a122b
+++ b/trace-events
0a122b
@@ -60,6 +60,7 @@ bdrv_aio_discard(void *bs, int64_t sector_num, int nb_sectors, void *opaque) "bs
0a122b
 bdrv_aio_flush(void *bs, void *opaque) "bs %p opaque %p"
0a122b
 bdrv_aio_readv(void *bs, int64_t sector_num, int nb_sectors, void *opaque) "bs %p sector_num %"PRId64" nb_sectors %d opaque %p"
0a122b
 bdrv_aio_writev(void *bs, int64_t sector_num, int nb_sectors, void *opaque) "bs %p sector_num %"PRId64" nb_sectors %d opaque %p"
0a122b
+bdrv_aio_write_zeroes(void *bs, int64_t sector_num, int nb_sectors, int flags, void *opaque) "bs %p sector_num %"PRId64" nb_sectors %d flags %#x opaque %p"
0a122b
 bdrv_lock_medium(void *bs, bool locked) "bs %p locked %d"
0a122b
 bdrv_co_readv(void *bs, int64_t sector_num, int nb_sector) "bs %p sector_num %"PRId64" nb_sectors %d"
0a122b
 bdrv_co_copy_on_readv(void *bs, int64_t sector_num, int nb_sector) "bs %p sector_num %"PRId64" nb_sectors %d"
0a122b
-- 
0a122b
1.7.11.7
0a122b