On Mon, Mar 23, 2015 at 12:46:09PM +0800, Fam Zheng wrote: > @@ -3435,6 +3446,10 @@ static int coroutine_fn > bdrv_co_do_pwritev(BlockDriverState *bs, > bytes = ROUND_UP(bytes, align); > } > > + if (use_local_qiov) { > + /* Local buffer may have non-zero data. */ > + flags &= ~BDRV_REQ_ZERO_WRITE; > + } > ret = bdrv_aligned_pwritev(bs, &req, offset, bytes, > use_local_qiov ? &local_qiov : qiov, > flags); > @@ -3475,14 +3490,32 @@ int coroutine_fn > bdrv_co_write_zeroes(BlockDriverState *bs, > int64_t sector_num, int nb_sectors, > BdrvRequestFlags flags) > { > + int ret; > + > trace_bdrv_co_write_zeroes(bs, sector_num, nb_sectors, flags); > > - if (!(bs->open_flags & BDRV_O_UNMAP)) { > - flags &= ~BDRV_REQ_MAY_UNMAP; > - }
Why is it okay to drop this when the request is aligned? > + if (bdrv_req_is_aligned(bs, sector_num << BDRV_SECTOR_BITS, > + nb_sectors << BDRV_SECTOR_BITS)) { > + ret = bdrv_co_do_writev(bs, sector_num, nb_sectors, NULL, > + BDRV_REQ_ZERO_WRITE | flags); > + } else {
pgpohTxuQtrgo.pgp
Description: PGP signature