[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 24/29] block: Use blk_co_pwritev() in blk_write_zeroe
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL 24/29] block: Use blk_co_pwritev() in blk_write_zeroes() |
Date: |
Thu, 17 Mar 2016 16:56:37 +0100 |
Signed-off-by: Kevin Wolf <address@hidden>
---
block/block-backend.c | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/block/block-backend.c b/block/block-backend.c
index 475d27a..886c2f4 100644
--- a/block/block-backend.c
+++ b/block/block-backend.c
@@ -744,7 +744,8 @@ static void blk_write_entry(void *opaque)
}
static int blk_rw(BlockBackend *blk, int64_t sector_num, uint8_t *buf,
- int nb_sectors, CoroutineEntry co_entry)
+ int nb_sectors, CoroutineEntry co_entry,
+ BdrvRequestFlags flags)
{
AioContext *aio_context;
QEMUIOVector qiov;
@@ -766,6 +767,7 @@ static int blk_rw(BlockBackend *blk, int64_t sector_num,
uint8_t *buf,
.blk = blk,
.offset = sector_num << BDRV_SECTOR_BITS,
.qiov = &qiov,
+ .flags = flags,
.ret = NOT_DONE,
};
@@ -783,7 +785,7 @@ static int blk_rw(BlockBackend *blk, int64_t sector_num,
uint8_t *buf,
int blk_read(BlockBackend *blk, int64_t sector_num, uint8_t *buf,
int nb_sectors)
{
- return blk_rw(blk, sector_num, buf, nb_sectors, blk_read_entry);
+ return blk_rw(blk, sector_num, buf, nb_sectors, blk_read_entry, 0);
}
int blk_read_unthrottled(BlockBackend *blk, int64_t sector_num, uint8_t *buf,
@@ -808,18 +810,15 @@ int blk_read_unthrottled(BlockBackend *blk, int64_t
sector_num, uint8_t *buf,
int blk_write(BlockBackend *blk, int64_t sector_num, const uint8_t *buf,
int nb_sectors)
{
- return blk_rw(blk, sector_num, (uint8_t*) buf, nb_sectors,
blk_write_entry);
+ return blk_rw(blk, sector_num, (uint8_t*) buf, nb_sectors,
+ blk_write_entry, 0);
}
int blk_write_zeroes(BlockBackend *blk, int64_t sector_num,
int nb_sectors, BdrvRequestFlags flags)
{
- int ret = blk_check_request(blk, sector_num, nb_sectors);
- if (ret < 0) {
- return ret;
- }
-
- return bdrv_write_zeroes(blk_bs(blk), sector_num, nb_sectors, flags);
+ return blk_rw(blk, sector_num, NULL, nb_sectors, blk_write_entry,
+ BDRV_REQ_ZERO_WRITE);
}
static void error_callback_bh(void *opaque)
--
1.8.3.1
- [Qemu-devel] [PULL 12/29] blockdev: Split monitor reference from BB creation, (continued)
- [Qemu-devel] [PULL 12/29] blockdev: Split monitor reference from BB creation, Kevin Wolf, 2016/03/17
- [Qemu-devel] [PULL 19/29] block: Remove bdrv_states list, Kevin Wolf, 2016/03/17
- [Qemu-devel] [PULL 21/29] block: Use blk_co_preadv() for blk_read(), Kevin Wolf, 2016/03/17
- [Qemu-devel] [PULL 18/29] block: Use bdrv_next() instead of bdrv_states, Kevin Wolf, 2016/03/17
- [Qemu-devel] [PULL 22/29] block: Use blk_co_pwritev() for blk_write(), Kevin Wolf, 2016/03/17
- [Qemu-devel] [PULL 23/29] block: Pull up blk_read_unthrottled() implementation, Kevin Wolf, 2016/03/17
- [Qemu-devel] [PULL 26/29] block: Use blk_aio_prwv() for aio_read/write/write_zeroes, Kevin Wolf, 2016/03/17
- [Qemu-devel] [PULL 20/29] block: Use BdrvChild in BlockBackend, Kevin Wolf, 2016/03/17
- [Qemu-devel] [PULL 28/29] quorum: Emit QUORUM_REPORT_BAD for reads in fifo mode, Kevin Wolf, 2016/03/17
- [Qemu-devel] [PULL 25/29] block: Use blk_prw() in blk_pread()/blk_pwrite(), Kevin Wolf, 2016/03/17
- [Qemu-devel] [PULL 24/29] block: Use blk_co_pwritev() in blk_write_zeroes(),
Kevin Wolf <=
- [Qemu-devel] [PULL 29/29] iotests: Test QUORUM_REPORT_BAD in fifo mode, Kevin Wolf, 2016/03/17
- [Qemu-devel] [PULL 27/29] block: Use blk_co_pwritev() in blk_co_write_zeroes(), Kevin Wolf, 2016/03/17
- Re: [Qemu-devel] [PULL 00/29] Block patches, Peter Maydell, 2016/03/17