[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-stable] [Qemu-devel] [PATCH 1/2] block: Fix unaligned zero wri
From: |
Fam Zheng |
Subject: |
Re: [Qemu-stable] [Qemu-devel] [PATCH 1/2] block: Fix unaligned zero write |
Date: |
Tue, 24 Mar 2015 09:19:42 +0800 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
On Mon, 03/23 14:14, Stefan Hajnoczi wrote:
> 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?
It's not. I will restore it.
>
> > + 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 {