[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 5/8] block: Use blk_co_pwritev() in blk_write_zeroes
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PATCH 5/8] block: Use blk_co_pwritev() in blk_write_zeroes() |
Date: |
Tue, 8 Mar 2016 13:47:50 +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 4fd0545..5b9d387 100644
--- a/block/block-backend.c
+++ b/block/block-backend.c
@@ -748,7 +748,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;
@@ -770,6 +771,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,
};
@@ -787,7 +789,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,
@@ -812,18 +814,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] [PATCH 0/8] block: Introduce common read/write function, Kevin Wolf, 2016/03/08
- [Qemu-devel] [PATCH 3/8] block: Use blk_co_pwritev() for blk_write(), Kevin Wolf, 2016/03/08
- [Qemu-devel] [PATCH 2/8] block: Use blk_co_preadv() for blk_read(), Kevin Wolf, 2016/03/08
- [Qemu-devel] [PATCH 4/8] block: Pull up blk_read_unthrottled() implementation, Kevin Wolf, 2016/03/08
- [Qemu-devel] [PATCH 7/8] block: Use blk_aio_prwv() for aio_read/write/write_zeroes, Kevin Wolf, 2016/03/08
- [Qemu-devel] [PATCH 5/8] block: Use blk_co_pwritev() in blk_write_zeroes(),
Kevin Wolf <=
- [Qemu-devel] [PATCH 8/8] block: Use blk_co_pwritev() in blk_co_write_zeroes(), Kevin Wolf, 2016/03/08
- [Qemu-devel] [PATCH 1/8] block: Use BdrvChild in BlockBackend, Kevin Wolf, 2016/03/08
- [Qemu-devel] [PATCH 6/8] block: Use blk_prw() in blk_pread()/blk_pwrite(), Kevin Wolf, 2016/03/08
- Re: [Qemu-devel] [PATCH 0/8] block: Introduce common read/write function, Kevin Wolf, 2016/03/17
- Re: [Qemu-devel] [Qemu-block] [PATCH 0/8] block: Introduce common read/write function, Stefan Hajnoczi, 2016/03/17