thebeanogamer / rpms / qemu-kvm

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