On Tue, Oct 11, 2011 at 7:44 AM, Zhi Yong Wu <zwu.ker...@gmail.com> wrote: > On Thu, Oct 6, 2011 at 12:17 AM, Stefan Hajnoczi > <stefa...@linux.vnet.ibm.com> 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