[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 3/6] block: switch bdrv_read()/bdrv_write() to c
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-devel] [PATCH 3/6] block: switch bdrv_read()/bdrv_write() to coroutines |
Date: |
Wed, 12 Oct 2011 10:03:16 +0100 |
On Tue, Oct 11, 2011 at 7:44 AM, Zhi Yong Wu <address@hidden> wrote:
> On Thu, Oct 6, 2011 at 12:17 AM, Stefan Hajnoczi
> <address@hidden> wrote:
>> @@ -1101,36 +1144,7 @@ static void set_dirty_bitmap(BlockDriverState *bs,
>> int64_t sector_num,
>> int bdrv_write(BlockDriverState *bs, int64_t sector_num,
>> const uint8_t *buf, int nb_sectors)
>> {
>> - BlockDriver *drv = bs->drv;
>> -
>> - if (!bs->drv)
>> - return -ENOMEDIUM;
>> -
>> - if (bdrv_has_async_rw(drv) && qemu_in_coroutine()) {
>> - QEMUIOVector qiov;
>> - struct iovec iov = {
>> - .iov_base = (void *)buf,
>> - .iov_len = nb_sectors * BDRV_SECTOR_SIZE,
>> - };
>> -
>> - qemu_iovec_init_external(&qiov, &iov, 1);
>> - return bdrv_co_writev(bs, sector_num, nb_sectors, &qiov);
>> - }
>> -
>> - if (bs->read_only)
>> - return -EACCES;
>> - if (bdrv_check_request(bs, sector_num, nb_sectors))
>> - return -EIO;
>> -
>> - if (bs->dirty_bitmap) {
>> - set_dirty_bitmap(bs, sector_num, nb_sectors, 1);
>> - }
>> -
>> - if (bs->wr_highest_sector < sector_num + nb_sectors - 1) {
>> - bs->wr_highest_sector = sector_num + nb_sectors - 1;
>> - }
> The above codes are removed, will it be safe?
If you are checking that removing bs->wr_highest_sector code is okay,
then yes, it is safe because bdrv_co_do_writev() does the dirty bitmap
and wr_highest_sector updates. We haven't lost any code by unifying
request processing - bdrv_co_do_writev() must do everything that
bdrv_aio_writev() and bdrv_write() did.
Stefan
- [Qemu-devel] [PATCH 0/6] block: do request processing in a coroutine, Stefan Hajnoczi, 2011/10/05
- [Qemu-devel] [PATCH 2/6] block: split out bdrv_co_do_readv() and bdrv_co_do_writev(), Stefan Hajnoczi, 2011/10/05
- [Qemu-devel] [PATCH 5/6] block: mark blocks dirty on coroutine write completion, Stefan Hajnoczi, 2011/10/05
- [Qemu-devel] [PATCH 6/6] block: switch bdrv_aio_writev() to coroutines, Stefan Hajnoczi, 2011/10/05
- [Qemu-devel] [PATCH 1/6] block: directly invoke .bdrv_aio_*() in bdrv_co_io_em(), Stefan Hajnoczi, 2011/10/05
- Re: [Qemu-devel] [PATCH 0/6] block: do request processing in a coroutine, Zhi Yong Wu, 2011/10/11
- Re: [Qemu-devel] [PATCH 0/6] block: do request processing in a coroutine, Kevin Wolf, 2011/10/12